Skip to content

Add OpenTelemetry v2 plugin - #3089

Open
patbeqo wants to merge 1 commit into
patbeqo/otel-v2-workflow-prerequisites-2from
patbeqo/otel-v2
Open

patbeqo wants to merge 1 commit into
patbeqo/otel-v2-workflow-prerequisites-2from
patbeqo/otel-v2

Conversation

@patbeqo

@patbeqo patbeqo commented Sep 17, 2026

Copy link
Copy Markdown

What changed?

  • Added the experimental temporal-opentelemetry-v2 contrib module and registered it in settings.gradle and the BOM.
  • OpenTelemetryPlugin installs tracing interceptors on the workflow, schedule, activity, and Nexus clients plus the worker through the SimplePlugin builder helpers. Its builder exposes setHeaderKey (defaults to _tracer-data) and setAddTemporalSpans (defaults to false, so only context propagation happens unless enabled).
  • ReplaySafeOpenTelemetry is the OpenTelemetry to register with GlobalOpenTelemetry.set. Its tracer provider wraps spans so they are no-ops during replay and in read-only workflow contexts, and its id generator draws span and trace ids from named workflow random streams so ids are stable across replay. Propagators default to W3C trace context plus baggage and are configurable via setPropagators. OpenTelemetryPlugin.Builder.build() rejects a global that is not a ReplaySafeOpenTelemetry.
  • InterceptorTracer serializes the current context into Temporal headers with the global propagator and, when enabled, creates spans for Temporal operations (StartWorkflow, RunWorkflow, RunActivity, HandleSignal, HandleUpdate, RunStartNexusOperationHandler, and so on). It rethrows the Continue-As-New unwind without recording an error.

Why?

Part of #3046. This is the third slice, stacked on #3049 and #3082, which supplied the named random streams, read-only detection, and client plugin hooks the module depends on.

Breaking changes?

None. The module is new and marked experimental.

Server PR

None.

Test plan

Added tests covering all client, worker, and workflow paths the plugin instruments, with and without Temporal spans enabled.

  • mise exec -- ./gradlew :temporal-opentelemetry-v2:test -PtestServer=dev-server -x spotlessCheck -x spotlessJava (13 tests; the Reset and comprehensive tests require the dev server and are gated with assumeTrue)
  • mise exec -- ./gradlew :temporal-opentelemetry-v2:spotlessCheck
  • mise exec -- ./gradlew :temporal-opentelemetry-v2:javadoc

@patbeqo
patbeqo added this pull request to stack #3083 September 17, 2026 21:16
@patbeqo

patbeqo commented Sep 17, 2026

Copy link
Copy Markdown
Author

@codex

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-18T22:59:41.597125Z d4a61fb Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eef033e5ee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -0,0 +1,26 @@
description = '''Temporal Java SDK OpenTelemetry v2 Module'''

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Document how to install and configure the new module

This introduces a separately published, user-facing artifact without a README or usage guide, unlike the existing OpenTelemetry module. In particular, users are not shown the dependency declaration, how to construct and register ReplaySafeOpenTelemetry, how to attach the plugin, or how provider ownership and shutdown work, leaving the new module difficult to adopt safely.

AGENTS.md reference: AGENTS.md:L53-L57

Useful? React with 👍 / 👎.

@patbeqo patbeqo Sep 17, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

A follow up PR on this stack will include the README.

@patbeqo

patbeqo commented Sep 18, 2026

Copy link
Copy Markdown
Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b7d52f9ab1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@patbeqo

patbeqo commented Sep 18, 2026

Copy link
Copy Markdown
Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0f239f732c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread contrib/temporal-opentelemetry-v2/build.gradle
@patbeqo

patbeqo commented Sep 18, 2026

Copy link
Copy Markdown
Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 14423f6442

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@patbeqo

patbeqo commented Sep 18, 2026

Copy link
Copy Markdown
Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 73678eb01d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@patbeqo

patbeqo commented Sep 18, 2026

Copy link
Copy Markdown
Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 632635bb43

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@patbeqo
patbeqo force-pushed the patbeqo/otel-v2 branch 2 times, most recently from c5b05aa to de76218 Compare September 18, 2026 19:37
@patbeqo

patbeqo commented Sep 18, 2026

Copy link
Copy Markdown
Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d3aa415401

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@patbeqo
patbeqo force-pushed the patbeqo/otel-v2 branch 2 times, most recently from b906ec6 to 9d77af7 Compare September 18, 2026 21:10
@patbeqo
patbeqo marked this pull request as ready for review September 18, 2026 22:51
@patbeqo
patbeqo requested a review from a team as a code owner September 18, 2026 22:51
@patbeqo
patbeqo requested a review from a team September 18, 2026 22:51

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d4a61fb775

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

1 participant