Otel Java Agent kann nicht zum Sammler exportieren - Docker

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Otel Java Agent kann nicht zum Sammler exportieren - Docker

by Anonymous » 15 Feb 2025, 10:51

Ich leite JpetStore6 ohne Code Otel Java Agent und Otel Collector im selben Docker -Container aus. Alles beginnt, aber JPET kann keine Daten in den Sammler exportieren, obwohl sie sich im selben Docker-Container befinden. Eine separate Dienste. .0.2: 4317
Docker-Compose und Otel-Collector-Config sind im Stamm. p> docker-compose.yaml: < /p>

Code: Select all

services:
jpetstore:
container_name: jpetstore
build:
context: .
ports:
- 8080:8080
restart: always
environment:
- JAVA_TOOL_OPTIONS="-javaagent:/opentelemetry-javaagent.jar"
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:"http://otel-collector:4318/"
- OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:"http://otel-collector:4318/"
- OTEL_EXPORTER_OTLP_LOGS_ENDPOINT:"http://otel-collector:4318/"
volumes:
- ./src/lib/opentelemetry-javaagent.jar:/opentelemetry-javaagent.jar
depends_on:
- otel-collector

otel-collector:
image: otel/opentelemetry-collector-contrib:latest
command: ["--config=/otel-collector-config.yaml"]
volumes:
- ./otel-collector-config.yaml:/otel-collector-config.yaml
expose:
- "4317"
- "4318"
ports:
- "4317:4317"
- "4318:4318"
restart: always

< /code>
otel-collector-config < /p>
extensions:
zpages:
endpoint: "localhost:55679"
basicauth/grafana_cloud:
client_auth:
username: "MYUSERNAME"
password: "MYPASSWORD"

receivers:
otlp:
protocols:
grpc:
http:
hostmetrics:
scrapers:
cpu:
load:
memory:
docker_stats:
endpoint: unix:///var/run/docker.sock
collection_interval: 10s

processors:
batch:
resourcedetection:
detectors: ["env", "system"]
override: false
transform/drop_unneeded_resource_attributes:
error_mode: ignore
trace_statements:
- context: resource
statements:
- delete_key(attributes, "k8s.pod.start_time")
- delete_key(attributes, "os.description")
- delete_key(attributes, "os.type")
- delete_key(attributes, "process.command_args")
- delete_key(attributes, "process.executable.path")
- delete_key(attributes, "process.pid")
- delete_key(attributes, "process.runtime.description")
- delete_key(attributes, "process.runtime.name")
- delete_key(attributes, "process.runtime.version")
metric_statements:
- context: resource
statements:
- delete_key(attributes, "k8s.pod.start_time")
- delete_key(attributes, "os.description")
- delete_key(attributes, "os.type")
- delete_key(attributes, "process.command_args")
- delete_key(attributes, "process.executable.path")
- delete_key(attributes, "process.pid")
- delete_key(attributes, "process.runtime.description")
- delete_key(attributes, "process.runtime.name")
- delete_key(attributes, "process.runtime.version")
log_statements:
- context: resource
statements:
- delete_key(attributes, "k8s.pod.start_time")
- delete_key(attributes, "os.description")
- delete_key(attributes, "os.type")
- delete_key(attributes, "process.command_args")
- delete_key(attributes, "process.executable.path")
- delete_key(attributes, "process.pid")
- delete_key(attributes, "process.runtime.description")
- delete_key(attributes, "process.runtime.name")
- delete_key(attributes, "process.runtime.version")
transform/add_resource_attributes_as_metric_attributes:
error_mode: ignore
metric_statements:
- context: datapoint
statements:
- set(attributes["deployment.environment"], resource.attributes["deployment.environment"])
- set(attributes["service.version"], resource.attributes["service.version"])

exporters:
otlphttp/grafana_cloud:
endpoint: "https://otlp-gateway-prod-eu-west-2.grafana.net/otlp"
auth:
authenticator: basicauth/grafana_cloud
debug:
verbosity: detailed

service:
extensions: [basicauth/grafana_cloud, zpages]
pipelines:
traces:
receivers: [otlp]
processors: [resourcedetection, transform/drop_unneeded_resource_attributes, batch]
exporters: [otlphttp/grafana_cloud, debug]
metrics:
receivers: [otlp, hostmetrics]
processors: [resourcedetection, transform/drop_unneeded_resource_attributes, transform/add_resource_attributes_as_metric_attributes, batch]
exporters: [otlphttp/grafana_cloud, debug]
logs:
receivers: [otlp]
processors: [resourcedetection, transform/drop_unneeded_resource_attributes, batch]
exporters: [otlphttp/grafana_cloud, debug]
Ich nahm an, dass es ein Problem ist, dass der Agent versucht, Localhost zu erreichen, das nicht im Docker existiert, aber auch nach Überschreibung mit Umgebungen immer noch nichts.

Top