-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
💤 Swap Zipkin server for Zipkin Receiver from OTel Collector Contrib #5045
Merged
+370
−5,015
Merged
Changes from 10 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
196b4c3
Regenerate Zipkin types using newer Swagger image
yurishkuro 8ebe334
Swap Zipkin server for receiver from OTel Collector Contrib
yurishkuro 335a277
fmt
yurishkuro 400dae5
receiver-with-tests
yurishkuro a64c03b
Add tests and delete zipkin packages
yurishkuro c9917a3
Delete zipkin swagger
yurishkuro a761791
remove-commented-code
yurishkuro aef4ba6
go mod tidy
yurishkuro 0f33eb0
fix typo
yurishkuro b49c03e
fix all tests
yurishkuro ef123db
remove deprecated func
yurishkuro 284bd34
clean-up
yurishkuro cf07733
Merge branch 'main' into zipkin-swagger
yurishkuro 7d24ebd
Merge branch 'main' into zipkin-swagger
yurishkuro 5b43341
remove openapi group from dependabot
yurishkuro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...zipkindeser/fixtures/zipkin_proto_02.json → ...app/handler/testdata/zipkin_proto_02.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
cmd/collector/app/handler/testdata/zipkin_thrift_v1_merged_spans.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
[ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used the existing |
||
{ | ||
"trace_id": 5679353540597208576, | ||
"name": "get /", | ||
"id": 5679353540597208576, | ||
"annotations": [ | ||
{ | ||
"timestamp": 1633073248674949, | ||
"value": "sr", | ||
"host": { | ||
"ipv4": 0, | ||
"port": 0, | ||
"service_name": "" | ||
} | ||
}, | ||
{ | ||
"timestamp": 163307324868981, | ||
"value": "ss", | ||
"host": { | ||
"ipv4": 0, | ||
"port": 0, | ||
"service_name": "" | ||
} | ||
} | ||
], | ||
"binary_annotations": null, | ||
"debug": false, | ||
"timestamp": 1633073248674949, | ||
"duration": 14861 | ||
}, | ||
{ | ||
"trace_id": 5679353540597208576, | ||
"name": "get /api", | ||
"id": -3944181038374441761, | ||
"parent_id": 5679353540597208576, | ||
"annotations": [ | ||
{ | ||
"timestamp": 1633073248678309, | ||
"value": "cs", | ||
"host": { | ||
"ipv4": 0, | ||
"port": 0, | ||
"service_name": "" | ||
} | ||
}, | ||
{ | ||
"timestamp": 1633073248681669, | ||
"value": "sr", | ||
"host": { | ||
"ipv4": 0, | ||
"port": 0, | ||
"service_name": "" | ||
} | ||
}, | ||
{ | ||
"timestamp": 1633073248685029, | ||
"value": "cr", | ||
"host": { | ||
"ipv4": 0, | ||
"port": 0, | ||
"service_name": "" | ||
} | ||
}, | ||
{ | ||
"timestamp": 1633073248688388, | ||
"value": "ss", | ||
"host": { | ||
"ipv4": 0, | ||
"port": 0, | ||
"service_name": "" | ||
} | ||
} | ||
], | ||
"binary_annotations": null, | ||
"debug": false, | ||
"timestamp": 1633073248678309, | ||
"duration": 3360 | ||
} | ||
] |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// Copyright (c) 2023 The Jaeger Authors. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package handler | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver" | ||
"go.opentelemetry.io/collector/component" | ||
"go.opentelemetry.io/collector/consumer" | ||
"go.opentelemetry.io/collector/receiver" | ||
noopmetric "go.opentelemetry.io/otel/metric/noop" | ||
nooptrace "go.opentelemetry.io/otel/trace/noop" | ||
"go.uber.org/zap" | ||
|
||
"github.com/jaegertracing/jaeger/cmd/collector/app/flags" | ||
"github.com/jaegertracing/jaeger/cmd/collector/app/processor" | ||
"github.com/jaegertracing/jaeger/pkg/tenancy" | ||
) | ||
|
||
// StartZipkinReceiver starts Zipkin receiver from OTEL Collector. | ||
func StartZipkinReceiver( | ||
options *flags.CollectorOptions, | ||
logger *zap.Logger, | ||
spanProcessor processor.SpanProcessor, | ||
tm *tenancy.Manager, | ||
) (receiver.Traces, error) { | ||
zipkinFactory := zipkinreceiver.NewFactory() | ||
return startZipkinReceiver( | ||
options, | ||
logger, | ||
spanProcessor, | ||
tm, | ||
zipkinFactory, | ||
consumer.NewTraces, | ||
zipkinFactory.CreateTracesReceiver, | ||
) | ||
} | ||
|
||
// Some of OTELCOL constructor functions return errors when passed nil arguments, | ||
// which is a situation we cannot reproduce. To test our own error handling, this | ||
// function allows to mock those constructors. | ||
func startZipkinReceiver( | ||
options *flags.CollectorOptions, | ||
logger *zap.Logger, | ||
spanProcessor processor.SpanProcessor, | ||
tm *tenancy.Manager, | ||
// from here: params that can be mocked in tests | ||
zipkinFactory receiver.Factory, | ||
newTraces func(consume consumer.ConsumeTracesFunc, options ...consumer.Option) (consumer.Traces, error), | ||
createTracesReceiver func(ctx context.Context, set receiver.CreateSettings, | ||
cfg component.Config, nextConsumer consumer.Traces) (receiver.Traces, error), | ||
) (receiver.Traces, error) { | ||
receiverConfig := zipkinFactory.CreateDefaultConfig().(*zipkinreceiver.Config) | ||
applyHTTPSettings(&receiverConfig.HTTPServerSettings, &flags.HTTPOptions{ | ||
HostPort: options.Zipkin.HTTPHostPort, | ||
TLS: options.Zipkin.TLS, | ||
CORS: options.HTTP.CORS, | ||
// TODO keepAlive not supported? | ||
}) | ||
receiverSettings := receiver.CreateSettings{ | ||
TelemetrySettings: component.TelemetrySettings{ | ||
Logger: logger, | ||
TracerProvider: nooptrace.NewTracerProvider(), | ||
MeterProvider: noopmetric.NewMeterProvider(), // TODO wire this with jaegerlib metrics? | ||
}, | ||
} | ||
|
||
consumerAdapter := newConsumerDelegate(logger, spanProcessor, tm) | ||
nextConsumer, err := newTraces(consumerAdapter.consume) | ||
if err != nil { | ||
return nil, fmt.Errorf("could not create Zipkin consumer: %w", err) | ||
} | ||
rcvr, err := createTracesReceiver( | ||
context.Background(), | ||
receiverSettings, | ||
receiverConfig, | ||
nextConsumer, | ||
) | ||
if err != nil { | ||
return nil, fmt.Errorf("could not create Zipkin receiver: %w", err) | ||
} | ||
if err := rcvr.Start(context.Background(), &otelHost{logger: logger}); err != nil { | ||
return nil, fmt.Errorf("could not start Zipkin receiver: %w", err) | ||
} | ||
return rcvr, nil | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(breaking 🛑) had to change this because of the error
TraceID: has length 8 yet wanted length 16
. Jaeger receiver did not have such limitation.