Skip to content

Update otel proto buf specification#5434

Merged
kkondaka merged 4 commits intoopensearch-project:mainfrom
sternadsoftware:update-otel-proto-spec
Feb 26, 2025
Merged

Update otel proto buf specification#5434
kkondaka merged 4 commits intoopensearch-project:mainfrom
sternadsoftware:update-otel-proto-spec

Conversation

@TomasLongo
Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

matrix:
java: [11, 17, 21, docker]
otelVersion: ['0.9.0-alpha', '0.16.0-alpha']
otelVersion: ['1.3.2-alpha']
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this the OTEL version on the client side? If yes, that should work.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I have verified this locally and it should work.


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
Copy Markdown
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!

final Map<String, Object> resourceAttributes = OTelProtoCodec.getResourceAttributes(rs.getResource());
final String schemaUrl = rs.getSchemaUrl();

Stream<OpenTelemetryLog> mappedInstrumentationLibraryLogs = rs.getInstrumentationLibraryLogsList()
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

}
}

if (resourceSpans.getInstrumentationLibrarySpansList().size() > 0) {
Copy link
Copy Markdown
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
Copy Markdown
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.

return result;
}

private List<Span> parseInstrumentationLibrarySpans(final List<InstrumentationLibrarySpans> instrumentationLibrarySpansList,
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

Thank you @TomasLongo for working on this important update!

@kkondaka
Copy link
Copy Markdown
Collaborator

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

@KarstenSchnitter
Copy link
Copy Markdown
Collaborator

The instrumentationScope attributes can be added with their own prefix similar to this example. This means to use instrumentationScope.attributes.namespace@dot@mapped. This is the approach taken so far for any attributes. We can use the same approach in #5259 for these attributes.

@dlvenable
Copy link
Copy Markdown
Member

@KarstenSchnitter , @kkondaka ,

Would you be ok with this approach?

  1. Approve and merge this PR.
  2. Add the missing end-to-end test
  3. Add the attributes

@KarstenSchnitter
Copy link
Copy Markdown
Collaborator

@dlvenable your proposal looks good to me.

@kkondaka kkondaka merged commit 20db890 into opensearch-project:main Feb 26, 2025
65 of 69 checks passed
divbok pushed a commit to divbok/data-prepper that referenced this pull request Mar 4, 2025
* Update otel proto buf specification

Signed-off-by: Tomas Longo <tomas.longo@sap.com>

* Remove todos

Signed-off-by: Tomas Longo <tomas.longo@sap.com>

* remove last remnants of instrumentation library

Signed-off-by: Tomas Longo <tomas.longo@sap.com>

* Just test the new otel proto buf spec in the e2e raw span test

Signed-off-by: Tomas Longo <tomas.longo@sap.com>

---------

Signed-off-by: Tomas Longo <tomas.longo@sap.com>
Co-authored-by: Tomas Longo <tomas.longo@sap.com>
@dlvenable
Copy link
Copy Markdown
Member

@KarstenSchnitter , @kkondaka ,

Would you be ok with this approach?

1. Approve and merge this PR.

2. Add the missing end-to-end test

3. Add the attributes

The last two items (2 and 3) were completed in #5471.

@dlvenable dlvenable added this to the v2.11 milestone Mar 13, 2025
chenqi0805 pushed a commit to chenqi0805/data-prepper that referenced this pull request Apr 2, 2025
* Update otel proto buf specification

Signed-off-by: Tomas Longo <tomas.longo@sap.com>

* Remove todos

Signed-off-by: Tomas Longo <tomas.longo@sap.com>

* remove last remnants of instrumentation library

Signed-off-by: Tomas Longo <tomas.longo@sap.com>

* Just test the new otel proto buf spec in the e2e raw span test

Signed-off-by: Tomas Longo <tomas.longo@sap.com>

---------

Signed-off-by: Tomas Longo <tomas.longo@sap.com>
Co-authored-by: Tomas Longo <tomas.longo@sap.com>
Signed-off-by: George Chen <qchea@amazon.com>
amdhing pushed a commit to amdhing/data-prepper that referenced this pull request Apr 16, 2025
* Update otel proto buf specification

Signed-off-by: Tomas Longo <tomas.longo@sap.com>

* Remove todos

Signed-off-by: Tomas Longo <tomas.longo@sap.com>

* remove last remnants of instrumentation library

Signed-off-by: Tomas Longo <tomas.longo@sap.com>

* Just test the new otel proto buf spec in the e2e raw span test

Signed-off-by: Tomas Longo <tomas.longo@sap.com>

---------

Signed-off-by: Tomas Longo <tomas.longo@sap.com>
Co-authored-by: Tomas Longo <tomas.longo@sap.com>
Davidding4718 pushed a commit to Davidding4718/data-prepper that referenced this pull request Apr 25, 2025
* Update otel proto buf specification

Signed-off-by: Tomas Longo <tomas.longo@sap.com>

* Remove todos

Signed-off-by: Tomas Longo <tomas.longo@sap.com>

* remove last remnants of instrumentation library

Signed-off-by: Tomas Longo <tomas.longo@sap.com>

* Just test the new otel proto buf spec in the e2e raw span test

Signed-off-by: Tomas Longo <tomas.longo@sap.com>

---------

Signed-off-by: Tomas Longo <tomas.longo@sap.com>
Co-authored-by: Tomas Longo <tomas.longo@sap.com>
Davidding4718 pushed a commit to Davidding4718/data-prepper that referenced this pull request Apr 25, 2025
* Update otel proto buf specification

Signed-off-by: Tomas Longo <tomas.longo@sap.com>

* Remove todos

Signed-off-by: Tomas Longo <tomas.longo@sap.com>

* remove last remnants of instrumentation library

Signed-off-by: Tomas Longo <tomas.longo@sap.com>

* Just test the new otel proto buf spec in the e2e raw span test

Signed-off-by: Tomas Longo <tomas.longo@sap.com>

---------

Signed-off-by: Tomas Longo <tomas.longo@sap.com>
Co-authored-by: Tomas Longo <tomas.longo@sap.com>
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