Skip to content

Commit

Permalink
Merge pull request #132 from paketo-buildpacks/otel-2
Browse files Browse the repository at this point in the history
Update OpenTelemetry Java Agent to 2.4.0
  • Loading branch information
dmikusa authored Jun 6, 2024
2 parents 17e707d + d531e6b commit da1d720
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ At build time, the buildpack will do the following for Java applications:

* Contributes the OpenTelemetry Java agent to a layer and configures `$JAVA_TOOL_OPTIONS` to use it.
* By default, the agent is configured to be disabled (`OTEL_JAVAAGENT_ENABLED=false`).
* By default, the logs exporting feature of the agent is configured to be disabled (`OTEL_LOGS_EXPORTER=none`).
* By default, the metrics exporting feature of the agent is configured to be disabled (`OTEL_METRICS_EXPORTER=none`).

At run time, the buildpack will do the following for Java applications:
Expand All @@ -27,6 +28,7 @@ Once you enable the OpenTelemetry buildpack at build-time, you can configure it
By default, the following configuration is applied to the OpenTelemetry Java Agent at run time.

* `OTEL_JAVAAGENT_ENABLED=false`
* `OTEL_LOGS_EXPORTER=none`
* `OTEL_METRICS_EXPORTER=none`

When using a [binding](https://paketo.io/docs/howto/configuration/#bindings), key/values map directly to OpenTelemetry Java agent configuration properties. Keys can follow the environment variable format or the system property format, as described in the [project documentation](https://opentelemetry.io/docs/instrumentation/java/automatic/agent-config/).
Expand Down
14 changes: 7 additions & 7 deletions buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ api = "0.7"
name = "BP_OPENTELEMETRY_ENABLED"

[[metadata.dependencies]]
cpes = ["cpe:2.3:a:open-telemetry:opentelemetry-java-agent:1.32.0:*:*:*:*:*:*:*"]
cpes = ["cpe:2.3:a:open-telemetry:opentelemetry-java-agent:2.4.0:*:*:*:*:*:*:*"]
id = "opentelemetry-java"
name = "OpenTelemetry Java Agent"
purl = "pkg:generic/opentelemetry-java@1.32.0"
sha256 = "2a2af4c5e57de5e6f688b9921df5dda5cda4eda9626ee5f34ddc5852f84c45d0"
source = "https://github.com/open-telemetry/opentelemetry-java-instrumentation/archive/refs/tags/v1.32.0.tar.gz"
source-sha256 = "aee96dfc00b58847d247ee38e221c637ca2d69f3b7644f7c06b6b6fb275f86c2"
purl = "pkg:generic/opentelemetry-java@2.4.0"
sha256 = "99a3bbd05d2ee93bcbd169de7814fa46c9dfdea61661deb806c09d0e1c288a85"
source = "https://github.com/open-telemetry/opentelemetry-java-instrumentation/archive/refs/tags/v2.4.0.tar.gz"
source-sha256 = "1d3446e64538f3af0f78ff8c09481c2c52e5619e3bd7845aed92939cc9035933"
stacks = ["*"]
uri = "https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.32.0/opentelemetry-javaagent.jar"
version = "1.32.0"
uri = "https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v2.4.0/opentelemetry-javaagent.jar"
version = "2.4.0"

[[metadata.dependencies.licenses]]
type = "Apache-2.0"
Expand Down
1 change: 1 addition & 0 deletions opentelemetry/java_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func (j JavaAgent) Contribute(layer libcnb.Layer) (libcnb.Layer, error) {

layer.LaunchEnvironment.Appendf("JAVA_TOOL_OPTIONS", " ", "-javaagent:%s", file)
layer.LaunchEnvironment.Default("OTEL_JAVAAGENT_ENABLED", "false")
layer.LaunchEnvironment.Default("OTEL_LOGS_EXPORTER", "none")
layer.LaunchEnvironment.Default("OTEL_METRICS_EXPORTER", "none")

return layer, nil
Expand Down
1 change: 1 addition & 0 deletions opentelemetry/java_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func testJavaAgent(t *testing.T, context spec.G, it spec.S) {
Expect(layer.LaunchEnvironment["JAVA_TOOL_OPTIONS.append"]).To(Equal(fmt.Sprintf("-javaagent:%s",
filepath.Join(layer.Path, "stub-opentelemetry-java-agent.jar"))))
Expect(layer.LaunchEnvironment["OTEL_JAVAAGENT_ENABLED.default"]).To(Equal("false"))
Expect(layer.LaunchEnvironment["OTEL_LOGS_EXPORTER.default"]).To(Equal("none"))
Expect(layer.LaunchEnvironment["OTEL_METRICS_EXPORTER.default"]).To(Equal("none"))
})
}

0 comments on commit da1d720

Please sign in to comment.