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

Semconv 1.25.0 migration #10983

Merged
merged 53 commits into from
Apr 9, 2024
Merged

Conversation

SylvainJuge
Copy link
Contributor

@SylvainJuge SylvainJuge commented Mar 29, 2024

The 1.24.0 release of semconv for java brings breaking changes that prevent a simple upgrade PR like #10971 to work as expected.

As there are lots of changes I've split the PR in separate commits:

For SemanticAttributes.EXCEPTION_EVENT_NAME I had to inline and duplicate the "exception" value as there isn't any equivalent in the new semantic conventions.

Follow-up questions where input is welcome

  • should we keep a copy of the old semconv classes to make migration easier (Semconv 1.25.0 migration #10983 (review)).
    Answer is "YES" and this was done
  • if yes, should we keep it here in the agent or in a separate repo/artifact ? (Semconv 1.25.0 migration #10983 (comment))
    Answer is "NO", it remains as part of the "stable" semconv artifact due to the usage of java modules that prevent having classes from a package spread in more than one artifact.

Follow-up tasks once this is merged

@github-actions github-actions bot added the test native This label can be applied to PRs to trigger them to run native tests label Apr 2, 2024
@github-actions github-actions bot requested a review from theletterf April 2, 2024 08:40
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
* any time.
*/
public final class NetworkAttributes {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[for reviewer] I don't know the reason this class was introduced in the first place, but given all the attributes are now part of semconv, it's probably a good time to use them.

Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I know this class was temporarily introduced to use attributes that weren't present int the latest semconv jar. It is fine to remove it now.

@@ -162,12 +162,12 @@ class SpanAssert {

def errorEvent(Class<Throwable> errorClass, expectedMessage, int index) {
event(index) {
eventName(SemanticAttributes.EXCEPTION_EVENT_NAME)
eventName("exception")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[for reviewer] this is one of the cases where the SemanticAttributes.EXCEPTION_EVENT_NAME has no equivalent in the new semconv and I had to inline the value as-is.

@SylvainJuge
Copy link
Contributor Author

Thanks for working on this. I think we are going to need to preserve the old semconv classes in the agent to avoid breaking extensions that could be using the old semconv classes. We could do this either by copying these semconv classes like you did in the previous version of this PR or by doing some build script magic. This can be done in a separate PR. @trask WDYT?

If every project that depends on semconv java is impacted, then it could make sense to provide such "compatibility layer" directly in https://github.com/open-telemetry/semantic-conventions-java/ as a separate artifact to make migration easier (with of course deprecation warnings), then drop it after a few releases to push migration and avoid having to keep it forever, or we could even include it as part of the semconv-incubating artifact to make it obvious that it won't be there forever without having a separate artifact.

assertThat(resource.getAttribute(ResourceAttributes.OS_TYPE))
.isEqualTo(ResourceAttributes.OsTypeValues.LINUX);
assertThat(resource.getAttribute(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty();
assertThat(resource.getSchemaUrl()).isEqualTo(SchemaUrls.V1_24_0);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[for reviewer] I am not sure what is the "right" value to pick here, so I picked the 1.24.0 to match the semconv version.

@SylvainJuge SylvainJuge marked this pull request as ready for review April 3, 2024 13:03
@SylvainJuge SylvainJuge requested a review from a team April 3, 2024 13:03
@trask
Copy link
Member

trask commented Apr 3, 2024

Thanks for working on this.

💯

I think we are going to need to preserve the old semconv classes in the agent to avoid breaking extensions that could be using the old semconv classes. We could do this either by copying these semconv classes like you did in the previous version of this PR or by doing some build script magic. This can be done in a separate PR. @trask WDYT?

I'd support copying the old semconv classes in (seems easiest) and marking them all as deprecated. We can remove the copies in 3.0 when we bump database and RPC semconv.

@SylvainJuge
Copy link
Contributor Author

Following yesterday sig meeting discussion, I've opened open-telemetry/semantic-conventions-java#62 to include a copy of the old classes and that will likely be included in the upcoming 1.25.0 release of semantic-conventions-java.

So such big-bang migration won't be needed once 1.25.0 is out, but the migration needs to happen anyway and it's already done here, thus I think it's still relevant to review and merge it.

@trask
Copy link
Member

trask commented Apr 8, 2024

just holding off on merging this for the next semconv java 1.25.0 release, so we can avoid breaking any Java agent extensions that were relying on the old classes

@trask
Copy link
Member

trask commented Apr 8, 2024

semconv java 1.25.0 has been released

@SylvainJuge when you have time, can you update to 1.25.0 and resolve conflicts, then we'll merge it!

@SylvainJuge
Copy link
Contributor Author

Fixing the conflicts was the easy and fun part, bumping semconv to 1.25.0 also brings the following:

So with those new additions that should be good to go.

@SylvainJuge SylvainJuge changed the title Semconv 1.24.0 migration Semconv 1.25.0 migration Apr 9, 2024
@trask trask merged commit 955470a into open-telemetry:main Apr 9, 2024
49 checks passed
@SylvainJuge SylvainJuge deleted the semconv-update branch April 10, 2024 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test native This label can be applied to PRs to trigger them to run native tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants