-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
example: add new opentelemetry filter to filter tracetest traces (#3422)
* examples: add example on how to filter non-tracetest traces * fix: export tracetest traces to tracetest * docs: update instructions on how to sample tracetest spans * docs: mention tail sampling * Apply suggestions from code review Co-authored-by: Julianne Fermi <[email protected]> --------- Co-authored-by: Julianne Fermi <[email protected]>
- Loading branch information
1 parent
a4c4cda
commit 8ea7a6c
Showing
6 changed files
with
174 additions
and
16 deletions.
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,31 @@ | ||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: | ||
http: | ||
|
||
processors: | ||
batch: | ||
timeout: 100ms | ||
|
||
filter/tracetest: | ||
error_mode: ignore | ||
traces: | ||
span: | ||
- 'trace_state["tracetest"] != "true"' | ||
|
||
exporters: | ||
logging: | ||
loglevel: debug | ||
|
||
otlp/1: | ||
endpoint: ${TRACETEST_ENDPOINT} | ||
tls: | ||
insecure: true | ||
|
||
service: | ||
pipelines: | ||
traces/1: | ||
receivers: [otlp] | ||
processors: [filter/tracetest, batch] | ||
exporters: [otlp/1] |
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,54 @@ | ||
version: '3' | ||
services: | ||
|
||
tracetest: | ||
image: kubeshop/tracetest:${TAG:-latest} | ||
# uncommentig this line breaks the portability of this file, that is the base for the installer | ||
# platform: linux/amd64 | ||
volumes: | ||
- type: bind | ||
source: ./tracetest-config.yaml | ||
target: /app/tracetest.yaml | ||
- type: bind | ||
source: ./tracetest-provision.yaml | ||
target: /app/provision.yaml | ||
command: --provisioning-file /app/provision.yaml | ||
ports: | ||
- 11633:11633 | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
otel-collector: | ||
condition: service_started | ||
healthcheck: | ||
test: ["CMD", "wget", "--spider", "localhost:11633"] | ||
interval: 1s | ||
timeout: 3s | ||
retries: 60 | ||
environment: | ||
TRACETEST_DEV: ${TRACETEST_DEV} | ||
|
||
postgres: | ||
image: postgres:14 | ||
environment: | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_USER: postgres | ||
healthcheck: | ||
test: pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB" | ||
interval: 1s | ||
timeout: 5s | ||
retries: 60 | ||
|
||
otel-collector: | ||
image: otel/opentelemetry-collector:0.90.1 | ||
command: | ||
- "--config" | ||
- "/otel-local-config.yaml" | ||
volumes: | ||
- ./collector.config.yaml:/otel-local-config.yaml | ||
ports: | ||
- 4317:4317 | ||
environment: | ||
- TRACETEST_ENDPOINT=tracetest:4317 |
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,17 @@ | ||
type: Test | ||
spec: | ||
id: e9c6cff9-974d-4263-8a23-22f1e9f975aa | ||
name: List all tracetest tests | ||
description: List all existing tests from tracetest API | ||
trigger: | ||
type: http | ||
httpRequest: | ||
url: http://localhost:11633/api/tests | ||
method: GET | ||
headers: | ||
- key: Content-Type | ||
value: application/json | ||
specs: | ||
- selector: span[tracetest.span.type="http" name="GET /api/tests"] | ||
assertions: | ||
- attr:tracetest.selected_spans.count = 1 |
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,21 @@ | ||
postgres: | ||
host: postgres | ||
user: postgres | ||
password: postgres | ||
port: 5432 | ||
dbname: postgres | ||
params: sslmode=disable | ||
|
||
telemetry: | ||
exporters: | ||
collector: | ||
serviceName: tracetest | ||
sampling: 100 # 100% | ||
exporter: | ||
type: collector | ||
collector: | ||
endpoint: otel-collector:4317 | ||
|
||
server: | ||
telemetry: | ||
exporter: collector |
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,24 @@ | ||
--- | ||
type: PollingProfile | ||
spec: | ||
name: Default | ||
strategy: periodic | ||
default: true | ||
periodic: | ||
retryDelay: 5s | ||
timeout: 10m | ||
|
||
--- | ||
type: DataStore | ||
spec: | ||
name: OpenTelemetry Collector | ||
type: otlp | ||
default: true | ||
--- | ||
type: TestRunner | ||
spec: | ||
id: current | ||
name: default | ||
requiredGates: | ||
- analyzer-score | ||
- test-specs |