Skip to content

Commit

Permalink
chore: support and use the default http/protobuf protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
smoke committed Oct 17, 2024
1 parent 0997ec5 commit 8daa9fe
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
6 changes: 5 additions & 1 deletion javaagent-log-appender/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ In a separate shell, run the application
```shell
export \
OTEL_SERVICE_NAME=log4j-example \
OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
OTEL_METRICS_EXPORTER=none \
OTEL_TRACES_EXPORTER=none \
OTEL_LOGS_EXPORTER=otlp
Expand All @@ -48,3 +47,8 @@ OTEL_LOGS_EXPORTER=otlp
```

Watch the collector logs to see exported log records

NOTE: The OpenTelemetry Java Agent uses `http/protobuf` by default, optionally switch to use `grpc` protocol
```shell
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
```
2 changes: 1 addition & 1 deletion javaagent-log-appender/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies {
implementation("io.opentelemetry:opentelemetry-api")
implementation("io.opentelemetry.semconv:opentelemetry-semconv")

// OpenTelemetry JavaAgent, this brings its own standalone log4j / logback appenders
// OpenTelemetry Java Agent, this brings its own standalone log4j / logback appenders
agent("io.opentelemetry.javaagent:opentelemetry-javaagent:2.8.0")
}

Expand Down
1 change: 1 addition & 0 deletions javaagent-log-appender/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ services:
command: ["--config=/otel-config.yaml"]
ports:
- "4317:4317"
- "4318:4318"
8 changes: 5 additions & 3 deletions javaagent-log-appender/otel-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@ receivers:
protocols:
grpc:
endpoint: collector:4317
http:
endpoint: "0.0.0.0:4318"
exporters:
debug:
verbosity: detailed
nop:
service:
pipelines:
logs:
metrics:
receivers: [otlp]
exporters: [debug]
traces:
receivers: [otlp]
exporters: [debug]
metrics:
logs:
receivers: [otlp]
exporters: [nop]
exporters: [debug]

0 comments on commit 8daa9fe

Please sign in to comment.