router icon indicating copy to clipboard operation
router copied to clipboard

feat: memory tracking metrics

Open rohan-b99 opened this issue 4 months ago • 2 comments


Checklist

Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.

  • [ ] PR description explains the motivation for the change and relevant context for reviewing
  • [ ] PR description links appropriate GitHub/Jira tickets (creating when necessary)
  • [ ] Changeset is included for user-facing changes
  • [ ] Changes are compatible[^1]
  • [ ] Documentation[^2] completed
  • [x] Performance impact assessed and acceptable
  • [ ] Metrics and logs are added[^3] and documented
  • Tests added and passing[^4]
    • [x] Unit tests
    • [ ] Integration tests
    • [ ] Manual tests, as necessary

The majority of this work is from https://github.com/apollographql/router/pull/8525, this PR includes some extra tests and places where memory tracking has been added.

Performance testing with vegeta shows the changes have negligible impact:

% cat dev/perf.59242.vegeta | vegeta report                                  
Requests      [total, rate, throughput]         2500, 500.20, 496.03
Duration      [total, attack, wait]             5.04s, 4.998s, 41.965ms
Latencies     [min, mean, 50, 90, 95, 99, max]  3.481ms, 12.243ms, 6.396ms, 19.94ms, 29.15ms, 135.015ms, 311.06ms
Bytes In      [total, mean]                     6248410, 2499.36
Bytes Out     [total, mean]                     14312750, 5725.10
Success       [ratio]                           100.00%
Status Codes  [code:count]                      200:2500

% cat memory-tracking-metrics/perf.64046.vegeta | vegeta report 
Requests      [total, rate, throughput]         2500, 500.14, 497.60
Duration      [total, attack, wait]             5.024s, 4.999s, 25.518ms
Latencies     [min, mean, 50, 90, 95, 99, max]  3.368ms, 11.976ms, 5.898ms, 20.586ms, 29.021ms, 122.014ms, 314.001ms
Bytes In      [total, mean]                     10612414, 4244.97
Bytes Out     [total, mean]                     14312750, 5725.10
Success       [ratio]                           100.00%
Status Codes  [code:count]                      200:2500  

Exceptions

Note any exceptions here

Notes

[^1]: It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this. [^2]: Configuration is an important part of many changes. Where applicable please try to document configuration examples. [^3]: A lot of (if not most) features benefit from built-in observability and debug-level logs. Please read this guidance on metrics best-practices. [^4]: Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions.

rohan-b99 avatar Dec 04 '25 17:12 rohan-b99

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

0 new, 1 changed, 0 removed
* graphos/routing/(latest)/observability/router-telemetry-otel/enabling-telemetry/standard-instruments.mdx

Build ID: 3c3dcb0fe6d659213bdd2a00 Build Logs: View logs

URL: https://www.apollographql.com/docs/deploy-preview/3c3dcb0fe6d659213bdd2a00

apollo-librarian[bot] avatar Dec 04 '25 17:12 apollo-librarian[bot]

@rohan-b99, please consider creating a changeset entry in /.changesets/. These instructions describe the process and tooling.

github-actions[bot] avatar Dec 04 '25 17:12 github-actions[bot]