Skip to content

chore(components): specify custom span nesting in opentelemetry#23120

Merged
squakez merged 1 commit into
apache:mainfrom
squakez:chore/otel_nested_beans
May 12, 2026
Merged

chore(components): specify custom span nesting in opentelemetry#23120
squakez merged 1 commit into
apache:mainfrom
squakez:chore/otel_nested_beans

Conversation

@squakez
Copy link
Copy Markdown
Contributor

@squakez squakez commented May 11, 2026

As we have moved the scope only for Processors, any call to the endpoint, which generates an event is not providing the scope. This is needed by custom span to nest the execution under the specific processor. Added some test and documentation to clarify this architecture constraint.

Description

Target

  • I checked that the commit is targeting the correct branch (Camel 4 uses the main branch)

Tracking

  • If this is a large change, bug fix, or code improvement, I checked there is a JIRA issue filed for the change (usually before you start working on it).

Apache Camel coding standards and style

  • I checked that each commit in the pull request has a meaningful subject line and body.
  • I have run mvn clean install -DskipTests locally from root folder and I have committed all auto-generated changes.

@squakez
Copy link
Copy Markdown
Contributor Author

squakez commented May 11, 2026

@davsclaus @oscerd I need you to please have a look at this one. Please, advise if the documentation explaining the design constraint is wrong or should be reworded.

Also, I wonder if this analysis is overlooking something. I understand that when we configure, for example, a bean to be called as an endpoint, then, the execution "converts" it as an event. Is there any possibility to have it as a regular processor and make the otel component to intercept it in the "InterceptStrategy" instead?

Thanks!

@github-actions
Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 11, 2026

🧪 CI tested the following changed modules:

  • components/camel-opentelemetry2
  • components/camel-telemetry
All tested modules (12 modules)
  • Camel :: Common Telemetry
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: Launcher :: Container
  • Camel :: Micrometer :: Observability 2
  • Camel :: Observability Services
  • Camel :: Opentelemetry 2
  • Camel :: Telemetry :: Dev
  • Camel :: YAML DSL :: Validator
  • Camel :: YAML DSL :: Validator Maven Plugin

⚙️ View full build and test results

Copy link
Copy Markdown
Contributor

@oscerd oscerd left a comment

Choose a reason for hiding this comment

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

It looks ok to me and it doesn't need to be reworded.

Copy link
Copy Markdown
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

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

Thanks for documenting this architectural constraint, @squakez — this is a genuinely useful addition that will save users from confusing debugging sessions when custom spans don't nest where expected.

A couple of items to address:

Required:

  1. Remove System.out.println debug output in the otel2 test
  2. Add missing beanTo.hasEnded() assertion in the otel2 test

Suggestions (non-blocking):
3. The telemetry test route has an extra .process(...) step not present in the otel2 test — consider aligning for easier cross-module comparison
4. The two tests assert different parent hierarchies for beanMethod — a clarifying comment in the telemetry test would help future readers

See inline comments for details.

Note: this is a project-conventions review and does not replace specialized tools like CodeRabbit, Sourcery, or SonarCloud.

Claude Code on behalf of Guillaume Nodet

As we have moved the scope only for Processors, any call to the endpoint, which generates an event is not providing the scope.
This is needed by custom span to nest the execution under the specific processor.
Added some test and documentation to clarify this architecture constraint.
@squakez squakez force-pushed the chore/otel_nested_beans branch from 374ca52 to 2c98d23 Compare May 12, 2026 07:39
@squakez squakez requested a review from gnodet May 12, 2026 07:39
Copy link
Copy Markdown
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

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

All feedback addressed — thanks for the quick turnaround, @squakez!

  • System.out.println removed ✓
  • Missing beanTo.hasEnded() assertion added ✓
  • Routes aligned across modules ✓

LGTM.

Claude Code on behalf of Guillaume Nodet

@squakez squakez merged commit 4db6ef7 into apache:main May 12, 2026
7 checks passed
@squakez squakez deleted the chore/otel_nested_beans branch May 12, 2026 13:10
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