Skip to content
13 changes: 9 additions & 4 deletions .github/renovate-tracked-deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,26 @@
"mise"
]
},
".github/workflows/ghcr-image-build-and-publish.yml": {
".github/workflows/ci.yml": {
"regex": [
"cosign"
"mise"
]
},
".github/workflows/ci.yml": {
".github/workflows/ghcr-image-build-and-publish.yml": {
"regex": [
"mise"
"cosign"
]
},
".github/workflows/release.yml": {
"regex": [
"cosign"
]
},
"ci/oats/docker-compose.lgtm.yml": {
"docker-compose": [
"docker.io/grafana/otel-lgtm"
]
},
"docker/Dockerfile": {
"dockerfile": [
"docker.io/otel/ebpf-instrument",
Expand Down
19 changes: 18 additions & 1 deletion .mise/tasks/acceptance-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,21 @@ echo "using version $version"

# Force Docker: oats hardcodes `docker compose`, so the image must be built with Docker.
./build-lgtm.sh "$version" docker
oats -timeout 5m -lgtm-version "$version" examples/

# renovate: datasource=github-releases depName=gcx packageName=grafana/gcx
export GCX_VERSION=v0.4.0
go install "github.com/grafana/gcx/cmd/gcx@${GCX_VERSION}"

workdir="$(mktemp -d)"
trap 'rm -rf "$workdir"' EXIT
git clone --depth 1 --branch v2 https://github.com/grafana/oats "$workdir/oats-src"
GOWORK=off go -C "$workdir/oats-src" build -o "$workdir/oats" ./cmd/v2

Comment on lines +20 to +22
export LGTM_IMAGE="grafana/otel-lgtm:${version}"
REAL_GCX_BIN="$(go env GOPATH)/bin/gcx" \
"$workdir/oats" \
--config oats.toml \
--gcx ./ci/oats/gcx-wrapper.sh \
Comment on lines +25 to +27
--no-cache \
--timeout=3m \
-v 2
9 changes: 9 additions & 0 deletions ci/oats/docker-compose.lgtm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
lgtm:
image: ${LGTM_IMAGE:-docker.io/grafana/otel-lgtm:latest}
ports:
Comment on lines +2 to +4
- "3000:3000"
- "4317:4317"
- "4318:4318"
- "4040:4040"
- "9090:9090"
27 changes: 27 additions & 0 deletions ci/oats/gcx-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail
real_gcx="${REAL_GCX_BIN:-gcx}"
args=()
skip_next=false
for arg in "$@"; do
if [ "$skip_next" = true ]; then
skip_next=false
continue
fi
if [ "$arg" = "--context" ]; then
skip_next=true
continue
fi
args+=("$arg")
done
for _ in $(seq 1 120); do
token="$(docker exec lgtm cat /tmp/grafana-sa-token 2>/dev/null || true)"
if [ -n "$token" ]; then
export GRAFANA_SERVER="${GRAFANA_SERVER:-http://localhost:3000}"
export GRAFANA_TOKEN="$token"
exec "$real_gcx" "${args[@]}"
fi
sleep 1
done
Comment on lines +17 to +25
printf 'gcx-wrapper: timed out waiting for grafana service-account token from lgtm\n' >&2
exit 1
33 changes: 3 additions & 30 deletions examples/ebpf-profiler/docker-compose.oats.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
otel-ebpf-profiler:
build:
context: .
context: ../../examples/ebpf-profiler
dockerfile: Dockerfile
command:
[
Expand All @@ -20,11 +20,10 @@ services:
depends_on:
- lgtm

# instrumented applications - sorted alphabetically by language
go:
build:
context: ../go
dockerfile: ../go/Dockerfile
context: ../../examples/go
dockerfile: Dockerfile
environment:
OTEL_SERVICE_NAME: "rolldice"
OTEL_EXPORTER_OTLP_ENDPOINT: http://lgtm:4318
Expand All @@ -33,29 +32,3 @@ services:
- "8080:8081"
depends_on:
- lgtm
#
# java:
# build:
# context: ../java
# dockerfile: ../java/json-logging-otlp/Dockerfile
# environment:
# OTEL_SERVICE_NAME: "rolldice"
# OTEL_EXPORTER_OTLP_ENDPOINT: http://lgtm:4318
# OTEL_METRIC_EXPORT_INTERVAL: "5000" # so we don't have to wait 60s for metrics
# ports:
# - "8080:8080"
# depends_on:
# - lgtm
#
# python:
# build:
# context: ../python
# dockerfile: ../python/Dockerfile
# environment:
# OTEL_SERVICE_NAME: "rolldice"
# OTEL_EXPORTER_OTLP_ENDPOINT: http://lgtm:4317
# OTEL_METRIC_EXPORT_INTERVAL: "5000" # so we don't have to wait 60s for metrics
# ports:
# - "8082:8082"
# depends_on:
# - lgtm
23 changes: 6 additions & 17 deletions examples/ebpf-profiler/oats.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
# OATS is an acceptance testing framework for OpenTelemetry
# https://github.com/grafana/oats/tree/main/yaml
oats-schema-version: 2
docker-compose:
files:
- ./docker-compose.oats.yml
oats: 2
name: ebpf profiler captures rolldice profile symbols
seed:
type: app
Comment on lines +1 to +4
input:
- path: /rolldice
expected:
profiles:
# go
- query: 'process_cpu:cpu:nanoseconds:cpu:nanoseconds{"process.executable.name"=~"rolldice"}'
flamebearers:
equals: "main.rolldice"
# python and java are flaky
# - query: 'process_cpu:cpu:nanoseconds:cpu:nanoseconds{process_executable_name=~"python.*"}'
# flamebearers:
# # not very useful, because the python function names are not in the flamegraph
# contains: "python"
# - query: 'process_cpu:cpu:nanoseconds:cpu:nanoseconds{process_executable_name="java"}'
# flamebearers:
# contains: "void org.springframework.boot.SpringApplication.refreshContext(org.springframework.context.ConfigurableApplicationContext)"
match:
- name: main.rolldice
3 changes: 1 addition & 2 deletions examples/nodejs/docker-compose.oats.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
# OATS is an acceptance testing framework for OpenTelemetry
# https://github.com/grafana/oats/tree/main/yaml
version: "3.4"

services:
nodejs:
build:
context: .
context: ../../examples/nodejs
dockerfile: Dockerfile
environment:
OTEL_SERVICE_NAME: "dice-server"
Expand Down
24 changes: 12 additions & 12 deletions examples/nodejs/oats.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# OATS is an acceptance testing framework for OpenTelemetry
# https://github.com/grafana/oats/tree/main/yaml
oats-schema-version: 2
docker-compose:
files:
- ./docker-compose.oats.yml
oats: 2
name: nodejs rolldice emits traces metrics and logs
seed:
type: app
Comment on lines +1 to +4
Comment on lines +1 to +4
input:
- path: /rolldice?rolls=5
expected:
traces:
- traceql: '{ span.http.route = "/rolldice" }'
equals: "GET /rolldice"
attributes:
otel.library.name: "@opentelemetry/instrumentation-http"
match_spans:
- name: GET /rolldice
attributes:
otel.library.name: '@opentelemetry/instrumentation-http'
metrics:
- promql: 'dice_lib_rolls_counter_total{service_name="dice-server"}'
value: ">= 0"
- promql: dice_lib_rolls_counter_total{service_name="dice-server"}
value: '>= 0'
logs:
- logql: '{service_name="dice-server"} |~ `Received request to roll dice`'
equals: "Received request to roll dice"
match:
- name: Received request to roll dice
15 changes: 6 additions & 9 deletions examples/obi/docker-compose.oats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
# OATS is an acceptance testing framework for OpenTelemetry
# https://github.com/grafana/oats/tree/main/yaml
services:
Expand All @@ -12,6 +11,7 @@ services:

generate-traffic:
build:
context: ../../examples/obi
dockerfile: generate-traffic.Dockerfile
depends_on:
- java
Expand All @@ -20,37 +20,34 @@ services:
- go
- nodejs

# Uninstrumented applications — no OTel SDK, agent, or distro.
# OBI discovers and instruments them automatically via eBPF.

dotnet:
build:
context: ./dotnet
context: ../../examples/obi/dotnet
depends_on:
- lgtm

go:
build:
context: ./go
context: ../../examples/obi/go
depends_on:
- lgtm

java:
build:
context: ../java
context: ../../examples/java
dockerfile: ../obi/java.Dockerfile
depends_on:
- lgtm

nodejs:
build:
context: ./nodejs
context: ../../examples/obi/nodejs
depends_on:
- lgtm

python:
build:
context: ../python
context: ../../examples/python
dockerfile: ../obi/python.Dockerfile
depends_on:
- lgtm
38 changes: 16 additions & 22 deletions examples/obi/oats.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
---
# OATS is an acceptance testing framework for OpenTelemetry
# https://github.com/grafana/oats/tree/main/yaml
oats-schema-version: 2
docker-compose:
files:
- ./docker-compose.oats.yml
# No input: section — OATS only supports a single application port, but this
# test exercises 5 services on different ports. The generate-traffic sidecar
# sends requests to all services instead.
oats: 2
name: obi sidecar traffic yields spans and metrics across services
seed:
type: app
Comment on lines +1 to +4
expected:
traces:
# Java (port 8080) - reuses ../java source, no OTel agent
- traceql: '{ span.url.path = "/rolldice" && span.server.port = 8080 }'
equals: "GET /rolldice"
# Go (port 8081) - minimal source, no OTel SDK
match_spans:
- name: GET /rolldice
- traceql: '{ span.url.path = "/rolldice" && span.server.port = 8081 }'
equals: "GET /rolldice"
# Python (port 8082) - reuses ../python source, no opentelemetry-distro
match_spans:
- name: GET /rolldice
- traceql: '{ span.url.path = "/rolldice" && span.server.port = 8082 }'
equals: "GET /rolldice"
# .NET (port 8083) - minimal source, no OTel NuGet packages
match_spans:
- name: GET /rolldice
- traceql: '{ span.url.path = "/rolldice" && span.server.port = 8083 }'
equals: "GET /rolldice"
# Node.js (port 8084) - minimal source, no @opentelemetry/* packages
match_spans:
- name: GET /rolldice
- traceql: '{ span.url.path = "/rolldice" && span.server.port = 8084 }'
equals: "GET /rolldice"
match_spans:
- name: GET /rolldice
metrics:
- promql: 'http_server_request_duration_seconds_count{http_route="/rolldice"}'
value: "> 0"
- promql: http_server_request_duration_seconds_count{http_route="/rolldice"}
value: '> 0'
3 changes: 1 addition & 2 deletions examples/python/docker-compose.oats.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
# OATS is an acceptance testing framework for OpenTelemetry
# https://github.com/grafana/oats/tree/main/yaml
version: "3.4"

services:
python:
build:
context: .
context: ../../examples/python
dockerfile: Dockerfile
environment:
OTEL_SERVICE_NAME: "rolldice"
Expand Down
33 changes: 15 additions & 18 deletions examples/python/oats.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
# OATS is an acceptance testing framework for OpenTelemetry
# https://github.com/grafana/oats/tree/main/yaml
oats-schema-version: 2
docker-compose:
files:
- ./docker-compose.oats.yml
oats: 2
name: python rolldice emits traces metrics logs and lgtm readiness
seed:
type: app
Comment on lines +1 to +4
input:
- path: /rolldice
expected:
# this is checking that the health check is working
# this is usually not needed - because we check the functionality of the app
# but some cases are missing, e.g. that grafana is up and running
# We also check that this exact log line is present in the logs, which some users rely on
compose-logs:
- "The OpenTelemetry collector and the Grafana LGTM stack are up and running. (created /tmp/ready)"
custom-checks:
- script: ./scripts/check-lgtm-ready.sh
traces:
- traceql: '{ span.http.route = "/rolldice" }'
equals: "GET /rolldice"
attributes:
otel.library.name: opentelemetry.instrumentation.flask
match_spans:
- name: GET /rolldice
attributes:
otel.library.name: opentelemetry.instrumentation.flask
metrics:
- promql: 'http_server_active_requests{http_method="GET"}'
value: ">= 0"
- promql: http_server_active_requests{http_method="GET"}
value: '>= 0'
logs:
- logql: '{service_name="rolldice"} |~ `Anonymous player is rolling the dice.*`'
regexp: "Anonymous player is rolling the dice"
match:
- match_type: regexp
name: Anonymous player is rolling the dice
5 changes: 5 additions & 0 deletions examples/python/scripts/check-lgtm-ready.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
docker compose -f ../../ci/oats/docker-compose.lgtm.yml -f docker-compose.oats.yml logs lgtm |
grep -F "The OpenTelemetry collector and the Grafana LGTM stack are up and running. (created /tmp/ready)"
Comment on lines +4 to +5
Comment on lines +1 to +5
Loading
Loading