Skip to content

Commit 73b40b7

Browse files
authored
Document configuration for Jaeger Remote Sampler (#2858)
1 parent 07aa7b2 commit 73b40b7

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Collection of 3rd-party packages for [OpenTelemetry-Go](https://github.com/open-
1313
- [Instrumentation](./instrumentation/): Packages providing OpenTelemetry instrumentation for 3rd-party libraries.
1414
- [Propagators](./propagators/): Packages providing OpenTelemetry context propagators for 3rd-party propagation formats.
1515
- [Detectors](./detectors/): Packages providing OpenTelemetry resource detectors for 3rd-party cloud computing environments.
16+
- [Samplers](./samplers/): Packages providing additional implementations of OpenTelemetry samplers.
1617

1718
## Project Status
1819

@@ -23,7 +24,7 @@ board](https://github.com/orgs/open-telemetry/projects/5).
2324
### Compatibility
2425

2526

26-
OpenTelemetry-Go Contrib ensures compatibility with the current supported
27+
OpenTelemetry-Go Contrib ensures compatibility with the current supported
2728
versions of
2829
the [Go language](https://golang.org/doc/devel/release#policy):
2930

samplers/jaegerremote/README.md

+27
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,33 @@
22

33
This package implements [Jaeger remote sampler](https://www.jaegertracing.io/docs/latest/sampling/#collector-sampling-configuration).
44

5+
## Usage
6+
7+
Configuration in the code:
8+
9+
```go
10+
jaegerRemoteSampler := jaegerremote.New(
11+
"your-service-name",
12+
jaegerremote.WithSamplingServerURL("http://{sampling_service_host_name}:5778"),
13+
jaegerremote.WithSamplingRefreshInterval(10*time.Second),
14+
jaegerremote.WithInitialSampler(trace.TraceIDRatioBased(0.5)),
15+
)
16+
17+
tp := trace.NewTracerProvider(
18+
trace.WithSampler(jaegerRemoteSampler),
19+
...
20+
)
21+
otel.SetTracerProvider(tp)
22+
```
23+
24+
Notes:
25+
26+
* At this time, the Jaeger Remote Sampler can only be configured in the code,
27+
configuration via `OTEL_TRACES_SAMPLER=jaeger_sampler` environment variable is not supported.
28+
* Service name must be passed to the constructor. It will be used by the sampler to poll
29+
the backend for the sampling strategy for this service.
30+
* Both Jaeger Agent and OpenTelemetry Collector implement the Jaeger sampling service endpoint.
31+
532
## Example
633

734
[example/](./example) shows how to host remote sampling strategies using the OpenTelemetry Collector.

0 commit comments

Comments
 (0)