Skip to content

feat: Set service version on OTel data#124

Open
morgan-wowk wants to merge 1 commit intoorganize-opentelemetryfrom
otel-service-version
Open

feat: Set service version on OTel data#124
morgan-wowk wants to merge 1 commit intoorganize-opentelemetryfrom
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

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@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
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.

2 participants