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

Add OTLP receiver to collector #3701

Merged
merged 8 commits into from
May 29, 2022
Merged

Conversation

yurishkuro
Copy link
Member

@yurishkuro yurishkuro commented May 25, 2022

A proof-of-concept of adding an OTLP receiver (#3625) to Jaeger collector/all-in-one.

  • Imports OTLP receiver from otel-collector
  • Imports OTLP->Jaeger Proto translator from otel-collector-contrib
  • Minimal & dirty initialization of the OTEL collector runtime environment (like component.Host)
  • Receiver apparently implements internal tracing, I am passing the default TracerProvider (which should be no-op), we may need to revisit it later
  • There are NO external configuration options (added in Introduce OTLP receiver configuration flags #3710) for this receiver, it only works with defaults. However, internally it does have a config struct which can be in the future PRs hooked up with CLI flags.

Testing with this little program https://gist.github.com/yurishkuro/c60011b9b3b3e6b5c11f0852f877a6c3 produces a trace like this:
image

@codecov
Copy link

codecov bot commented May 26, 2022

Codecov Report

Merging #3701 (4bfca3c) into main (88bfe91) will increase coverage by 0.10%.
The diff coverage is 97.08%.

@@            Coverage Diff             @@
##             main    #3701      +/-   ##
==========================================
+ Coverage   97.34%   97.44%   +0.10%     
==========================================
  Files         268      269       +1     
  Lines       15752    15842      +90     
==========================================
+ Hits        15333    15438     +105     
+ Misses        330      320      -10     
+ Partials       89       84       -5     
Impacted Files Coverage Δ
cmd/collector/app/flags.go 100.00% <ø> (ø)
cmd/collector/app/collector.go 84.49% <86.95%> (+8.13%) ⬆️
cmd/collector/app/handler/grpc_handler.go 100.00% <100.00%> (+14.28%) ⬆️
cmd/collector/app/handler/otlp_receiver.go 100.00% <100.00%> (ø)
cmd/query/app/static_handler.go 97.60% <0.00%> (+3.59%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 88bfe91...4bfca3c. Read the comment docs.

@yurishkuro yurishkuro force-pushed the otlp-receiver branch 2 times, most recently from 1f7a70c to 8ae69d1 Compare May 26, 2022 20:20
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
@yurishkuro yurishkuro changed the title WIP: Add OTLP receiver Add OTLP receiver May 27, 2022
@yurishkuro yurishkuro marked this pull request as ready for review May 27, 2022 02:02
@yurishkuro yurishkuro requested a review from a team as a code owner May 27, 2022 02:02
@yurishkuro yurishkuro changed the title Add OTLP receiver Add OTLP receiver to collector May 27, 2022
@yurishkuro
Copy link
Member Author

@albertteoh care to review?

albertteoh
albertteoh previously approved these changes May 28, 2022
Copy link
Contributor

@albertteoh albertteoh left a comment

Choose a reason for hiding this comment

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

LGTM overall. Added some non-blocking suggestions .

cmd/collector/app/collector.go Show resolved Hide resolved
cmd/collector/app/collector.go Outdated Show resolved Hide resolved
cmd/collector/app/handler/otlp_receiver.go Show resolved Hide resolved
cmd/collector/app/handler/otlp_receiver.go Outdated Show resolved Hide resolved
cmd/collector/app/handler/otlp_receiver.go Outdated Show resolved Hide resolved
cmd/collector/app/handler/otlp_receiver.go Show resolved Hide resolved
cmd/collector/app/handler/otlp_receiver.go Outdated Show resolved Hide resolved
logger.Fatal("Failed to start collector", zap.Error(err))
}

// Wait for shutfown
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Wait for shutfown
// Wait for shutdown

expectErr error
expectLog string
}{
{}, // no errors
Copy link
Contributor

Choose a reason for hiding this comment

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

I would add a test name or description so there won't be a need for this comment. i.e.:

{name: "no errors"},
...
t.Run(test.name, func(t *testing.T) {...

It has the added benefit of a more descriptive test name in logs when executing the test.

Signed-off-by: Yuri Shkuro <[email protected]>

Co-authored-by: Albert <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
@@ -84,6 +84,11 @@ type CollectorOptions struct {
// See gRPC's keepalive.ServerParameters#MaxConnectionAgeGrace.
MaxConnectionAgeGrace time.Duration
}
// OTLP section defines options for servers accepting OpenTelemetry OTLP format
OTLP struct {
Copy link
Member Author

Choose a reason for hiding this comment

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

refactored in #3710

var _ component.Host = (*otelHost)(nil) // API check

// OtelReceiverOptions allows configuration of the receiver.
type OtelReceiverOptions struct {
Copy link
Member Author

Choose a reason for hiding this comment

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

removed in #3710

Signed-off-by: Yuri Shkuro <[email protected]>
@yurishkuro yurishkuro merged commit b708823 into jaegertracing:main May 29, 2022
@yurishkuro yurishkuro deleted the otlp-receiver branch May 29, 2022 20:45
@yurishkuro
Copy link
Member Author

thanks for the review @albertteoh

albertteoh added a commit to albertteoh/jaeger that referenced this pull request Jul 13, 2022
Signed-off-by: Yuri Shkuro <[email protected]>
Co-authored-by: Albert <[email protected]>
Signed-off-by: Albert Teoh <[email protected]>
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.

2 participants