-
Notifications
You must be signed in to change notification settings - Fork 967
Implementation for the latest Messaging Semantic conventions. #13192
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
base: main
Are you sure you want to change the base?
Conversation
|
# Conflicts: # instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/internal/SemconvStability.java
…ll' and it results in span name with 'null' in the name.
…n where PropagatorBasedSpanLinksExtractor is used
… make the spans correctly connected and hierarchical instead of separeted.
… and new naming conventions
@cbos are you doing this for fun or do you intend to get this merged? |
@laurit |
@laurit |
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.
Eventually it would be nice if we also had tests running with the stable semconvs. For db tests we use
tasks {
val testStableSemconv by registering(Test::class) {
jvmArgs("-Dotel.semconv-stability.opt-in=database")
}
check {
dependsOn(testStableSemconv)
}
}
I guess the tests can be added a bit later once the other parts of the PR are finished.
.../java/io/opentelemetry/instrumentation/api/incubator/semconv/messaging/MessageOperation.java
Show resolved
Hide resolved
*/ | ||
@Deprecated | ||
String operationName() { |
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.
Since this is a package private method it is not part of the public api and can be renamed without preserving the original method. If you wish to keep the original method then it would be better to make the old method class the new one.
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.
I marked it as deprecated as it still actively used to support the old naming convention, but should not be used for the new naming convention. To make sure that it is not used or the usage is not increased I marked it as deprecated.
Do you agree, or should I remove it?
...ntelemetry/instrumentation/api/incubator/semconv/messaging/MessagingAttributesExtractor.java
Outdated
Show resolved
Hide resolved
String getDestination(REQUEST request); | ||
default Long getBatchMessageCount(REQUEST request, @Nullable RESPONSE response) { | ||
return null; | ||
} |
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.
Rearranging methods like that complicates the review. It is hard to tell what methods have been added and what was just moved.
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.
I did this to have the list of methods align with the list of attributes on https://github.com/open-telemetry/semantic-conventions/blob/main/docs/messaging/messaging-spans.md#messaging-attributes
Then you can easily see if all attributes are covered.
The old list of methods felt like 'random' placed in the interface, no logical grouping. But I can be wrong about that.
Do you want me to move the methods back?
...try/instrumentation/api/incubator/semconv/messaging/MessagingNetworkAttributesExtractor.java
Outdated
Show resolved
Hide resolved
* This class is internal and is hence not for public use. Its APIs are unstable and can change at | ||
* any time. | ||
*/ | ||
public class PropagatorBasedBaggageExtractor<REQUEST> implements ContextCustomizer<REQUEST> { |
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.
Is this required by the specification? If I understand correctly what this is supposed to do it seems to have a limited usefulness. Perhaps it would be better to introduce it in a separate PR?
...y/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/AwsSdkInstrumenterFactory.java
Outdated
Show resolved
Hide resolved
enum SqsAttributesGetter | ||
implements | ||
MessagingAttributesGetter<Request<?>, Response<?>>, | ||
MessagingNetworkAttributesGetter<Request<?>, Response<?>> { |
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.
not much point in adding the network attributes interface when no methods are implemented
SpanKindExtractor.alwaysConsumer(), | ||
toSqsRequestExtractors(attributesExtractors()), | ||
singletonList(messagingAttributeExtractor), | ||
messagingReceiveInstrumentationEnabled); | ||
messagingReceiveInstrumentationEnabled || SemconvStability.emitStableMessagingSemconv()); |
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.
My advice would be to do the attribute changes in one PR and leave any potential changes to trace structure for followup PRs. Changes to trace structure will most likely require new tests and will make your PR much larger. Also as far as I can tell https://opentelemetry.io/docs/specs/semconv/messaging/messaging-spans/#message-creation-context-as-parent-of-process-span hints that having the process
span as child of publish
span is still allowed. Having these in one trace seems to be preferred by users.
public static Timer onEnter() { | ||
public static Timer onEnter(@Advice.This MessageConsumer consumer) { | ||
|
||
if (JmsConfig.EXPERIMENTAL_CONSUMER_PROCESS_TELEMETRY_ENABLED) { |
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.
If this change is not related to the semantic conventions consider submitting it as a separate PR.
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.
I have reverted this change and I created a new ticket for this:
#14054
But I think I took the wrong way to create the ticket, it does not have labels attached to it yet.
@laurit |
@cbos do you need help getting this over the finishing line? |
@zeitlinger |
While I was working on the Messaging Semantic conventions I found out that there are 2 additional problems. Problem 1 - context propagation: Span links, only link one span to the other. That is what I implemented in this PR as well JMS has 2 ways to receive messages. That is solved in this PR as well: I created a setting for that as well: @laurit @zeitlinger Locally I have an OpenTelemetry demo setup with some changes in which I included JMS messaging as well to test/demo all the changes of the new messaging conventions. Based on that I found the 2 problems as described above. I can share that setup as well if you like. |
…mconv.messaging.MessagingSpanNameExtractor.create and mark it deprecated to give consumers time to migrate
@trask has this come up before in the spec? Imo you should definitely push this in a different PR. If this is not a speced behavior you'll either need to work to get this into the spec or add it as an experimental, disabled by default, feature.
To me this is a new feature not related to semconv update and thus should be put in a separate PR.
The thing with the new semantic conventions is that they can only be enabled with a new major release which means that they could remain behind an opt-in flag for quite a while. The other 2 features aren't really connected with the semconv update and could be implemented separately. Having separate features in separate PRs could also make the review easier. |
@laurit |
I suspect this is expected, since baggage is typically associated with a single trace, and in the messaging modeling there are multiple traces involved. I'd probably recommend opening an issue in semantic-conventions repo seeking any clarifications, since the messaging semconv is not simple (and it's not completely final). |
@trask Based on what I read at https://github.com/open-telemetry/semantic-conventions/blob/main/docs/messaging/messaging-spans.md#context-propagation and with the old/current semantic conventions baggage propagation just normally works ends up in the consumer span. I will take out the change from this PR and I will create a ticket on this repo. Then we can take it forward from that point. Update: I created #14024 for this |
…sExtractor as NetworkAttributesGetter and ServerAttributesGetter can be used by the implementations
…ge. This make the spans correctly connected and hierarchical instead of separeted." This reverts commit fcfd92b.
@trask / @laurit / @zeitlinger
But somehow, I missed this part:
That has consequenses for this implementation, I will rework the implementation based on that.
Some questions for the implementation: The |
I think we may not need a new configuration property if we can put all the new behavior behind
I support Java instrumentation choosing to implement this MAY. We can add opt-out configuration property in the future if someone requests it. |
# Conflicts: # instrumentation-api-incubator/build.gradle.kts # instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/internal/SemconvStability.java
@trask In both cases the emitStableMessagingSemconv() is true and based on that span links are created. What it your expectation for the 'dup/messaging' situation? I think that is only remaining point to address, all other parts are addressed as far as I can see. @laurit, based on your earlier comments I replied, but based on that some questions are still open. Can you have a look at them so we can finish these review comments as well? |
Update Messaging span with the latest semantic conventions.
https://github.com/open-telemetry/semantic-conventions/blob/v1.30.0/docs/messaging/messaging-spans.md
By default nothing changes, it adheres to this: