Skip to content

jemalloc metrics#7735

Merged
Velfi merged 9 commits intodevfrom
zelda-jemalloc-metrics
Jun 27, 2025
Merged

jemalloc metrics#7735
Velfi merged 9 commits intodevfrom
zelda-jemalloc-metrics

Conversation

@Velfi
Copy link
Contributor

@Velfi Velfi commented Jun 20, 2025

This PR adds the following new metrics when running Linux with the global-allocator feature:


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.

@github-actions

This comment has been minimized.

@apollo-librarian
Copy link

apollo-librarian bot commented Jun 20, 2025

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

0 new, 7 changed, 1 removed
* graphos/routing/(latest)/security/jwt.mdx
* graphos/routing/(latest)/self-hosted/containerization/docker.mdx
* graphos/routing/(latest)/self-hosted/containerization/index.mdx
* graphos/routing/(latest)/self-hosted/containerization/kubernetes/other-considerations.mdx
* graphos/routing/(latest)/self-hosted/index.mdx
* graphos/routing/(latest)/_sidebar.yaml
* graphos/routing/v1/operations/subscriptions/index.mdx
- graphos/routing/(latest)/self-hosted/containerization/docker-router-only.mdx

Build ID: aa3f98dd98ae5cd6872aa81c

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

@Velfi Velfi force-pushed the zelda-jemalloc-metrics branch from 6633373 to 6f52726 Compare June 24, 2025 16:09
@Velfi Velfi marked this pull request as ready for review June 24, 2025 16:27
@Velfi Velfi requested a review from a team June 24, 2025 16:27
@Velfi Velfi requested a review from a team as a code owner June 24, 2025 16:27
Copy link
Contributor

@garypen garypen left a comment

Choose a reason for hiding this comment

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

Looks great. I've made a suggestion about trying to leverage the jemalloc stats cache.

Velfi and others added 3 commits June 25, 2025 09:31
Co-authored-by: Gary Pennington <gary@apollographql.com>
@garypen garypen self-requested a review June 26, 2025 07:50
Copy link
Contributor

@garypen garypen left a comment

Choose a reason for hiding this comment

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

One small fix so it can compile.

I made the fix on my laptop and then tested in a linux VM (that was a whole thing...) and found the integration test failed. Extract from fail:

thread 'integration::metrics::test_jemalloc_metrics_are_emitted' panicked at apollo-router/tests/integration/../common.rs:988:9:
'apollo_router_jemalloc_active' not detected in metrics
# HELP apollo_router_cache_miss_time Time to check the cache for an uncached value in seconds

So, it looks like there's an issue with the creation of the metric.

Gary Pennington and others added 3 commits June 27, 2025 09:07
Sorry Zelda. I misled you. You have to create the gauge outside of the
layer and then reference the gauge from the layer.

With these small changes, things are working.
We can't build on windows with jemalloc-ctl as a dependency.

So, let's try to only have these dependencies on linux.
@garypen garypen self-requested a review June 27, 2025 13:46
@Velfi Velfi merged commit f7aaada into dev Jun 27, 2025
14 of 15 checks passed
@Velfi Velfi deleted the zelda-jemalloc-metrics branch June 27, 2025 13:47
@abernix abernix mentioned this pull request Jul 28, 2025
@BrynCooke
Copy link
Contributor

@mergify.io backport 1.x

@BrynCooke BrynCooke added the backport-1.x Backport this PR to 1.x label Aug 1, 2025
@BrynCooke BrynCooke mentioned this pull request Aug 1, 2025
10 tasks
BrynCooke added a commit that referenced this pull request Aug 1, 2025
Co-authored-by: Zelda Hessler <zelda.hessler@apollographql.com>
@abernix abernix mentioned this pull request Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-1.x Backport this PR to 1.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants