Skip to content
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

stabilise spanNames #12487

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

AlchemyDing
Copy link
Member

resolve issue
move SpanNames from instrumentation-api-incubator to instrumentation-api

@AlchemyDing AlchemyDing requested a review from a team as a code owner October 21, 2024 16:14
Copy link
Contributor

@steverao steverao 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 good! But I am curious about if there are any other documents or discussions to support this migration apart from quarkusio/quarkus#41521 (comment)? Because I am not sure whether other classes in instrumentation-api-incubator exist similar problem. @trask

Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

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

@open-telemetry/java-instrumentation-approvers @jack-berg @brunobat any thoughts about committing to this as a stable API? thanks

Copy link

@brunobat brunobat left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks!

Copy link
Member

@jack-berg jack-berg left a comment

Choose a reason for hiding this comment

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

Seems ok to me. One day we could end up with semantic conventions for these types of situations, but: 1. I think this is a good way to name spans which will be highly defensible. 2. This is just a utility method.

* This class has been stabilized and moved to {@link
* io.opentelemetry.instrumentation.api.semconv.util.SpanNames}
*/
@Deprecated
Copy link
Member

Choose a reason for hiding this comment

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

Should have these methods delegate to the stable version to make sure the implementation doesn't drift.

Map<String, String> spanNameCache =
spanNameCaches.computeIfAbsent(clazz, c -> new ConcurrentHashMap<>());

// not using computeIfAbsent, because it would require a capturing (allocating) lambda
Copy link
Member

Choose a reason for hiding this comment

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

That shouldn't be the case if you use a method reference.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure how you would use a method reference here?

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public final class SpanNames {
Copy link
Member

Choose a reason for hiding this comment

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

Javadoc?

@trask trask added this to the v2.10.0 milestone Oct 26, 2024
Copy link
Contributor

@breedx-splk breedx-splk left a comment

Choose a reason for hiding this comment

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

This seems fine to me. I think Jack's point about delegating to the stable class should be addressed, and I was surprised to learn that there weren't any unit tests on this very testable code. 😭

@trask trask modified the milestones: v2.10.0, v2.11.0 Nov 13, 2024
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.

Stabilise SpanNames
6 participants