Skip to content

Conversation

@chris-olszewski
Copy link
Member

What was changed

Add OTEL spans for all interceptors provided by the interface.

Why?

As discovered in #1677 these can end up causing NDE errors if replaying an old history without these interceptors. Adding these all at once makes gating their usage far easier.

Checklist

  1. Closes [Feature Request] Add missing hooks on OTel interceptors #1678

  2. How was this tested:

  • Existing replay tests
  • Added a replay test of smorgasbord history from 1.13.2
  • Updated span test to check for new spans added
  • Added additional test to verify update with start behavior stays intact when used with OTEL interceptors
  1. Any docs updates needed?
    Doc comments should suffice

@chris-olszewski chris-olszewski force-pushed the olszewski/feat_implement_all_otel_interceptors branch from dd68680 to b9e320c Compare November 21, 2025 19:52
@chris-olszewski chris-olszewski marked this pull request as ready for review November 24, 2025 14:15
@chris-olszewski chris-olszewski requested a review from a team as a code owner November 24, 2025 14:15
@chris-olszewski chris-olszewski marked this pull request as draft November 26, 2025 21:10
/** Default trace header for opentelemetry interceptors */
export const TRACE_HEADER = '_tracer-data';
/** As in workflow run id */
export const RUN_ID_ATTR_KEY = 'run_id';
Copy link
Member Author

Choose a reason for hiding this comment

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

Ruby OTEL uses temporalRunId

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh? Have you compared with other SDKs, beside Ruby? We'd ideally want cross-SDKs compatibility of OTel tracing, as a customer could be operating different languages within a single Temporal application.

Not saying we'll prioritize, of course, but at the very least we should settle on what names we want to normalize to across the board, so that we eventually converge to something consistent.

Copy link
Member Author

Choose a reason for hiding this comment

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

  • Java: runId
  • Python temporalRunId
  • Go: Doesn't have these
  • PHP: N/A
  • .NET: temporalRunId

Copy link
Member Author

Choose a reason for hiding this comment

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

I kept run_id as I wasn't sure if moving to temporalRunId could be considered a breaking change. I could see the case that users have dashboard/queries using run_id that would break if we changed this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair. We may however consider changing these while transitioning to OTel 2. I would mind being breaking at that point.

});

// Skipped as we only care that it compiles
test.skip('otel interceptors are complete', async (t) => {
Copy link
Member Author

@chris-olszewski chris-olszewski Dec 2, 2025

Choose a reason for hiding this comment

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

I built and checked at the docs and we end up leaking the Required type. Switched to a compile time check that these types satisfy the narrower type, but we only expose implementing the wider interface to users.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good thinking.

Copy link
Contributor

@mjameswh mjameswh left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Add missing hooks on OTel interceptors

3 participants