Skip to content

Ensure http.server.response.body.size metric is recorded#8697

Merged
rohan-b99 merged 5 commits intodevfrom
rohan-b99/missing-metrics-including-response-body-size
Dec 3, 2025
Merged

Ensure http.server.response.body.size metric is recorded#8697
rohan-b99 merged 5 commits intodevfrom
rohan-b99/missing-metrics-including-response-body-size

Conversation

@rohan-b99
Copy link
Copy Markdown
Contributor

@rohan-b99 rohan-b99 commented Dec 2, 2025


To test, use this config:

telemetry:
  instrumentation:
    instruments:
      router:
        http.server.response.body.size: true
  exporters:
    metrics:
      prometheus:
        enabled: true
        listen: 127.0.0.1:9000
        path: /metrics

Send a request to the router:
curl -v http://localhost:4000/ -H "Content-Type: application/json" -d '{"query": "{ __typename }"}'

Go to http://localhost:9000/metrics
Search for http_server_response_body_size - see there is a match that corresponds to the returned content length

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 compatible1
  • Documentation2 completed
  • Performance impact assessed and acceptable
  • Metrics and logs are added3 and documented
  • Tests added and passing4
    • Unit tests
    • Integration tests
    • Manual tests, as necessary

Exceptions

Note any exceptions here

Notes

Footnotes

  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 rohan-b99 requested a review from a team December 2, 2025 11:14
@apollo-librarian
Copy link
Copy Markdown
Contributor

apollo-librarian bot commented Dec 2, 2025

✅ 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/instruments.mdx

Build ID: 08ec1f75eba63b2511e88bf0
Build Logs: View logs

URL: https://www.apollographql.com/docs/deploy-preview/08ec1f75eba63b2511e88bf0

@github-actions

This comment has been minimized.

@rohan-b99 rohan-b99 requested a review from a team as a code owner December 2, 2025 12:15
Comment on lines +6 to +7
http.server.request.duration: true
http.server.response.body.size: false No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a reason these are going from true to false?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The default requirement level (Required) enabled them by default, they didn't show up before as content-length was not specified in the test yaml but since we now do it based on the body it would show up if not disabled here. I figured it would be best to disable it for the tests not relating to response body size so it doesn't show up in the snapshots

@rohan-b99 rohan-b99 merged commit a98e670 into dev Dec 3, 2025
15 checks passed
@rohan-b99 rohan-b99 deleted the rohan-b99/missing-metrics-including-response-body-size branch December 3, 2025 17:20
@abernix abernix mentioned this pull request Dec 12, 2025
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.

3 participants