From cecf06810fc86b383297b7838fd4bb43ff9fa01f Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 23 Jul 2026 13:34:17 +0000 Subject: [PATCH 1/2] test: validate OATS v0.8.0 consumer workflow Signed-off-by: Gregor Zeitlinger --- .mise/tasks/oats-tests.sh | 8 +-- .../extensions-minimal/oats/oats-case.yaml | 22 ++++++++ .../extensions-minimal/oats/oats.yaml | 21 -------- .../oats/oats-case.yaml | 25 +++++++++ .../oats/oats.yaml | 31 ----------- logging-k8s-stdout-otlp-json/k8s/lgtm.yaml | 5 ++ logging-k8s-stdout-otlp-json/oats-case.yaml | 20 +++++++ logging-k8s-stdout-otlp-json/oats.yaml | 53 ------------------- mise.toml | 3 +- oats-config.yaml | 8 +++ .../oats/oats-case.yaml | 22 ++++++++ .../oats/oats.yaml | 24 --------- 12 files changed, 108 insertions(+), 134 deletions(-) create mode 100644 doc-snippets/extensions-minimal/oats/oats-case.yaml delete mode 100644 doc-snippets/extensions-minimal/oats/oats.yaml create mode 100644 javaagent-declarative-configuration/oats/oats-case.yaml delete mode 100644 javaagent-declarative-configuration/oats/oats.yaml create mode 100644 logging-k8s-stdout-otlp-json/oats-case.yaml delete mode 100644 logging-k8s-stdout-otlp-json/oats.yaml create mode 100644 oats-config.yaml create mode 100644 spring-declarative-configuration/oats/oats-case.yaml delete mode 100644 spring-declarative-configuration/oats/oats.yaml diff --git a/.mise/tasks/oats-tests.sh b/.mise/tasks/oats-tests.sh index b8c96ec122..e6efa2d006 100755 --- a/.mise/tasks/oats-tests.sh +++ b/.mise/tasks/oats-tests.sh @@ -10,7 +10,7 @@ set -euo pipefail :opentelemetry-examples-logging-k8s-stdout-otlp-json:assemble \ :opentelemetry-examples-spring-declarative-configuration:bootJar -oats -timeout 5m doc-snippets/extensions-minimal/oats/ -oats -timeout 5m javaagent-declarative-configuration/oats/ -oats -timeout 5m logging-k8s-stdout-otlp-json/ -oats -timeout 5m spring-declarative-configuration/oats/ +oats \ + --config oats-config.yaml \ + --no-cache \ + --timeout=10m diff --git a/doc-snippets/extensions-minimal/oats/oats-case.yaml b/doc-snippets/extensions-minimal/oats/oats-case.yaml new file mode 100644 index 0000000000..c50a94c36c --- /dev/null +++ b/doc-snippets/extensions-minimal/oats/oats-case.yaml @@ -0,0 +1,22 @@ +name: extensions minimal traces custom processor attribute +fixture: + compose: + template: lgtm + file: ./docker-compose.yml +interval: 5s +seed: + type: app +input: + - path: /hello +expected: + traces: + - traceql: '{ span.http.route = "/hello" }' + match_spans: + - name: GET /hello + attributes: + - key: http.request.method + value: GET + - key: http.route + value: /hello + - key: custom.processor + value: active diff --git a/doc-snippets/extensions-minimal/oats/oats.yaml b/doc-snippets/extensions-minimal/oats/oats.yaml deleted file mode 100644 index b4d620b236..0000000000 --- a/doc-snippets/extensions-minimal/oats/oats.yaml +++ /dev/null @@ -1,21 +0,0 @@ -# OATS is an acceptance testing framework for OpenTelemetry - https://github.com/grafana/oats -oats-schema-version: 2 - -docker-compose: - files: - - ./docker-compose.yml - -input: - - path: /hello - -interval: 5000ms - -expected: - traces: - - traceql: '{ span.http.route = "/hello" }' - equals: "GET /hello" - attributes: - http.request.method: "GET" - http.route: "/hello" - # This custom attribute is added by MySpanProcessor - custom.processor: "active" diff --git a/javaagent-declarative-configuration/oats/oats-case.yaml b/javaagent-declarative-configuration/oats/oats-case.yaml new file mode 100644 index 0000000000..5b163aefcc --- /dev/null +++ b/javaagent-declarative-configuration/oats/oats-case.yaml @@ -0,0 +1,25 @@ +name: javaagent declarative config excludes actuator health traces +fixture: + compose: + template: lgtm + file: ./docker-compose.yml +seed: + type: app +input: + - path: /api/example + - path: /actuator/health + - path: /api/remote +expected: + traces: + - traceql: '{ span.http.route = "/api/example" }' + match_spans: + - name: GET /api/example + attributes: + - key: http.request.method + value: GET + - key: http.route + value: /api/example + - traceql: '{ span.http.route = "/actuator/health" }' + absent: true + - traceql: '{ span.peer.service = "example-backend" }' + count: '>= 1' diff --git a/javaagent-declarative-configuration/oats/oats.yaml b/javaagent-declarative-configuration/oats/oats.yaml deleted file mode 100644 index 92b91095a7..0000000000 --- a/javaagent-declarative-configuration/oats/oats.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# OATS is an acceptance testing framework for OpenTelemetry - https://github.com/grafana/oats -oats-schema-version: 2 - -docker-compose: - files: - - ./docker-compose.yml - -input: - # This endpoint should be traced normally - - path: /api/example - # This endpoint should NOT be traced (excluded by declarative config) - - path: /actuator/health - # This endpoint makes an outgoing client call, exercising the peer service mapping - - path: /api/remote - -expected: - traces: - # Verify that /api/example creates a trace with SERVER span - - traceql: '{ span.http.route = "/api/example" }' - equals: "GET /api/example" - attributes: - http.request.method: "GET" - http.route: "/api/example" - - traceql: '{ span.http.route = "/actuator/health" }' - count: - max: 0 - # Verify the outgoing client span is tagged with peer.service via the - # instrumentation.general.peer.service_mapping declarative config - - traceql: '{ span.peer.service = "example-backend" }' - count: - min: 1 diff --git a/logging-k8s-stdout-otlp-json/k8s/lgtm.yaml b/logging-k8s-stdout-otlp-json/k8s/lgtm.yaml index 4d535cc878..48e7711297 100644 --- a/logging-k8s-stdout-otlp-json/k8s/lgtm.yaml +++ b/logging-k8s-stdout-otlp-json/k8s/lgtm.yaml @@ -30,6 +30,10 @@ spec: protocol: TCP port: 3200 targetPort: 3200 + - name: pyroscope # needed for automated tests + protocol: TCP + port: 4040 + targetPort: 4040 --- apiVersion: apps/v1 kind: Deployment @@ -55,6 +59,7 @@ spec: - containerPort: 9090 # needed for automated tests - containerPort: 3100 # needed for automated tests - containerPort: 3200 # needed for automated tests + - containerPort: 4040 # needed for automated tests readinessProbe: exec: command: diff --git a/logging-k8s-stdout-otlp-json/oats-case.yaml b/logging-k8s-stdout-otlp-json/oats-case.yaml new file mode 100644 index 0000000000..6fdc298260 --- /dev/null +++ b/logging-k8s-stdout-otlp-json/oats-case.yaml @@ -0,0 +1,20 @@ +name: logging k8s stdout otlp json emits structured logs +fixture: + k3d: + k8s_dir: k8s + app_service: dice + app_docker_file: Dockerfile + app_docker_tag: dice:1.1-SNAPSHOT + app_port: 8080 +input: + - path: /rolldice +expected: + logs: + - logql: '{service_name="dice"} |~ `.*Anonymous player is rolling the dice:.*`' + regex: 'Anonymous player is rolling the dice: [0-9]+' + count: '>= 1' + - logql: '{service_name="dice"} |~ `.*simulating an error.*`' + contains: + - 'Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: java.lang.RuntimeException: simulating an error] with root cause' + - 'java.lang.RuntimeException: simulating an error' + count: '>= 1' diff --git a/logging-k8s-stdout-otlp-json/oats.yaml b/logging-k8s-stdout-otlp-json/oats.yaml deleted file mode 100644 index c3ab402cb1..0000000000 --- a/logging-k8s-stdout-otlp-json/oats.yaml +++ /dev/null @@ -1,53 +0,0 @@ -# OATS is an acceptance testing framework for OpenTelemetry - https://github.com/grafana/oats -oats-schema-version: 2 - -kubernetes: - dir: k8s - app-service: dice - app-docker-file: Dockerfile - app-docker-tag: dice:1.1-SNAPSHOT - app-docker-port: 8080 -input: - - path: /rolldice -expected: - logs: - - logql: '{service_name="dice"} |~ `.*Anonymous player is rolling the dice:.*`' - regexp: 'Anonymous player is rolling the dice: \d+' # uses formatted message - - logql: '{service_name="dice"} |~ `.*simulating an error.*`' - equals: 'Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: java.lang.RuntimeException: simulating an error] with root cause' - attributes: - deployment_environment: staging - exception_message: "simulating an error" - exception_type: "java.lang.RuntimeException" - scope_name: "org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet]" - service_name: dice - service_namespace: shop - service_version: 1.1 - severity_number: 17 - severity_text: SEVERE - attribute-regexp: - flags: ".*" # from loki - detected_level: ".*" # from loki - observed_timestamp: ".*" # from loki - # thread_name: ".*" # thread name is missing when there is an exception - has nothing to do with stdout logging - span_id: ".*" - trace_id: ".*" - host_arch: ".*" - host_name: ".*" - os_description: ".*" - os_type: ".*" - os_version: ".*" - process_command_args: ".*" - process_executable_path: ".*" - process_pid: ".*" - process_runtime_description: ".*" - process_runtime_name: ".*" - process_runtime_version: ".*" - service_instance_id: ".*" - telemetry_distro_name: ".*" - telemetry_distro_version: ".*" - telemetry_sdk_language: ".*" - telemetry_sdk_name: ".*" - telemetry_sdk_version: ".*" - exception_stacktrace: "java\\.lang\\.RuntimeException: simulating an error\n\tat io\\.opentelemetry\\.example\\.RollController\\.index\\(RollController\\.java:21\\)\n\t.*\n" - diff --git a/mise.toml b/mise.toml index 29fe9de49b..ba961fd228 100644 --- a/mise.toml +++ b/mise.toml @@ -1,5 +1,6 @@ [tools] -"aqua:grafana/oats" = "0.7.0" +"aqua:grafana/gcx" = "v0.5.0" +"aqua:grafana/oats" = "0.8.0" k3d = "5.8.3" kubectl = "1.36.2" diff --git a/oats-config.yaml b/oats-config.yaml new file mode 100644 index 0000000000..1353dbd9c6 --- /dev/null +++ b/oats-config.yaml @@ -0,0 +1,8 @@ +meta: + version: 3 + +cases: + - doc-snippets/extensions-minimal/oats/oats-case.yaml + - javaagent-declarative-configuration/oats/oats-case.yaml + - spring-declarative-configuration/oats/oats-case.yaml + - logging-k8s-stdout-otlp-json/oats-case.yaml diff --git a/spring-declarative-configuration/oats/oats-case.yaml b/spring-declarative-configuration/oats/oats-case.yaml new file mode 100644 index 0000000000..1532e54e20 --- /dev/null +++ b/spring-declarative-configuration/oats/oats-case.yaml @@ -0,0 +1,22 @@ +name: spring declarative config excludes actuator health traces +fixture: + compose: + template: lgtm + file: ./docker-compose.yml +seed: + type: app +input: + - path: /api/example + - path: /actuator/health +expected: + traces: + - traceql: '{ span.http.route = "/api/example" }' + match_spans: + - name: GET /api/example + attributes: + - key: http.request.method + value: GET + - key: http.route + value: /api/example + - traceql: '{ span.http.route = "/actuator/health" }' + absent: true diff --git a/spring-declarative-configuration/oats/oats.yaml b/spring-declarative-configuration/oats/oats.yaml deleted file mode 100644 index 4977b3acea..0000000000 --- a/spring-declarative-configuration/oats/oats.yaml +++ /dev/null @@ -1,24 +0,0 @@ -# OATS is an acceptance testing framework for OpenTelemetry - https://github.com/grafana/oats -oats-schema-version: 2 - -docker-compose: - files: - - ./docker-compose.yml - -input: - # This endpoint should be traced normally - - path: /api/example - # This endpoint should NOT be traced (excluded by declarative config) - - path: /actuator/health - -expected: - traces: - # Verify that /api/example creates a trace with SERVER span - - traceql: '{ span.http.route = "/api/example" }' - equals: "GET /api/example" - attributes: - http.request.method: "GET" - http.route: "/api/example" - - traceql: '{ span.http.route = "/actuator/health" }' - count: - max: 0 From d91c6cfe234dfd33ba92401c72ce5854865ecf35 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 23 Jul 2026 17:39:15 +0200 Subject: [PATCH 2/2] fix Signed-off-by: Gregor Zeitlinger --- .mise/tasks/oats-tests.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.mise/tasks/oats-tests.sh b/.mise/tasks/oats-tests.sh index e6efa2d006..78eb0f5683 100755 --- a/.mise/tasks/oats-tests.sh +++ b/.mise/tasks/oats-tests.sh @@ -10,7 +10,4 @@ set -euo pipefail :opentelemetry-examples-logging-k8s-stdout-otlp-json:assemble \ :opentelemetry-examples-spring-declarative-configuration:bootJar -oats \ - --config oats-config.yaml \ - --no-cache \ - --timeout=10m +oats --no-cache --timeout=10m .