Add opentelemetry metrics support - #14700
Merged
Merged
Conversation
opentelemetryopentelemetry metrics support
Turbo87
force-pushed
the
add-otel-metrics
branch
from
September 18, 2026 07:02
fa81a5b to
a28dfd5
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Turbo87
force-pushed
the
add-otel-metrics
branch
from
September 18, 2026 07:09
a28dfd5 to
9c6a0df
Compare
This comment has been minimized.
This comment has been minimized.
Turbo87
force-pushed
the
add-otel-metrics
branch
from
September 18, 2026 07:14
9c6a0df to
5a06e40
Compare
This comment has been minimized.
This comment has been minimized.
Select OTLP metrics export when either standard endpoint variable is present. Build the provider with deployment and Heroku resource attributes, and fall back to a no-op provider when export initialization fails.
Create the server meter at startup and retain its provider for the process lifetime. Track each request with the OpenTelemetry HTTP method and scheme attributes, and inject no-op meters into the general test harness.
Do not construct or inject the legacy Datadog client when OTLP is selected. Skip the service metrics task with an OTLP-specific message so initialization failures do not silently reactivate direct submission.
Introduce `SharedMetrics` and observe idle and used connection counts for each configured server pool. Primary and replica callbacks use pool-name and connection-state attributes so the SDK merges them into one metric stream.
Record the unavailable preferred pool whenever either read path falls back to its alternative. The OpenTelemetry counter runs alongside the existing Prometheus metric during expansion.
Turbo87
force-pushed
the
add-otel-metrics
branch
from
September 18, 2026 07:41
5a06e40 to
f06ae27
Compare
Collaborator
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Load crate, version, and queued-job counts into a complete snapshot before recording Prometheus gauges. The private endpoint and direct Datadog submission continue to use the same metric families without publishing partial query results.
The background worker retains its meter provider and records crate and version counts from complete service snapshots through `WorkerMetrics`. Collection continues when legacy direct Datadog submission is disabled, while configured submissions reuse the same snapshot.
Worker metrics share the database-pool observable instruments used by the server. Worker startup registers its pool with the `worker` name, and integration coverage verifies all three pool names.
The serial service-metrics task retains previously observed queue labels and adds zero-valued entries when a queue disappears. Worker metrics record the completed snapshot through the existing priority and job attributes while legacy output continues to use the same values.
Successful tar.gz and zip uploads now record archive size and upload duration through WorkerMetrics with the existing format attribute. The legacy direct Datadog submission remains active when configured during the migration.
Turbo87
force-pushed
the
add-otel-metrics
branch
from
September 18, 2026 08:46
f06ae27 to
93d345f
Compare
Member
Author
|
I'm gonna try this out on staging. The code is essentially disabled unless the relevant env vars are set, so even if this gets deployed to production it shouldn't have an immediate impact. |
Member
Author
|
staging test was successful. everything appears to be working as intended. |
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.
This PR adds
opentelemetrymetrics support to the application.It can be enabled by setting the
OTEL_EXPORTER_OTLP_ENDPOINTenvironment variable and all of the other necessary environment variables read by theopentelemetrycrate family.The implementation is intentionally not coupled to Datadog and can easily be configure to point to a different OTLP server. Note that once
OTEL_EXPORTER_OTLP_ENDPOINTis enabled, the custom Datadog metrics exporter is disabled to avoid conflicting reports.Related
opentelemetry#14699