Skip to content

feat: Set service version on OTel data#124

Merged
morgan-wowk merged 1 commit intomasterfrom
otel-service-version
Mar 5, 2026
Merged

feat: Set service version on OTel data#124
morgan-wowk merged 1 commit intomasterfrom
otel-service-version

Conversation

@morgan-wowk
Copy link
Collaborator

@morgan-wowk morgan-wowk commented Feb 25, 2026

TL;DR

Added service version support to OpenTelemetry configuration and tracing setup.

What changed?

  • Added service_version field to OtelConfig dataclass
  • Extended resolve() function to accept optional service_version parameter with fallback to TANGLE_SERVICE_VERSION environment variable (defaults to "unknown")
  • Updated setup() functions in both providers.py and tracing.py to accept and pass through service_version parameter
  • Modified tracing setup to include service.version attribute in OpenTelemetry resource when provided
  • Added comprehensive test coverage for service version functionality including custom values, environment variable usage, and default behavior

How to test?

  1. Set TANGLE_SERVICE_VERSION environment variable and verify it's picked up by the configuration
  2. Pass a custom service_version parameter to providers.setup() and confirm it overrides the environment variable
  3. Check that the service.version attribute appears in OpenTelemetry traces when configured (requires OTel collector stack)
  4. Verify that when no service version is provided, it defaults to "unknown" and the attribute is omitted from traces when explicitly set to None

Why make this change?

This enables better observability by allowing services to report their version information (such as git commit hashes or release versions) to OpenTelemetry collectors, making it easier to correlate traces with specific deployments and track issues across different service versions.

Copy link
Collaborator Author

morgan-wowk commented Feb 25, 2026

@morgan-wowk morgan-wowk self-assigned this Feb 25, 2026
@morgan-wowk morgan-wowk changed the title feat: Set service version on open telemetry data feat: Set service version on OTel data Feb 25, 2026
@morgan-wowk morgan-wowk force-pushed the organize-opentelemetry branch from 7672232 to 0d953d1 Compare February 25, 2026 13:01
@morgan-wowk morgan-wowk marked this pull request as ready for review February 25, 2026 19:53
@morgan-wowk morgan-wowk requested a review from Ark-kun as a code owner February 25, 2026 19:53
yuechao-qin
yuechao-qin previously approved these changes Feb 25, 2026
@morgan-wowk morgan-wowk force-pushed the organize-opentelemetry branch from 0d953d1 to f2c09c1 Compare February 26, 2026 00:56
@morgan-wowk morgan-wowk force-pushed the otel-service-version branch from 3a803bb to b638a9b Compare March 5, 2026 00:24
@morgan-wowk morgan-wowk force-pushed the organize-opentelemetry branch from f2c09c1 to 767ac8c Compare March 5, 2026 00:24
@morgan-wowk morgan-wowk force-pushed the otel-service-version branch from b638a9b to 7290c18 Compare March 5, 2026 00:40
@morgan-wowk morgan-wowk force-pushed the organize-opentelemetry branch from 767ac8c to 7251a89 Compare March 5, 2026 00:40
Ark-kun
Ark-kun previously approved these changes Mar 5, 2026
Copy link
Collaborator Author

morgan-wowk commented Mar 5, 2026

Merge activity

  • Mar 5, 9:25 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 5, 9:26 PM UTC: Graphite rebased this pull request as part of a merge.
  • Mar 5, 9:27 PM UTC: Graphite couldn't merge this PR because it was not satisfying all requirements (PR does not have required approvals).
  • Mar 5, 9:43 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 5, 9:43 PM UTC: @morgan-wowk merged this pull request with Graphite.

@morgan-wowk morgan-wowk changed the base branch from organize-opentelemetry to graphite-base/124 March 5, 2026 21:25
@morgan-wowk morgan-wowk changed the base branch from graphite-base/124 to master March 5, 2026 21:26
@morgan-wowk morgan-wowk dismissed stale reviews from Ark-kun and yuechao-qin March 5, 2026 21:26

The base branch was changed.

@morgan-wowk morgan-wowk force-pushed the otel-service-version branch from 7290c18 to 9f2fb12 Compare March 5, 2026 21:26
@morgan-wowk morgan-wowk merged commit f2f558d into master Mar 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants