-
Notifications
You must be signed in to change notification settings - Fork 873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create producer span from spring integration instrumentation #4932
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
laurit
requested review from
anuraaga,
iNikem,
jkwatson,
mateuszrzeszutek,
pavolloffay,
trask and
tylerbenson
as code owners
December 17, 2021 09:43
mateuszrzeszutek
approved these changes
Jan 4, 2022
...main/java/io/opentelemetry/instrumentation/spring/integration/TracingChannelInterceptor.java
Outdated
Show resolved
Hide resolved
...main/java/io/opentelemetry/instrumentation/spring/integration/TracingChannelInterceptor.java
Show resolved
Hide resolved
...main/java/io/opentelemetry/instrumentation/spring/integration/TracingChannelInterceptor.java
Show resolved
Hide resolved
…/java/io/opentelemetry/instrumentation/spring/integration/TracingChannelInterceptor.java Co-authored-by: Mateusz Rzeszutek <[email protected]>
laurit
force-pushed
the
spring-integration-producer
branch
from
January 4, 2022 14:53
57c56f7
to
b540e29
Compare
mateuszrzeszutek
approved these changes
Jan 5, 2022
instrumentation/spring/README.md
Outdated
@@ -17,8 +17,9 @@ In this guide we will be using a running example. In section one and two, we wil | |||
| System property | Type | Default | Description | | |||
|---|---|---|---| | |||
| `otel.instrumentation.spring-integration.global-channel-interceptor-patterns` | List | `*` | An array of Spring channel name patterns that will be intercepted. See [Spring Integration docs](https://docs.spring.io/spring-integration/reference/html/channel.html#global-channel-configuration-interceptors) for more details. | | |||
| `otel.instrumentation.spring-integration.producer.enabled` | Boolean | `false` | Create producer span in spring integration instrumentation when message is written into an output channel. Detecting output channels works only for [Spring Cloud Stream](https://spring.io/projects/spring-cloud-stream) `DirectWithAttributesChannel`. Use this flag only when you are using a messaging library that does not have instrumentation to create producer spans. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CC @theletterf
theletterf
reviewed
Jan 5, 2022
Co-authored-by: Fabrizio Ferri-Benedetti <[email protected]>
trask
approved these changes
Jan 5, 2022
Comment on lines
+54
to
+56
jvmArgs("-Dotel.instrumentation.rabbitmq.enabled=false") | ||
jvmArgs("-Dotel.instrumentation.spring-rabbit.enabled=false") | ||
jvmArgs("-Dotel.instrumentation.spring-integration.producer.enabled=true") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
RashmiRam
pushed a commit
to RashmiRam/opentelemetry-auto-instr-java
that referenced
this pull request
May 23, 2022
…lemetry#4932) * Add an option to create producer span from spring integration instrumentation * Update instrumentation/spring/spring-integration-4.1/library/src/main/java/io/opentelemetry/instrumentation/spring/integration/TracingChannelInterceptor.java Co-authored-by: Mateusz Rzeszutek <[email protected]> * add null check * add doc * Update instrumentation/spring/README.md Co-authored-by: Fabrizio Ferri-Benedetti <[email protected]> Co-authored-by: Mateusz Rzeszutek <[email protected]> Co-authored-by: Fabrizio Ferri-Benedetti <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently we create producer span only from rabbitmq, kafka, jms and rocketmq instrumentations. Due to this producer spans are not created when an unsupported messaging library or a homegrown solution is used. This pr adds a flag that allows creating producer span in spring integration instrumentation which would create the span regardless of the underlying messaging library. The downside of this is that in spring instrumentation channel interceptor we have very little info available and can't fill many of the messaging semantic attributes. Also we can't enable this flag by default as it would suppress the producer span created by the messaging library that would have access to more semantic attributes. Another surprising issue with creating producer span in spring integration channel interceptor is that it is hard to tell whether the current channel is an input or output channel, thus we don't generally know whether we should be creating consumer or producer span. Luckily spring cloud stream adds a
type
attribute to its channels which describes the direction of the channel. We only create the producer span when the current channel is from spring cloud stream and we know that it is an output channel. If needed we could extend this to support more channel types by using a similar logic to what spring cloud sleuth uses, if channel is a DirectChannel then treat it as consume, otherwise producer.