Skip to content

fix: drop tenant id from metrics to reduce allocations#1121

Merged
fenos merged 1 commit into
masterfrom
ferhat/tenant-id
May 21, 2026
Merged

fix: drop tenant id from metrics to reduce allocations#1121
fenos merged 1 commit into
masterfrom
ferhat/tenant-id

Conversation

@ferhatelmas
Copy link
Copy Markdown
Member

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.

Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
@ferhatelmas ferhatelmas requested a review from a team as a code owner May 21, 2026 08:47
Copilot AI review requested due to automatic review settings May 21, 2026 08:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 tenantId in 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.

@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 26215609794

Coverage decreased (-0.02%) to 74.98%

Details

  • Coverage decreased (-0.02%) from the base build.
  • Patch coverage: 1 of 1 lines across 1 file are fully covered (100%).
  • 3 coverage regressions across 1 file.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

3 previously-covered lines in 1 file lost coverage.

File Lines Losing Coverage Coverage
src/storage/protocols/tus/s3-locker.ts 3 78.37%

Coverage Stats

Coverage Status
Relevant Lines: 10359
Covered Lines: 8178
Line Coverage: 78.95%
Relevant Branches: 5992
Covered Branches: 4082
Branch Coverage: 68.12%
Branches in Coverage %: Yes
Coverage Strength: 369.33 hits per line

💛 - Coveralls

@fenos fenos merged commit d87675c into master May 21, 2026
25 checks passed
@fenos fenos deleted the ferhat/tenant-id branch May 21, 2026 08:53
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.

4 participants