Repository navigation
Conversation
… and an overflow is warned about The OpenTelemetry SDK keeps at most 2,000 attribute sets per instrument and counts what is recorded with a further one in a single otel.metric.overflow=true series, without repository or status, and logs nothing. http.client.request.duration and forge.proxy.lookups reached that with a few dozen to about a hundred proxies, so alerts and panels by forge_repository missed what overflowed. With telemetry.per_repository on, a view now gives every instrument that carries forge.repository a cardinality limit sized for 1,000 repositories (forge_telemetry::PER_REPOSITORY_INSTRUMENTS holds the sets one repository gives each; never below the SDK's default). The limits are fixed when the instruments are built, before the database is connected, so they follow a budget, not the repositories there are. The metric exporter is wrapped: an export that holds the overflow series logs a warning, once per instrument, with the limit and what to do. The deployment guide names the threshold. Fixes #580 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012e6DJZQLYNg6tPPU1395q8
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Nov 17, 2026
…provider's views Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012e6DJZQLYNg6tPPU1395q8
This branch has not been deployed
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.
Fixes #580
The OpenTelemetry SDK keeps at most 2,000 attribute sets per instrument; past that, new ones land in one
otel.metric.overflow=trueseries without repository or status, and nothing is logged.http.client.request.durationandforge.proxy.lookupsreached it with a few dozen to about a hundred proxies, so alerts and panels byforge_repositorymissed what overflowed.What changes
telemetry.per_repositoryon, a view gives every instrument that carriesforge.repositoryacardinality_limitof (sets one repository gives it) × 1,000 repositories, never below the SDK's 2,000: 32,000 forhttp.client.request.duration, 18,000 forforge.proxy.lookups, 3,000 forforge.proxy.upstream.documents; the retention and inventory instruments stay at 2,000. The sets per repository are a table beside the instruments (forge_telemetry::PER_REPOSITORY_INSTRUMENTS), and the existing attribute test fails when an instrument withforge.repositoryis missing from it. The view sets the limit alone: name, unit, description and histogram buckets stay the instrument's.per_repositoryoff). It covers every instrument, not only the per-repository ones.docs/deployment.md(Telemetry) names the threshold, 1,000 repositories, shows the warning and says when to turntelemetry.per_repositoryoff;forge.toml.exampleand the config's doc comment say the same.How the limit follows the repositories
A fixed budget, not the live count. The limit is fixed when an instrument is built, and
mainbuilds the instruments before it connects the database, so the count is not known then; repositories are also created while Forge runs, and a limit cannot be changed afterwards. 1,000 is far more than the "about a hundred" of the issue. The cost is memory the SDK allocates up front (HashMap::with_capacity(1 + limit)): by my arithmetic about 3 MB for the three raised instruments (not measured).http.client.request.durationassumes at most 32 method × status combinations per proxy (the issue says 20–30); an upstream that answers with more reaches the limit earlier, and the warning says so.Checked against
opentelemetry_sdk0.33.1 (the version inCargo.lock), in its source:Stream::builder().with_cardinality_limit(n)andMeterProviderBuilder::with_vieware stable API there (nospec_unstable_metrics_viewsfeature needed), a view without an aggregation keeps the instrument'swith_boundaries, the limit applies to observable instruments too, and the overflow path logs nothing.Verification
cargo test -p forge-server --test telemetry_cardinality(new, no Docker): 3,000 attribute sets onhttp.client.request.durationthrough Forge's own instruments are all exported with their repository, with the instrument's buckets;forge.proxy.upstream.documentsat exactly its limit warns of nothing, one repository more gives the overflow series and exactly one warning, not repeated on the next export. With the view switched off locally, both tests fail (2,001 points instead of 3,000).cargo test -p forge-telemetry;cargo test -p forge-server --lib --test telemetry --test otlp_export(Postgres and versitygw in Docker, throughmirror.gcr.io): all pass.cargo xtask check(fmt, clippy-D warnings),cargo xtask unused,cargo xtask doc-check,cargo xtask changelog --check: all pass.Not run locally: the rest of the workspace's suites (
cargo xtask test,cargo xtask e2e), left to CI. Not verified: the warning against a real Collector and backend, and the memory figure above.No web UI screen: the change adds no admin API.
Generated by Claude Code