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 Jaeger remote sampler #936
Merged
Merged
Changes from 30 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
6c157f6
Add Jaeger remote sampler
kvrhdn b3a0fd4
add jaeger_remote/example
kvrhdn 8f55d8d
Extract samplingStrategyParser
kvrhdn cf5fac2
Generate code from jaeger-idl
kvrhdn 5500e91
Add per operation sampler, fix CI
kvrhdn 14342ba
Fix Description()
kvrhdn e499f84
Merge branch 'main' into jaeger_remote
kvrhdn 6eb570e
Delete jaeger-idl submodule, directly check in sampling.proto
kvrhdn 0d0bf03
Update OTel dependencies
kvrhdn 68e05c5
Update README.md
kvrhdn e7ee478
Improve test coverage
kvrhdn 34cbbfb
Merge remote-tracking branch 'base/main' into jaeger_remote
kvrhdn 8b492bf
(Sampler).Description() must not change over time
kvrhdn 8bb5399
Replace internals with jaeger-client-go
kvrhdn f4f3592
Address linting issues
kvrhdn 8f379c1
Fix race condition in test
kvrhdn 04c1b48
Merge branch 'main' into jaeger_remote
kvrhdn c9acff6
Merge branch 'main' into jaeger_remote
kvrhdn a373c13
Merge branch 'main' into jaeger_remote
Aneurysm9 eb75278
Merge branch 'main' into jaeger_remote
Aneurysm9 4e0ce71
Update samplers/jaegerremote/README.md
hanyuancheung bf662c3
Merge branch 'main' into jaeger_remote
hanyuancheung e49435d
Update samplers/jaegerremote/internal/testutils/mock_agent.go
hanyuancheung fbe7e30
Merge branch 'main' into jaeger_remote
hanyuancheung f0ea53d
revmoe go.mod debug info
dino-ma 7906f56
fix Copyright and
dino-ma 97bebca
add from
dino-ma d4ebea2
Update dependency
dino-ma 3fa7800
Modified according to pr
dino-ma d311912
change config from https://github.com/open-telemetry/opentelemetry-go…
dino-ma 823989b
(fix:sampler_remote_options.go):change config
dino-ma d337bb8
(fix:constants.go):remove Copyright
dino-ma aa1dc44
(fix:samoler_remote.go):fix config and add default
dino-ma 82ea29d
Update samplers/jaegerremote/sampler_remote_options.go
dino-ma d4a19ac
Merge branch 'jaeger_remote' of github.com:kvrhdn/opentelemetry-go-co…
dino-ma 9ee4701
add local path
dino-ma bbb1c21
Merge branch 'main' into jaeger_remote
Aneurysm9 3fc124f
fix lint
dino-ma ecc557d
make precommit fix
dino-ma 139c1c8
(fix:sampler_remote_option.go):The default port of jaeger agent is 57…
dino-ma 4474a8f
change for Style guide
dino-ma 76fcb9a
change for Update samplers/jaegerremote/sampler_remote_options.go
dino-ma 40f8379
Merge branch 'main' into jaeger_remote
Aneurysm9 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
PROTOC=docker run --rm -v${PWD}:${PWD} -w${PWD} otel/build-protobuf:latest --proto_path=${PWD} | ||
|
||
PROTO_INCLUDES=-I/usr/include/github.com/gogo/protobuf | ||
|
||
.PHONY: proto-gen | ||
proto-gen: | ||
mkdir -p internal/proto-gen | ||
|
||
$(PROTOC) $(PROTO_INCLUDES) \ | ||
--gogo_out=$(PWD)/internal/proto-gen \ | ||
${PWD}/jaeger-idl/proto/api_v2/sampling.proto |
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,38 @@ | ||
# Jaeger Remote Sampler | ||
|
||
This package implements [Jaeger remote sampler](https://www.jaegertracing.io/docs/latest/sampling/#collector-sampling-configuration). | ||
|
||
## Example | ||
|
||
[example/](./example) shows how to host remote sampling strategies using the OpenTelemetry Collector. | ||
The Collector uses the Jaeger receiver to host the strategy file. Note you do not need to run Jaeger to make use of the Jaeger remote sampling protocol. However, you do need Jaeger backend if you want to utilize its adaptive sampling engine that auto-calculates remote sampling strategies. | ||
|
||
Run the OpenTelemetry Collector using docker-compose: | ||
|
||
```shell | ||
$ docker-compose up -d | ||
``` | ||
|
||
You can fetch the strategy file using curl: | ||
|
||
```shell | ||
$ curl 'localhost:5778/sampling?service=foo' | ||
$ curl 'localhost:5778/sampling?service=myService' | ||
``` | ||
|
||
Run the Go program. | ||
This program will start with an initial sampling percentage of 50% and tries to fetch the sampling strategies from the OpenTelemetry Collector. | ||
It will print the entire Jaeger remote sampler structure every 10 seconds, this allows you to observe the internal sampler. | ||
|
||
```shell | ||
$ go run . | ||
``` | ||
|
||
## Update generated Jaeger code | ||
|
||
Code is generated using the .proto files from [jaeger-idl](https://github.com/jaegertracing/jaeger-idl). | ||
In case [sampling.proto](./jaeger-idl/proto/api_v2/sampling.proto) is modified these have to be regenerated. | ||
|
||
```shell | ||
$ make proto-gen | ||
``` |
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,34 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// Copyright (c) 2021 The Jaeger Authors. | ||
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Copyright (c) 2021 The Jaeger Authors. | ||
// Copyright (c) 2017 Uber Technologies, Inc. | ||
|
||
package jaegerremote | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
const ( | ||
// defaultSamplingServerPort is the default port to fetch sampling config from, via http | ||
defaultSamplingServerPort = 5778 | ||
) | ||
|
||
var ( | ||
// defaultSamplingServerURL is the default url to fetch sampling config from, via http | ||
defaultSamplingServerURL = fmt.Sprintf("http://127.0.0.1:%d/sampling", defaultSamplingServerPort) | ||
) |
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,19 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// Copyright (c) 2021 The Jaeger Authors. | ||
// Copyright (c) 2017 Uber Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// Package jaegerremote implements the Jaeger Remote protocol. | ||
// import "go.opentelemetry.io/contrib/samplers/jaegerremote" | ||
|
||
package jaegerremote | ||
Aneurysm9 marked this conversation as resolved.
Show resolved
Hide resolved
|
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,11 @@ | ||
version: "3" | ||
services: | ||
|
||
otel-collector: | ||
image: otel/opentelemetry-collector:latest | ||
command: [ "--config=/etc/otel-collector.yaml" ] | ||
volumes: | ||
- ./otel-collector.yaml:/etc/otel-collector.yaml | ||
- ./strategies.json:/etc/strategies.json | ||
ports: | ||
- "5778:5778" # default jaeger remote sampling port |
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,11 @@ | ||
module go.opentelemetry.io/contrib/samplers/jaegerremote/example | ||
|
||
go 1.16 | ||
|
||
require ( | ||
github.com/davecgh/go-spew v1.1.1 | ||
go.opentelemetry.io/contrib/samplers/jaegerremote v0.22.0 | ||
go.opentelemetry.io/otel v1.1.0 | ||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.1.0 | ||
go.opentelemetry.io/otel/sdk v1.1.0 | ||
) |
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.
please move copyright headers to the top
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.
remove them here