-
Request for existing cases, user IDs, Portal navigation support and more
Request for existing cases, user IDs, Portal navigation support and more
Please verify if you are using the SAP Java Buildpack.
You can find information on how to use the SAP Java Buildpack here.
If you are using SAP Java Build Pack you do not need to perform the steps in section "Maven Setup".
If you are using the SAP Java Build pack:
{
"account": "<name of subaccount in which the instrumented application is running>",
"otel.logs.exporter": "none"
}
{
"account": "My_Account",
"otel.logs.exporter": "otlp",
"otel.metrics.exporter": "otlp",
"otel.traces.exporter": "otlp",
"otel.instrumentation.logback-appender.experimental.capture-code-attributes": "true",
"otel.instrumentation.logback-appender.experimental.capture-marker-attribute": "true",
"otel.instrumentation.logback-appender.experimental.capture-key-value-pair-attributes": "true",
"otel.experimental.resource.disabled-keys": "process.command_line,process.command_args,process.executable.path"
}
The OTEL parameters are described in the OpenTelemetry documentation:
If you are not using the SAP Java Buildpack include the dependency in your pom.xml:
<dependencies>
...
<dependency>
<groupId>io.opentelemetry.javaagent</groupId>
<artifactId>opentelemetry-javaagent</artifactId>
<version>2.11.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.sap.xdsr</groupId>
<artifactId>otel-agent-ext-java</artifactId>
<version>1.5.22</version>
<scope>runtime</scope>
</dependency>
...
</dependencies>
Add the following Java VM parameters via the mta.yaml:
modules:
- name: <MyService>
type: java
...
properties:
...
JBP_CONFIG_OPEN_JDK_JRE: "{ jre: { version: 11.+ }}"
JBP_CONFIG_JAVA_OPTS: "[java_opts: '-javaagent:BOOT-INF/lib/opentelemetry-javaagent-2.11.0.jar -Dotel.javaagent.enabled=true -Dotel.resource.attributes=account=<name of subaccount in which the instrumented application is running>,calmTenantId=<id of subaccount in which the instrumented application is running>,otel.poll.service.type=SAP_CP_CF -Dotel.service.name=MyService -Dotel.propagators=sapuniversal -Dotel.traces.exporter=none -Dotel.metrics.exporter=none -Dotel.logs.exporter=none -Dotel.javaagent.extensions=BOOT-INF/lib/otel-agent-ext-java-1.5.22.jar' -Dotel.instrumentation.spring-boot-actuator-autoconfigure.enabled=true]"
Make sure to replace the following placeholders in the parameter JBP_CONFIG_JAVA_OPTS:
Remarks:
FROM maven:<version> as builder
COPY . /usr/src/build
WORKDIR /usr/src/build
RUN mvn clean install
FROM openjdk:11
COPY --from=builder /usr/src/build/target/<application-jar-name> app.jar
RUN jar -xvf app.jar # Extract of the contents of application jar
EXPOSE <PORT>
ENTRYPOINT ["java","-jar","/app.jar"]
Reference the OTEL JARs from the BOOT-INF in the environment variable JAVA_OPTS
spec:
replicas: 1
selector:
matchLabels:
app.name: <app-name>
template:
metadata:
labels:
app.name: <app-name>
spec:
containers:
- env:
- name: _JAVA_OPTIONS
value: >
-javaagent:BOOT-INF/lib/opentelemetry-javaagent-2.11.0.jar
-Dotel.javaagent.extensions=BOOT-INF/lib/otel-agent-ext-java-1.5.22.jar
-Dotel.service.name=MyService
-Dotel.propagators=sapuniversal -Dotel.traces.exporter=none
-Dotel.metrics.exporter=none -Dotel.logs.exporter=none
-Dotel.instrumentation.spring-boot-actuator-autoconfigure.enabled=true