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 e2e test for tail sampling config example #129

Merged
merged 10 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions config_examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Collector example configurations

Here you can find a collection of example Collector configurations.

## Samples

- [Drop](drop.yaml)
evan-bradley marked this conversation as resolved.
Show resolved Hide resolved
- [Effective](effective.yaml.yaml)
- [Health check](healthcheck.yaml)
- [Jaeget Receiver](jaeger.yaml)
- [Pipeline](pipeline.yaml)
- [Tail sampling](tail_sampling.yaml)

## Sending data to Dynatrace

In addition to the `debug` exporter, some samples are also configured with the `otlphttp` exporter
so you can also see the data in your Dynatrace environment.

Before running the samples, make sure you have the following environment variables set:

- `DT_OTLP_ENDPOINT`: The OTLP HTTP endpoint of your Dynatrace environment.
- Follow the guide: [Export to ActiveGate](https://docs.dynatrace.com/docs/shortlink/otel-getstarted-otlpexport#export-to-activegate)
to see how to get the correct API URL for your environment
- `API_TOKEN`: The Dynatrace API access token. Follow the guide on [Authentication](https://docs.dynatrace.com/docs/shortlink/otel-getstarted-otlpexport#authentication-export-to-activegate) to see the scopes required for ingesting OTLP data.

## Trying out the configuration examples
joaopgrassi marked this conversation as resolved.
Show resolved Hide resolved

You can try each configuration example by simply passing the file to the collector when starting up:

```shell
docker run --rm \
--name dt-otelcol \
-v $(pwd)/config_examples/tail_sampling.yaml:/collector.yaml \
ghcr.io/dynatrace/dynatrace-otel-collector/dynatrace-otel-collector:latest \
--config collector.yaml
```
joaopgrassi marked this conversation as resolved.
Show resolved Hide resolved

Or try it out from the GitHub repo if you don't have it cloned:

```shell
docker run --rm \
--name dt-otelcol \
ghcr.io/dynatrace/dynatrace-otel-collector/dynatrace-otel-collector:latest \
--config https://raw.githubusercontent.com/Dynatrace/dynatrace-otel-collector/main/config_examples/tail_sampling.yaml
```
7 changes: 6 additions & 1 deletion config_examples/tail_sampling.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,19 @@ processors:
- name: keep-slow-traces
type: latency
latency: {threshold_ms: 500}
decision_wait: 30s
joaopgrassi marked this conversation as resolved.
Show resolved Hide resolved

exporters:
debug:
verbosity: detailed
otlphttp:
endpoint: ${env:DT_OTLP_ENDPOINT}
headers:
Authorization: "Api-Token ${env:API_TOKEN}"

service:
pipelines:
traces:
receivers: [otlp]
processors: [tail_sampling]
exporters: [debug]
exporters: [otlphttp, debug]
8 changes: 1 addition & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/testbed v0.93.0
github.com/stretchr/testify v1.8.4
go.opentelemetry.io/collector/component v0.93.0
go.opentelemetry.io/collector/pdata v1.0.1
gopkg.in/yaml.v3 v3.0.1
)

require (
contrib.go.opencensus.io/exporter/prometheus v0.4.2 // indirect
github.com/antonmedv/expr v1.15.5 // indirect
github.com/apache/thrift v0.19.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
Expand Down Expand Up @@ -45,7 +45,6 @@ require (
github.com/knadh/koanf/v2 v2.0.1 // indirect
github.com/leodido/ragel-machinery v0.0.0-20181214104525-299bdde78165 // indirect
github.com/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.1-0.20231216201459-8508981c8b6c // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
Expand All @@ -68,7 +67,6 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/opencensusreceiver v0.93.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/syslogreceiver v0.93.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/zipkinreceiver v0.93.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/openzipkin/zipkin-go v0.4.2 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect
Expand All @@ -85,8 +83,6 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
github.com/valyala/fastjson v1.6.4 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
go.opencensus.io v0.24.0 // indirect
Expand Down Expand Up @@ -114,7 +110,6 @@ require (
go.opentelemetry.io/collector/extension/zpagesextension v0.93.0 // indirect
go.opentelemetry.io/collector/featuregate v1.0.1 // indirect
go.opentelemetry.io/collector/otelcol v0.93.0 // indirect
go.opentelemetry.io/collector/pdata v1.0.1 // indirect
go.opentelemetry.io/collector/processor v0.93.0 // indirect
go.opentelemetry.io/collector/processor/batchprocessor v0.93.0 // indirect
go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.93.0 // indirect
Expand Down Expand Up @@ -142,7 +137,6 @@ require (
go.opentelemetry.io/otel/sdk/metric v1.22.0 // indirect
go.opentelemetry.io/otel/trace v1.22.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/net v0.20.0 // indirect
Expand Down
Loading
Loading