fix: drop tenant id from metrics to reduce allocations#1121
Merged
Conversation
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes tenantId from OpenTelemetry metric attributes (and removes the now-unneeded attribute-stripping wrapper) to reduce allocations and avoid high-cardinality labels.
Changes:
- Stop including
tenantIdin uploader, HTTP, and DB query performance metric attributes. - Simplify metric registration by removing the tenant-attribute stripping wrapper and the related config/env wiring.
- Add/extend tests to assert metric attribute sets no longer include tenant id labels.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/uploader.test.ts | Adds coverage ensuring uploader metrics don’t include tenantId attributes. |
| src/storage/uploader.ts | Drops tenantId from upload_started / upload_success metric attributes. |
| src/storage/database/knex.ts | Drops tenantId from DB query performance metric attributes. |
| src/storage/database/knex.test.ts | Adds coverage ensuring DB query performance metrics don’t include tenantId. |
| src/internal/monitoring/otel-metrics.ts | Removes outdated comment referencing tenant attribute stripping. |
| src/internal/monitoring/metrics.ts | Removes tenant-attribute stripping wrapper logic from registerMetric. |
| src/http/plugins/metrics.ts | Drops tenantId from HTTP metric attributes. |
| src/http/plugins/metrics.test.ts | Adds coverage ensuring HTTP metrics don’t include tenantId. |
| src/config.ts | Removes prometheusMetricsIncludeTenantId config option/env wiring. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage Report for CI Build 26215609794Coverage decreased (-0.02%) to 74.98%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions3 previously-covered lines in 1 file lost coverage.
Coverage Stats💛 - Coveralls |
fenos
approved these changes
May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
Tenant id is added into metrics then stripped because of cardinality. However, it does allocations for ignored work.
What is the new behavior?
Don't pass it at all and drop stripping utility.