Skip to content

chore!: Refactor OTel exporters to be signal-specific#125

Merged
morgan-wowk merged 1 commit intomasterfrom
signal-specific-exporters
Mar 5, 2026
Merged

chore!: Refactor OTel exporters to be signal-specific#125
morgan-wowk merged 1 commit intomasterfrom
signal-specific-exporters

Conversation

@morgan-wowk
Copy link
Collaborator

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

Refactor OpenTelemetry configuration to support signal-specific exporters

This refactors the OpenTelemetry configuration system to support separate exporter configurations for different telemetry signals (traces, metrics, logs).

Changes

  • Split OtelConfig into separate ExporterConfig and OtelConfig classes
  • Moved exporter-specific fields (endpoint, protocol) to ExporterConfig
  • Added trace_exporter field to OtelConfig for trace-specific configuration
  • Updated environment variable names from generic TANGLE_OTEL_EXPORTER_* to signal-specific TANGLE_OTEL_TRACE_EXPORTER_*
  • Extracted _resolve_exporter() helper function for reusable exporter configuration logic
  • Modified providers.setup() to only configure tracing when trace exporter is present
  • Updated all tests to use the new environment variable names and configuration structure

This allows users to configure different exporters for traces vs metrics by setting signal-specific environment variables.

Copy link
Collaborator Author

morgan-wowk commented Feb 25, 2026

@morgan-wowk morgan-wowk force-pushed the signal-specific-exporters branch from cd03357 to a9c66b9 Compare February 26, 2026 00:56
)

if trace_exporter is None:
return None

if service_name is None:
app_env = os.environ.get("TANGLE_ENV", "unknown")
service_name = f"tangle-{app_env}"

if service_version is None:
service_version = os.environ.get("TANGLE_SERVICE_VERSION", "unknown")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we have this env set today? what the versioning strategy do we use?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Technically, it's up to the OSS user of Tangle (someone who clones and deploys Tangle themselves).

They can use their commit shas, semantic versioning, whatever they feel is right. For our case, we use a revision (commit sha) provided by our CD platform.

As for recommendations, we could add some to our documentation of this variable which is upstack. Suitable values would be build ids, URLs, or commit shas.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

PS: I'm not fully happy with the docs yet even after this full stack as it is now. I'd love to collaborate and hear ideas on how in-depth we want to go on docs and where our source of truth should be for metric information.

)

if trace_exporter is None:
return None

if service_name is None:
app_env = os.environ.get("TANGLE_ENV", "unknown")
Copy link
Collaborator

Choose a reason for hiding this comment

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

What are possible values for TANGLE_ENV? Where it is being set?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We improve the documentation for this upstack but happy to answer here:

This is used as part of the service name for your OTel exports. This is literally your env, so development, staging, etc.

Alexey and I landed on this name for it in an earlier merged PR.

@morgan-wowk morgan-wowk force-pushed the signal-specific-exporters branch from a9c66b9 to 4c46bd2 Compare March 5, 2026 00:24
@morgan-wowk morgan-wowk force-pushed the otel-service-version branch 2 times, most recently from b638a9b to 7290c18 Compare March 5, 2026 00:40
@morgan-wowk morgan-wowk force-pushed the signal-specific-exporters branch from 4c46bd2 to 6921879 Compare March 5, 2026 00:40
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:27 PM UTC: Graphite couldn't merge this pull request because a downstack PR feat: Set service version on OTel data #124 failed to merge.
  • Mar 5, 9:43 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 5, 9:44 PM UTC: Graphite rebased this pull request as part of a merge.
  • Mar 5, 9:45 PM UTC: @morgan-wowk merged this pull request with Graphite.

@morgan-wowk morgan-wowk changed the base branch from otel-service-version to graphite-base/125 March 5, 2026 21:26
@morgan-wowk morgan-wowk changed the base branch from graphite-base/125 to master March 5, 2026 21:44
This allows users to set different exporters for traces vs metrics

Made-with: Cursor
@morgan-wowk morgan-wowk force-pushed the signal-specific-exporters branch from 6921879 to 9ae210f Compare March 5, 2026 21:44
@morgan-wowk morgan-wowk merged commit 0552171 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.

4 participants