March 30th, 2023

Microsoft Graph Developer Proxy v0.6 with monitoring, rate limiting and paging guidance

Build resilient and performant apps with the latest preview version of the Microsoft Graph Developer Proxy. In this new version, we’re excited to introduce support for monitoring specific processes, a new plugin allowing testing against rate limiting supported APIs, provide a new OData paging guidance and other smaller improvements!

Download Microsoft Graph Developer Proxy v0.6 and check if your apps properly handle API errors.

Monitor specific processes

Using Developer Proxy, you can intercept any calls to any APIs happening on your machine. While this could be a way to validate how your app is handling errors, you might also want to isolate which processes you should be intercepting with the Developer Proxy.

In this release, we are introducing support to enable which processes you want to intercept requests from by specifying either their ids or their names. This allows you to test only the calls coming from a terminal, a browser or from a back-end service. Consequently, this will likely reduce the number of unwanted requests coming from your machine (OneDrive, Teams, etc.) and allow for more clarity in the calls reported by the Developer Proxy.

Monitoring a single process in Developer Proxy

To start monitoring a single process:

  • Use the `–watch-pids` argument when starting the proxy to use the process id or
  • Use the `–watch-process-names` argument when starting the proxy to use the process name or

https://gist.github.com/sebastienlevert/22efee2149544380cef22371253b7cf8

To learn more about using recording in Developer Proxy, see the documentation.

Test your app against rate limiting APIs

As you use the Developer Proxy to simulate errors in your apps, you might have come across RateLimit-* headers. In this release, you will now be able to use endpoints that are embracing rate limiting capabilities (including Files and Sites on Microsoft Graph)!

To get started, run mgdp with our specific plugin preset using the following command:

https://gist.github.com/waldekmastykarz/285ef0a048a4c52b253f200aee6b509b

When you start calling Microsoft Graph, at first, all requests will be passed through. As you get closer to the threshold limit, Developer Proxy will start adding the RateLimit headers to responses:

RateLimit headers added by Developer Proxy to a response from Microsoft Graph

RateLimit headers added by Developer Proxy to a response from Microsoft Graph

If you keep calling Microsoft Graph, and don’t back off, exceeding the resource limit, Developer Proxy will throttle you and return a 429 Too Many Requests response. In the Retry-After header, Developer Proxy will communicate the number of seconds for you to wait before retrying the request.

Developer Proxy throttling requests after exceeding the rate limiting threshold

Developer Proxy throttling requests after exceeding the rate limiting threshold

If you don’t back off and keep issuing web requests, Developer Proxy will forcefully fail your requests with a 429 Too Many Requests response.

Developer Proxy forcefully failing requests that don’t adhere to the Retry-After limit.

Developer Proxy forcefully failing requests that don’t adhere to the Retry-After limit

You’ll be able to resume calling Microsoft Graph after the threshold limit resets.

The Rate Limiting Plugin is highly configurable and allows you to provide values for its core settings such as the rate limit, warning threshold or reset window. By configuring the names of the response headers, you can use it with APIs that use non-standard header names, such as X-RateLimit-x.

With this preset, you will be able to test your application against the rate limiting capabilities of your API and the Developer Proxy will make sure to reach the limits quickly so you can validate the parts of your code that are dealing with this feature.

To learn more about the rate limiting plugin and its configuration options, see the documentation.

A new OData Paging guidance

When using an API, calling it in the most efficient way is often key to a great user experience. In this release, we introduce guidance that allows you to identify when you’re iterating through a collection of entities by manually constructing paging URLs, which exposes you to data integrity errors.

The Developer Proxy will inspect responses from the API and validate that you are calling the next page of data while using the @odata.nextLink. If not, the plugin will return a warning with a link to the documentation to help you understand how to use and benefit from the OData paging capabilities.

Developer Proxy showing a warning about a paging URL being constructed manually.

Developer Proxy showing a warning about a paging URL being constructed manually

To learn more about the OData paging guidance, see the documentation.

Additional improvements

Binary responses support in the random error plugin

To allow supported more varied error responses and scenarios, this release brings support for binary response to GenericRandomErrorPlugin. You can now return binary data from a file as part of your mocks. To learn more, see the documentation.

Get better support with the client request ID guidance

Specifically for Microsoft Graph, we want to provide a seamless experience when needing to interact with our support organization. To help this, we have built a plugin that helps ensure that all your requests to Microsoft Graph are decorated with a client-request-id header that helps both your team and our team to identify the faulty calls to our services. To learn more, see the documentation.

Renamed disabled to enabled in our configuration file

To make our configuration files easier to read, we decided to use positive values instead of negative values to identify boolean settings. In this case we changed disabled to enabled. If you are using a custom configuration file, make sure you change the value as this is a breaking change.

Renamed logLevel to log-level

To have consistency across our parameters when using our CLI, we renamed logLevel to log-level to ensure we are using kebab-case rules across all our plugins.

Try the Developer Proxy v0.6 today

Download Microsoft Graph Developer Proxy v0.6 and check if your apps properly handle API errors.

We’re excited about this new version and can’t wait for you to try it out. We’re looking forward to hearing from you about these improvements and how we can continue to make the Microsoft Graph Developer Proxy even better.

Follow us on @Microsoft365Dev/Twitter to stay up to date on the latest news and announcements.

Author

Sébastien Levert
Senior Product Manager

Sebastien is a Senior Product Manager on the Microsoft Graph Developer Experiences team where he is focusing on Kiota, the Microsoft Graph Toolkit and the Microsoft Graph SDKs.

Waldek Mastykarz
Principal Developer Advocate

0 comments

Discussion are closed.