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

[kafka] BUG - stop creating spans on empty reads #3363

Merged
merged 4 commits into from
Apr 11, 2024

Conversation

lachmatt
Copy link
Contributor

@lachmatt lachmatt commented Apr 10, 2024

Why

When Consume is called without timeout specified (e.g either with CancellationToken, or with no params), spans will be generated, by default, every 100ms (default value of CancellationDelayMaxMs from ConsumerConfig).
This results in great number of spans generated.

What

No longer create spans for empty reads.

Tests

Existing tests.

Checklist

  • CHANGELOG.md is updated.
    - [ ] Documentation is updated.
    - [ ] New features are covered by tests.

Copy link
Contributor

@pjanotti pjanotti left a comment

Choose a reason for hiding this comment

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

Still draft but it is looking good.

activity.SetException(exception);
}
var activity = KafkaInstrumentation.StartConsumerActivity(consumeResult, (DateTimeOffset)state.StartTime!, instance!);
if (exception is not null)
Copy link
Contributor

@RassK RassK Apr 10, 2024

Choose a reason for hiding this comment

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

may hide some transient network errors (since consumeResult has to exist) ... not sure if good or bad

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd leave it as is for the quick fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't that guaranteed by the check on line 40?

@lachmatt lachmatt marked this pull request as ready for review April 10, 2024 16:51
@lachmatt lachmatt requested a review from a team as a code owner April 10, 2024 16:51
@lachmatt lachmatt marked this pull request as draft April 10, 2024 17:11
@lachmatt lachmatt marked this pull request as ready for review April 11, 2024 10:06
@lachmatt lachmatt changed the title [kafka] stop creating spans on empty reads [kafka] BUG - stop creating spans on empty reads Apr 11, 2024
@pellared pellared merged commit 29af6ca into open-telemetry:main Apr 11, 2024
41 checks passed
@rajkumar-rangaraj
Copy link
Contributor

LGTM.

@lachmatt lachmatt deleted the no-kafka-spans-on-empty-reads branch April 24, 2024 16:15
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.

None yet

6 participants