-
Notifications
You must be signed in to change notification settings - Fork 807
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* use otel autoconfig Signed-off-by: Gregor Zeitlinger <[email protected]> * add oats test Signed-off-by: Gregor Zeitlinger <[email protected]> * add oats test Signed-off-by: Gregor Zeitlinger <[email protected]> * add oats test Signed-off-by: Gregor Zeitlinger <[email protected]> * add oats test Signed-off-by: Gregor Zeitlinger <[email protected]> * add oats test Signed-off-by: Gregor Zeitlinger <[email protected]> * add oats test Signed-off-by: Gregor Zeitlinger <[email protected]> * extra project for otel resource attributes Signed-off-by: Gregor Zeitlinger <[email protected]> * extra project for otel resource attributes Signed-off-by: Gregor Zeitlinger <[email protected]> * extra project for otel resource attributes Signed-off-by: Gregor Zeitlinger <[email protected]> * add otel tests Signed-off-by: Gregor Zeitlinger <[email protected]> * release automation Signed-off-by: Gregor Zeitlinger <[email protected]> --------- Signed-off-by: Gregor Zeitlinger <[email protected]>
- Loading branch information
1 parent
6f4793c
commit 38188b9
Showing
28 changed files
with
932 additions
and
509 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: OpenTelemetry Acceptance Tests | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
acceptance-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Check out oats | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: grafana/oats | ||
ref: 7cd5ca42fff009fd67ea986d42c79134ac99ae48 | ||
path: oats | ||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: 17 | ||
distribution: temurin | ||
cache: 'maven' | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.23' | ||
cache-dependency-path: oats/go.sum | ||
- name: Run the Maven verify phase | ||
run: | | ||
./mvnw clean install -DskipTests | ||
- name: Run acceptance tests | ||
run: ./scripts/run-acceptance-tests.sh | ||
- name: upload log file | ||
uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: docker-compose.log | ||
path: oats/yaml/build/**/*.log |
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
9 changes: 9 additions & 0 deletions
9
examples/example-exporter-opentelemetry/oats-tests/agent/Dockerfile
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,9 @@ | ||
FROM eclipse-temurin:21-jre | ||
|
||
COPY target/example-exporter-opentelemetry.jar ./app.jar | ||
# check that the resource attributs from the agent are used, epsecially the service.instance.id should be the same | ||
ADD --chmod=644 https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v2.8.0/opentelemetry-javaagent.jar /usr/src/app/opentelemetry-javaagent.jar | ||
ENV JAVA_TOOL_OPTIONS=-javaagent:/usr/src/app/opentelemetry-javaagent.jar | ||
|
||
#ENTRYPOINT [ "java", "-Dotel.javaagent.debug=true","-jar", "./app.jar" ] # for debugging | ||
ENTRYPOINT [ "java", "-jar", "./app.jar" ] |
13 changes: 13 additions & 0 deletions
13
examples/example-exporter-opentelemetry/oats-tests/agent/docker-compose.yml
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,13 @@ | ||
# OATS is an acceptance testing framework for OpenTelemetry - https://github.com/grafana/oats/tree/main/yaml | ||
version: '3.4' | ||
|
||
services: | ||
java: | ||
build: | ||
context: ../.. | ||
dockerfile: oats-tests/agent/Dockerfile | ||
environment: | ||
OTEL_SERVICE_NAME: "rolldice" | ||
OTEL_EXPORTER_OTLP_ENDPOINT: http://lgtm:4317 | ||
OTEL_EXPORTER_OTLP_PROTOCOL: grpc | ||
OTEL_METRIC_EXPORT_INTERVAL: "5000" # so we don't have to wait 60s for metrics |
12 changes: 12 additions & 0 deletions
12
examples/example-exporter-opentelemetry/oats-tests/agent/oats.yaml
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,12 @@ | ||
# OATS is an acceptance testing framework for OpenTelemetry - https://github.com/grafana/oats/tree/main/yaml | ||
docker-compose: | ||
generator: docker-lgtm | ||
files: | ||
- ./docker-compose.yml | ||
expected: | ||
custom-checks: | ||
- script: ./service-instance-id-check.py | ||
metrics: | ||
- promql: 'uptime_seconds_total{}' | ||
value: '>= 0' | ||
|
33 changes: 33 additions & 0 deletions
33
examples/example-exporter-opentelemetry/oats-tests/agent/service-instance-id-check.py
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,33 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# This script is used to check if the service instance id is present in the exported data | ||
# The script will return 0 if the service instance id is present in the exported data | ||
|
||
from urllib.request import urlopen | ||
import urllib.parse | ||
import json | ||
|
||
url = ' http://localhost:9090/api/v1/label/instance/values' | ||
res = json.loads(urlopen(url).read().decode('utf-8')) | ||
|
||
values = list(res['data']) | ||
print(values) | ||
|
||
if "localhost:8888" in values: | ||
values.remove("localhost:8888") | ||
|
||
# both the agent and the exporter should report the same instance id | ||
assert len(values) == 1 | ||
|
||
path = 'target_info{instance="%s"}' % values[0] | ||
path = urllib.parse.quote_plus(path) | ||
url = 'http://localhost:9090/api/v1/query?query=%s' % path | ||
res = json.loads(urlopen(url).read().decode('utf-8')) | ||
|
||
infos = res['data']['result'] | ||
print(infos) | ||
|
||
# they should not have the same target info | ||
# e.g. only the agent has telemetry_distro_name | ||
assert len(infos) == 2 | ||
|
5 changes: 5 additions & 0 deletions
5
examples/example-exporter-opentelemetry/oats-tests/http/Dockerfile
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,5 @@ | ||
FROM eclipse-temurin:21-jre | ||
|
||
COPY target/example-exporter-opentelemetry.jar ./app.jar | ||
|
||
ENTRYPOINT [ "java", "-jar", "./app.jar" ] |
13 changes: 13 additions & 0 deletions
13
examples/example-exporter-opentelemetry/oats-tests/http/docker-compose.yml
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,13 @@ | ||
# OATS is an acceptance testing framework for OpenTelemetry - https://github.com/grafana/oats/tree/main/yaml | ||
version: '3.4' | ||
|
||
services: | ||
java: | ||
build: | ||
context: ../.. | ||
dockerfile: oats-tests/http/Dockerfile | ||
environment: | ||
OTEL_SERVICE_NAME: "rolldice" | ||
OTEL_EXPORTER_OTLP_ENDPOINT: http://lgtm:4318 | ||
OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf | ||
OTEL_METRIC_EXPORT_INTERVAL: "5000" # so we don't have to wait 60s for metrics |
10 changes: 10 additions & 0 deletions
10
examples/example-exporter-opentelemetry/oats-tests/http/oats.yaml
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,10 @@ | ||
# OATS is an acceptance testing framework for OpenTelemetry - https://github.com/grafana/oats/tree/main/yaml | ||
docker-compose: | ||
generator: docker-lgtm | ||
files: | ||
- ./docker-compose.yml | ||
expected: | ||
metrics: | ||
- promql: 'uptime_seconds_total{}' | ||
value: '>= 0' | ||
|
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,67 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.prometheus</groupId> | ||
<artifactId>client_java</artifactId> | ||
<version>0.0.1-releasetest1</version> | ||
</parent> | ||
|
||
<artifactId>otel-agent-resources</artifactId> | ||
<packaging>bundle</packaging> | ||
|
||
<name>OpenTelemetry Agent Resource Extractor</name> | ||
<description> | ||
Reads the OpenTelemetry Agent resources the GlobalOpenTelemetry instance | ||
</description> | ||
|
||
<properties> | ||
<automatic.module.name>io.prometheus.otel.resource.attributes</automatic.module.name> | ||
<!-- don't update with dependabot, the Otel agent can handle older versions --> | ||
<otel-dynamic-load.version>1.29.0</otel-dynamic-load.version> | ||
</properties> | ||
|
||
<dependencies> | ||
</dependencies> | ||
|
||
<build> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
</resource> | ||
</resources> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>copy</id> | ||
<phase>validate</phase> | ||
<goals> | ||
<goal>copy</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<artifactItems> | ||
<artifactItem> | ||
<groupId>io.opentelemetry</groupId> | ||
<artifactId>opentelemetry-api</artifactId> | ||
<version>${otel-dynamic-load.version}</version> | ||
<outputDirectory>${project.basedir}/src/main/resources/lib/</outputDirectory> | ||
</artifactItem> | ||
<artifactItem> | ||
<groupId>io.opentelemetry</groupId> | ||
<artifactId>opentelemetry-context</artifactId> | ||
<version>${otel-dynamic-load.version}</version> | ||
<outputDirectory>${project.basedir}/src/main/resources/lib/</outputDirectory> | ||
</artifactItem> | ||
</artifactItems> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
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
File renamed without changes.
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
Oops, something went wrong.