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

[connector/otlpjson]: Do not emit empty batches #35827

Merged
merged 11 commits into from
Nov 8, 2024

Conversation

khushijain21
Copy link
Contributor

@khushijain21 khushijain21 commented Oct 16, 2024

Description

The connector now does not emit empty batches for invalid otlp payload and throws an error instead. Approach discussed here #35738 (comment)

Link to tracking issue

Fixes #35738 and #35739

Testing

Manual Testing

Documentation

@khushijain21 khushijain21 requested review from djaglowski and a team as code owners October 16, 2024 09:03
Copy link
Member

@andrzej-stencel andrzej-stencel left a comment

Choose a reason for hiding this comment

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

Thank you Khushi!

Copy link
Member

@djaglowski djaglowski left a comment

Choose a reason for hiding this comment

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

Apologies for not commenting sooner, but this implementation highlighted the actual problem for me. Please see #35738 (comment)

err = c.tracesConsumer.ConsumeTraces(ctx, t)
if err != nil {
c.logger.Error("could not consume traces from otlp json", zap.Error(err))
if t.ResourceSpans().Len() != 0 {
Copy link
Member

Choose a reason for hiding this comment

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

connector/otlpjsonconnector/factory.go Outdated Show resolved Hide resolved
connector/otlpjsonconnector/logs.go Outdated Show resolved Hide resolved
Co-authored-by: Daniel Jaglowski <jaglows3@gmail.com>
connector/otlpjsonconnector/logs.go Outdated Show resolved Hide resolved
connector/otlpjsonconnector/logs.go Outdated Show resolved Hide resolved
connector/otlpjsonconnector/logs.go Outdated Show resolved Hide resolved
@djaglowski
Copy link
Member

Please fix lint errors

Copy link
Member

@ChrsMark ChrsMark left a comment

Choose a reason for hiding this comment

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

Thank's @khushijain21!

@djaglowski djaglowski merged commit 2a3fbd0 into open-telemetry:main Nov 8, 2024
158 checks passed
@github-actions github-actions bot added this to the next release milestone Nov 8, 2024
pull bot pushed a commit to abaguas/opentelemetry-collector-contrib that referenced this pull request Nov 8, 2024
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
The connector now does not emit empty batches for invalid otlp payload
and throws an error instead. Approach discussed here
open-telemetry#35738 (comment)

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#35738 and open-telemetry#35739

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Manual Testing 

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->

---------

Co-authored-by: Daniel Jaglowski <jaglows3@gmail.com>
@khushijain21 khushijain21 deleted the otlpjsonconn branch November 9, 2024 04:20
@ChrsMark ChrsMark linked an issue Dec 16, 2024 that may be closed by this pull request
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this pull request Dec 17, 2024
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
The connector now does not emit empty batches for invalid otlp payload
and throws an error instead. Approach discussed here
open-telemetry#35738 (comment)

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#35738 and open-telemetry#35739

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Manual Testing 

<!--Describe the documentation added.-->
#### Documentation

<!--Please delete paragraphs that you did not use before submitting.-->

---------

Co-authored-by: Daniel Jaglowski <jaglows3@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[connector/otlpjson] Invalid OTLP payload is silently ignored [connector/otlpjson] Do not emit empty batches
6 participants