Skip to content

feat(otel): Add OpenTelemetry distributed tracing support - #1769

Merged
jbonofre merged 5 commits into
apache:mainfrom
jbonofre:add-opentelemetry-support
Oct 19, 2026
Merged

jbonofre merged 5 commits into
apache:mainfrom
jbonofre:add-opentelemetry-support

Conversation

@jbonofre

Copy link
Copy Markdown
Member

New activemq-opentelemetry module that instruments the broker using the OpenTelemetry API. The plugin traces send (PRODUCER), dispatch (CONSUMER), and acknowledge (INTERNAL) operations with W3C TraceContext propagation and standard OTel messaging semantic conventions.

Depends on opentelemetry-api only; users bring their own SDK and exporter at runtime. Included in the distribution with example configuration. Maybe we should add a default SDK/exporter in the ActiveMQ distribution, just wondering 😄

@jbonofre
jbonofre requested a review from jeanouii March 13, 2026 16:34
@jbonofre jbonofre linked an issue Mar 13, 2026 that may be closed by this pull request
@jbonofre jbonofre changed the title Add OpenTelemetry distributed tracing support feat(otel): Add OpenTelemetry distributed tracing support Mar 13, 2026
@jbonofre
jbonofre force-pushed the add-opentelemetry-support branch from 0e1e69d to 176f5f5 Compare March 26, 2026 05:08

@jeanouii jeanouii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great PR and a good start.
I've added a couple of notes and questions.

It's been a while since I worked with this.

@jbonofre
jbonofre force-pushed the add-opentelemetry-support branch from 176f5f5 to b55e0a6 Compare July 9, 2026 15:16
@jbonofre
jbonofre requested a review from jeanouii July 9, 2026 15:18
@jbonofre
jbonofre force-pushed the add-opentelemetry-support branch from b55e0a6 to 225e05a Compare July 16, 2026 12:06
@jbonofre
jbonofre requested a review from cshannon July 16, 2026 12:06
@jbonofre

Copy link
Copy Markdown
Member Author

@cshannon wdyt about this one for 6.3.0?

@cshannon

Copy link
Copy Markdown
Contributor

@cshannon wdyt about this one for 6.3.0?

I haven't looked at this at all and this definitely needs to wait. Did

@cshannon wdyt about this one for 6.3.0?

I think 6.4.0 makes more sense, I don't think anyone else has paid attention to this (I know I haven't) and adding a major new framework like this is a pretty big deal, even if it's off by default. I think it would be good to have some more time.

@jbonofre

Copy link
Copy Markdown
Member Author

6.4.0 is good idea.

@github-actions github-actions Bot added the Stale label Sep 20, 2026
@jbonofre jbonofre removed the Stale label Sep 20, 2026
@apache apache deleted a comment from github-actions Bot Sep 20, 2026
@jbonofre
jbonofre force-pushed the add-opentelemetry-support branch 2 times, most recently from ef8c660 to a890f90 Compare September 29, 2026 09:57
@jbonofre
jbonofre force-pushed the add-opentelemetry-support branch from 2ca3a64 to f68470e Compare October 15, 2026 12:32
@jbonofre

Copy link
Copy Markdown
Member Author

@mattrpav @cshannon I updated this PR with improvements and fixes. I think it's good to go, if possible in 6.4.0.

@cshannon cshannon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, it's a new plugin and off by default so it's good to get it into 6.4.0 for people to try it out. It could be expanded in future releases to add more tracing in other broker methods or fix any bugs that show up.

@mattrpav

Copy link
Copy Markdown
Contributor

The build failure due to my bad JMX SSL merge, which is now fixed and merged. A rebase of the PR, or a Rebase+Merge should fix it.

jbonofre and others added 5 commits October 15, 2026 16:38
New activemq-opentelemetry module that instruments the broker using the
OpenTelemetry API. The plugin traces send (PRODUCER), dispatch (CONSUMER),
and acknowledge (INTERNAL) operations with W3C TraceContext propagation
and standard OTel messaging semantic conventions.

Depends on opentelemetry-api only; users bring their own SDK and exporter
at runtime. Included in the distribution with example configuration.
- Fix OTel semantic convention attribute names:
  messaging.system -> messaging.system.name
  messaging.operation -> messaging.operation.type
  messaging.client_id -> messaging.client.id (dot notation)
- Initialize propagator and tracer once in constructor instead of per-invocation
- Bound dispatchSpans map to prevent unbounded growth / span leaks;
  oldest span is ended and evicted when the limit is exceeded
- Add comment explaining setMarshalledProperties(null) in TextMapSetter
- Replace Thread.sleep() in tests with Wait.waitFor() pattern
- Document topic fan-out span behavior in class Javadoc
…PSHOT)

The module's parent POM referenced activemq-parent:6.3.0-SNAPSHOT, which
no longer exists since the root pom.xml was bumped to 6.4.0-SNAPSHOT,
breaking CI reactor resolution.
…fix example config

- Wire activemq-opentelemetry into activemq-spring (optional dependency and maven-xbean-plugin includes) so that openTelemetryPlugin is generated in activemq.xsd and recognized by XBean Spring
- Remove unnecessary jetty.xml import and ws transport connector from activemq-opentelemetry.xml to pass XML validation and standalone broker start tests
…onstants, semconv fixes

- Add messagingSystem property (default 'activemq')
- Use AttributeKey constants for attribute keys and constants for values
- Use messaging.system and the 'settle' operation type per semantic conventions
- Resolve OpenTelemetry lazily and allow explicit injection via setOpenTelemetry
- Log trace context read failures; null-safe span error status
- Document deliver/ack span semantics and dispatch span cap
@jbonofre
jbonofre force-pushed the add-opentelemetry-support branch from ef89585 to d854170 Compare October 15, 2026 14:39

@mattrpav mattrpav left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@jbonofre
jbonofre merged commit 7d05f6f into apache:main Oct 19, 2026
18 of 20 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in Apache ActiveMQ v6.4.0 Oct 19, 2026
@jbonofre
jbonofre deleted the add-opentelemetry-support branch October 19, 2026 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add OpenTelemetry plugin

4 participants