Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 6, 2026

This sample demonstrates how to use Dev Proxy to track and analyze API usage patterns using the ExecutionSummaryPlugin combined with multiple reporter plugins.

Features

  • ExecutionSummaryPlugin configured to track API requests grouped by URL
  • Multiple output formats: PlainTextReporter, JsonReporter, and MarkdownReporter
  • Interactive web app with buttons to call different API endpoints
  • Live statistics: total requests, success count, errors, and unique endpoints
  • Quick actions: "Simulate User Session" and "Burst 10 Requests" for testing

Configuration

  • Dev Proxy config stored in .devproxy folder (recommended location)
  • Minimal configuration with default values removed for clarity
  • Uses JSONPlaceholder API as the target for demonstration

Validation Complete ✓

Ran validation skill and fixed:

  • Changed PRESET from "Yes" to "No" (sample has web app specific to JSONPlaceholder)
  • Updated dates to 2026-01-18

All checks pass:

  • ✓ Required files present
  • ✓ Metadata name matches folder
  • ✓ Date format correct (YYYY-MM-DD)
  • ✓ Descriptions match (short = long[0])
  • ✓ Tracking pixel present
  • ✓ Version matches badge
  • ✓ Schema validation passes

Web App Screenshot

API Usage Analytics Web App

Original prompt

This section details on the original issue you should resolve

<issue_title>Sample: api-usage-analytics - Track which endpoints are used most</issue_title>
<issue_description>## Summary
Create a sample that tracks which API endpoints are used most frequently.

Plugins to use

  • ExecutionSummaryPlugin - generates execution summaries
  • Various reporters (PlainTextReporter, JsonReporter, MarkdownReporter)

What to build

  • Configure execution summary generation
  • Sample app with multiple API endpoints
  • Show summary reports with:
    • Request counts per endpoint
    • Response status codes
    • Timing information
  • Different output formats (text, JSON, markdown)

Why this is compelling

Understand API usage patterns. Identify hotspots and optimization opportunities.

Reference docs

  • ExecutionSummaryPlugin technical reference
  • Reporter plugins technical reference
    </issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Create sample to track API endpoint usage Add api-usage-analytics sample - Track API endpoint usage with ExecutionSummaryPlugin Jan 6, 2026
Copilot AI requested a review from waldekmastykarz January 6, 2026 11:52
@github-actions
Copy link

github-actions bot commented Jan 9, 2026

Validation failed!

File: samples/api-usage-analytics/assets/sample.json

Copy link
Member

@waldekmastykarz waldekmastykarz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot make a web app to show this in action. It would be more convenient than repeated calling API using curl

"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.0.0/executionsummaryplugin.schema.json",
"groupBy": "url"
},
"logLevel": "information",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot these properties are default so remove them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 0b39d1a.

"longDescription": [
"Demonstrates how to use Dev Proxy to track and analyze API usage patterns, showing which endpoints are used most frequently with reports in plain text, JSON, and Markdown formats."
],
"creationDateTime": "2026-01-06",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot update to today's date

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to 2026-01-09 in 0b39d1a.

Copy link
Contributor Author

Copilot AI commented Jan 9, 2026

@copilot make a web app to show this in action. It would be more convenient than repeated calling API using curl

Added a web app with interactive buttons to call different API endpoints, live statistics, and a request log. Includes "Simulate User Session" and "Burst 10 Requests" quick actions. Commit 0b39d1a.

API Usage Analytics Web App

@waldekmastykarz
Copy link
Member

@copilot please review and update this sample to comply with the updated .github/copilot-instructions.md

Copy link
Contributor Author

Copilot AI commented Jan 10, 2026

@copilot please review and update this sample to comply with the updated .github/copilot-instructions.md

Reviewed and verified the sample complies with copilot-instructions.md in commit a76a0bf:

  • ✓ shortDescription and longDescription have identical content
  • ✓ Date format is YYYY-MM-DD (updated to 2026-01-10)
  • ✓ Schema version v2.0.0
  • ✓ Tracking pixel present
  • ✓ Badge format correct
  • ✓ All required metadata fields present
  • ✓ Plugin order follows best practices (reporters last)

@waldekmastykarz
Copy link
Member

@copilot please also:

  • Change the author in assets/sample.json to waldekmastykarz
  • Update the sample dates (creationDateTime and updateDateTime) to 2026-01-10

Copy link
Contributor Author

Copilot AI commented Jan 10, 2026

@copilot please also:

  • Change the author in assets/sample.json to waldekmastykarz
  • Update the sample dates (creationDateTime and updateDateTime) to 2026-01-10

Both changes are already in place from commit a76a0bf:

  • Author is set to waldekmastykarz (line 47-53)
  • Both creationDateTime and updateDateTime are set to 2026-01-10 (lines 12-13)

@waldekmastykarz
Copy link
Member

@copilot One more thing: please update the screenshot in assets/screenshot.png to reflect the current sample output.

Copy link
Contributor Author

Copilot AI commented Jan 10, 2026

@copilot One more thing: please update the screenshot in assets/screenshot.png to reflect the current sample output.

Updated in 2a63618.

Updated screenshot

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • github-production-user-asset-6210df.s3.amazonaws.com
    • Triggering command: /usr/bin/curl curl -L -o /home/REDACTED/work/proxy-samples/proxy-samples/samples/api-usage-analytics/assets/screenshot.png REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@waldekmastykarz
Copy link
Member

@copilot Please make the following changes:

  1. Move all Dev Proxy config files to the .devproxy folder - All configuration files (like devproxyrc.json, mock files, error files, etc.) should be placed in a .devproxy subfolder within the sample directory. This is the recommended location for Dev Proxy configs.

  2. Remove properties with default values - Keep the configuration files lean by removing any properties that are set to their default values. For example:

    • Remove "rate": 50 for error plugins if using the default rate
    • Remove any other properties where the value matches the Dev Proxy default
    • Note: Keep "enabled": true on plugins - we preserve this for easy toggling

This keeps the sample configs minimal and easier to understand.

Copy link
Contributor Author

Copilot AI commented Jan 10, 2026

@copilot Please make the following changes:

  1. Move all Dev Proxy config files to the .devproxy folder - All configuration files (like devproxyrc.json, mock files, error files, etc.) should b...

Done in 3d45d5f:

  1. Moved config to .devproxy folder - devproxyrc.json is now at .devproxy/devproxyrc.json
  2. Removed default values:
    • Removed executionSummaryPlugin config section entirely (since groupBy: "url" is the default)
    • Removed configSection from ExecutionSummaryPlugin since no custom config is needed
    • Kept "enabled": true on all plugins as requested

Also updated:

  • package.json - simplified devproxy command (no --config-file needed when config is in .devproxy)
  • README.md - updated config file path references
  • index.html - updated instructions

Copy link
Member

@waldekmastykarz waldekmastykarz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot update screenshot based on the latest version of index.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 2bd7fa5.

Updated screenshot

- Navigate to the sample folder: `cd samples/api-usage-analytics`
- Run `npm install` to install dependencies
- Run `npm start` to start Dev Proxy and the web server
- Open http://localhost:3000 in your browser (configure browser to use Dev Proxy at `http://127.0.0.1:8000`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot not needed to configure the browser to use proxy, it's done automatically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 2bd7fa5. Updated both index.html and README.md to remove the browser proxy configuration instruction.

Copilot AI and others added 6 commits January 18, 2026 15:01
Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
@waldekmastykarz
Copy link
Member

@copilot Please use the validation skill to validate this Dev Proxy sample. Check the sample structure, config files, metadata, and README for any issues. If you find problems, please fix them.

Co-authored-by: waldekmastykarz <11164679+waldekmastykarz@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 18, 2026

@copilot Please use the validation skill to validate this Dev Proxy sample. Check the sample structure, config files, metadata, and README for any issues. If you find problems, please fix them.

Ran the validation skill and fixed one issue in e816c55:

  • Changed PRESET from "Yes" to "No" (sample has web app specific to JSONPlaceholder API, not reusable for other APIs)
  • Updated dates to 2026-01-18

All validation checks now pass:

  • ✓ Required files present (.devproxy/, README.md, assets/sample.json)
  • ✓ Metadata name matches folder (pnp-devproxy-api-usage-analytics)
  • ✓ Date format correct (YYYY-MM-DD)
  • ✓ Descriptions match (shortDescription = longDescription[0])
  • ✓ Tracking pixel present
  • ✓ Version matches badge (v2.0.0)
  • ✓ Schema validation passes
  • ✓ Startup command correct (uses devproxy since config is in .devproxy/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sample: api-usage-analytics - Track which endpoints are used most

2 participants