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

Update otel proto buf specification #5434

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

Conversation

TomasLongo
Copy link

Description

Updates the otel proto buf specifications.

This is a breaking change, since the otel proto buf specification removes InstrumentationLibrary* objects and replaces them with Scope* object. This also changes the hierarchy of the data structure

Issues Resolved

relates to #5322

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Tomas Longo <tomas.longo@sap.com>
@TomasLongo TomasLongo force-pushed the update-otel-proto-spec branch from 862fbe2 to a1c3d6c Compare February 13, 2025 08:19
Copy link
Collaborator

@KarstenSchnitter KarstenSchnitter 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 submitting this PR. Let's try to get rid of the TODOs. I am not sure about the Kafka integration tests. The seem to fail in the build pipeline. Maybe @kkondaka can support?

Signed-off-by: Tomas Longo <tomas.longo@sap.com>
@TomasLongo TomasLongo force-pushed the update-otel-proto-spec branch from 0749be9 to 77feae9 Compare February 13, 2025 13:32
Signed-off-by: Tomas Longo <tomas.longo@sap.com>
Copy link
Collaborator

@KarstenSchnitter KarstenSchnitter left a comment

Choose a reason for hiding this comment

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

The huge number of deletions in the OTelMetricsProtoHelper look scary. But the methods were unused due to the migration to the OTelProtoCodec. There are still test failures in the Kafka integration tests. I triggered the build pipeline, so that we get a full picture. @kkondaka can you assist with the Kafka tests?

@kkondaka
Copy link
Collaborator

@TomasLongo looks like some tests are failing because of ScopeSpans related error in 0.9.0 version. Could you check?

@TomasLongo @KarstenSchnitter what's the impact of updating to latest version with customers who may be using older version to send data?

@kkondaka
Copy link
Collaborator

@TomasLongo I think we should remove 0.9 0-alpha from .github/workflows/data-prepper-trace-analytics-raw-span-e2e-tests.yml and use the new version you are adding there for testing. That way we can getrid of the error you are currently seeing in the failing e2e tests. @dlvenable what do you think?

@KarstenSchnitter
Copy link
Collaborator

In the PR introducing the instrumentationScope (open-telemetry/opentelemetry-proto#362) it clearly states:

This is not a breaking change for OTLP. The wire format does not change.

This is also evident from the *.proto files. With the upgrade to v1.3.2, the legacy check for instrumentationLibrary is removed. This affects senders, that use a protobuf definitions in the range v0.15.0 (March 19th, 2022) till v0.19.0 (August 3rd, 2022) still giving an instrumentationLibrary. Older implementations will be mapped to the instrumentationScope just fine. Later implementations no longer offer support for instrumentationLibrary.

I think we are good to go with the upgrade.

Signed-off-by: Tomas Longo <tomas.longo@sap.com>
@TomasLongo
Copy link
Author

@kkondaka I've removed the old versions from the e2e-raw-span-test. At least, locally, the test is green now.

@kkondaka
Copy link
Collaborator

@KarstenSchnitter just to understand what you wrote, if some customer is still using OLD (pre feb-2021) logs generator which has "instrumentationLibrary", what happens when DataPrepper receives it, it will be dropped silently, right? (I understand there won't be any other issues or errors)

@KarstenSchnitter
Copy link
Collaborator

@kkondaka: If you used an Otel instrumentation pre-March 2022 it would generate a binary representation of the instrumentation library, that all post-March 2022 implementations would read as instrumentation scope. This is evident by the indices used in the *.proto files.

"schemaUrl": "schemaurl"
},
{
"resource": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why "resource" section removed? I think it is still valid in the new protocol spec, right?

@dlvenable
Copy link
Member

@kkondaka: If you used an Otel instrumentation pre-March 2022 it would generate a binary representation of the instrumentation library, that all post-March 2022 implementations would read as instrumentation scope. This is evident by the indices used in the *.proto files.

Thanks @KarstenSchnitter for elaborating on this. As I understand this is not a breaking change and I'm good to move forward.

Looking at the original PR I see that the index was the same, so this is backward compatible. The grace period was specifically to help the receiver (Data Prepper) and sender begin to migrate without immediate code changes. We've missed that, so we do have to change the code.

@@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
java: [11, 17, 21, docker]
otelVersion: ['0.9.0-alpha', '0.16.0-alpha']
otelVersion: ['1.3.2-alpha']
Copy link
Member

Choose a reason for hiding this comment

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

Can we keep an old version in here and still have tests pass? I'd expect this to be ok since the wire format is unchanged.

otelVersion: ['0.16.0-alpha', '1.3.2-alpha']

Copy link
Collaborator

Choose a reason for hiding this comment

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

@dlvenable I do not think that's possible.

Copy link
Member

Choose a reason for hiding this comment

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

Why not? The wire format is the same is it not?

@@ -40,14 +31,7 @@ public final class OTelMetricsProtoHelper {

private static final Logger LOG = LoggerFactory.getLogger(OTelMetricsProtoHelper.class);
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
private static final String SERVICE_NAME = "service.name";
Copy link
Member

Choose a reason for hiding this comment

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

Thank you for cleaning up these unused methods and names!

@@ -198,17 +193,6 @@ protected Collection<OpenTelemetryLog> parseResourceLogs(ResourceLogs rs, final
final Map<String, Object> resourceAttributes = OTelProtoCodec.getResourceAttributes(rs.getResource());
final String schemaUrl = rs.getSchemaUrl();

Stream<OpenTelemetryLog> mappedInstrumentationLibraryLogs = rs.getInstrumentationLibraryLogsList()
Copy link
Member

Choose a reason for hiding this comment

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

Why are these removed and not changed to iterate of getScopeLogs()?

Copy link
Collaborator

Choose a reason for hiding this comment

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

scopeLogs is being processed in rs.getScopeLogsList().stream() below

Copy link
Member

Choose a reason for hiding this comment

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

We already supported scopeLogs, etc. Great! I see this now.

@@ -239,22 +223,6 @@ protected Map<String, ResourceSpans> splitResourceSpansByTraceId(final ResourceS
}
}

if (resourceSpans.getInstrumentationLibrarySpansList().size() > 0) {
Copy link
Member

Choose a reason for hiding this comment

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

Similar comment as one above: Why is this removed entirely?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@dlvenable that API doesn't exist, so it is removed. The if (resourceSpans.getScopeSpansList().size() > 0) { processing scopeSpans.

@@ -306,38 +270,6 @@ private Map<String, List<ScopeSpans>> splitScopeSpansByTraceId(final List<ScopeS
return result;
}

private List<Span> parseInstrumentationLibrarySpans(final List<InstrumentationLibrarySpans> instrumentationLibrarySpansList,
Copy link
Member

Choose a reason for hiding this comment

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

Same question: Why is this removed entirely?

Copy link
Collaborator

Choose a reason for hiding this comment

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

This API removed because the underlying function ( instrumentationLibrarySpans.getInstrumentationLibrary()) is not valid anymore

@dlvenable
Copy link
Member

Thank you @TomasLongo for working on this important update!

@kkondaka
Copy link
Collaborator

@TomasLongo The new spec adds "attributes" under "instrumentationScope", we should be able to do instrumentationScope.getAttributesList() and put them in the event too.

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.

4 participants