Skip to content

Commit

Permalink
fix declarative configuration in javaagent example
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydeluca committed Oct 18, 2024
1 parent 34340b1 commit 447c64c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion javaagent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ FROM eclipse-temurin:11-jre
ADD build/libs/app.jar /app.jar
ADD build/agent/opentelemetry-javaagent.jar /opentelemetry-javaagent.jar

ENTRYPOINT java -jar -javaagent:/opentelemetry-javaagent.jar /app.jar
ENTRYPOINT java -javaagent:/opentelemetry-javaagent.jar -jar /app.jar
2 changes: 1 addition & 1 deletion javaagent/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies {
//spring modules
implementation("org.springframework.boot:spring-boot-starter-web")

agent("io.opentelemetry.javaagent:opentelemetry-javaagent:2.8.0")
agent("io.opentelemetry.javaagent:opentelemetry-javaagent:2.9.0")
}

val copyAgent = tasks.register<Copy>("copyAgent") {
Expand Down
3 changes: 2 additions & 1 deletion javaagent/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ services:
OTEL_LOGS_EXPORTER: "otlp"
# Optional specify file configuration instead of using environment variable scheme
# To use, call "export OTEL_CONFIG_FILE=/sdk-config.yaml" before calling docker compose up
OTEL_CONFIG_FILE:
OTEL_EXPERIMENTAL_CONFIG_FILE: /sdk-config.yaml
ports:
- "8080:8080"
volumes:
- ./sdk-config.yaml:/sdk-config.yaml
depends_on:
- collector

collector:
image: otel/opentelemetry-collector-contrib:0.111.0
volumes:
Expand Down
9 changes: 5 additions & 4 deletions javaagent/sdk-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,31 @@ file_format: "0.1"

resource:
attributes:
service.name: agent-example-app
- name: service.name
value: agent-example-app

logger_provider:
processors:
- batch:
exporter:
otlp:
endpoint: http://collector:4318
endpoint: http://collector:4318/v1/logs
protocol: http/protobuf

tracer_provider:
processors:
- batch:
exporter:
otlp:
endpoint: http://collector:4318
endpoint: http://collector:4318/v1/traces
protocol: http/protobuf

meter_provider:
readers:
- periodic:
exporter:
otlp:
endpoint: http://collector:4318
endpoint: http://collector:4318/v1/metrics
protocol: http/protobuf
# Example of how to use view to drop a metric which isn't needed.
# This configuration is not available with the environment variable configuration scheme.
Expand Down

0 comments on commit 447c64c

Please sign in to comment.