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

[jaeger-v2] Add support for artificial jaeger storage receiver #5242

Merged
merged 14 commits into from
Mar 4, 2024

Conversation

james-ryans
Copy link
Contributor

Which problem is this PR solving?

Description of the changes

  • Implement Jaeger storage receiver to be used by Jaeger-v2 Kafka integration test.

How was this change tested?

  • Added some unit tests.

Checklist

Copy link

codecov bot commented Mar 2, 2024

Codecov Report

Attention: Patch coverage is 97.56098% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 95.09%. Comparing base (286b94a) to head (efcf080).

Files Patch % Lines
.../integration/receivers/storagereceiver/receiver.go 96.87% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5242      +/-   ##
==========================================
- Coverage   95.09%   95.09%   -0.01%     
==========================================
  Files         336      339       +3     
  Lines       16421    16502      +81     
==========================================
+ Hits        15615    15692      +77     
- Misses        618      621       +3     
- Partials      188      189       +1     
Flag Coverage Δ
cassandra-3.x 26.56% <ø> (ø)
cassandra-4.x 26.56% <ø> (ø)
elasticsearch-5.x 21.80% <ø> (ø)
elasticsearch-6.x 21.78% <ø> (-0.02%) ⬇️
elasticsearch-7.x 21.88% <ø> (ø)
elasticsearch-8.x 21.95% <ø> (ø)
grpc-badger 19.26% <ø> (+0.01%) ⬆️
kafka 14.56% <ø> (ø)
opensearch-1.x 21.88% <ø> (+0.01%) ⬆️
opensearch-2.x 21.86% <ø> (ø)
unittests 92.71% <97.56%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@james-ryans
Copy link
Contributor Author

Hi @yurishkuro, I've implemented the Jaeger storage receiver as you stated it's better to separate this PR. There are still things to add here:

  1. Improve coverage but I will need to abstract the jaeger storage extension with interface similar to Add tests for internal/extension/jaegerquery #5123
  2. Add a configurable pull interval delay

Comment on lines 79 to 82
if ctx.Err() != nil {
r.settings.Logger.Error("Consumer stopped", zap.Error(ctx.Err()))
return ctx.Err()
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why is this an error for the consumer?

I actually follow kafkareceiver from otelcol-contrib since they're both a "pull" strategy to retrieve traces. https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/3652b444802fad4819b50fbda41e0957000d8279/receiver/kafkareceiver/kafka_receiver.go#L171-L185

Copy link
Member

Choose a reason for hiding this comment

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

I think it's wrong to treat orderly shutdown as error and log all kinds of error messages. You can check Done instead

        select {
        case <-ctx.Done():
            return
        default:
            time.Sleep(time.Second)
        }

Comment on lines +65 to +66
func (r *storageReceiver) consumeLoop(ctx context.Context) error {
for {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

how do we exit this loop? Should it be checking ctx.Done for that?

When the r.cancelConsumeLoop() is called from Shutdown, we can capture that with ctx.Err(). Is it better to check with ctx.Done? I followed kafkareceiver implementation from otelcol-contrib actually https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/3652b444802fad4819b50fbda41e0957000d8279/receiver/kafkareceiver/kafka_receiver.go#L171-L185

Comment on lines 79 to 82
if ctx.Err() != nil {
r.settings.Logger.Error("Consumer stopped", zap.Error(ctx.Err()))
return ctx.Err()
}
Copy link
Member

Choose a reason for hiding this comment

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

I think it's wrong to treat orderly shutdown as error and log all kinds of error messages. You can check Done instead

        select {
        case <-ctx.Done():
            return
        default:
            time.Sleep(time.Second)
        }

@james-ryans james-ryans marked this pull request as ready for review March 3, 2024 16:53
@james-ryans james-ryans requested a review from a team as a code owner March 3, 2024 16:53
@james-ryans james-ryans requested a review from jkowall March 3, 2024 16:53
@yurishkuro yurishkuro added the changelog:test Change that's adding missing tests or correcting existing tests label Mar 3, 2024
@yurishkuro yurishkuro enabled auto-merge (squash) March 4, 2024 00:24
@yurishkuro yurishkuro merged commit 4fd7e71 into jaegertracing:main Mar 4, 2024
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:test Change that's adding missing tests or correcting existing tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants