OpenTelemetry Agent - Containerized Java SpringBoot Installation



Installation Steps

  1. Modify the Application’s Deployment Manifest
  • In this example below, only new information relevant to the OpenTelemetry Agent is included in this Deployment Manifest
  • In this example, an Init Container would be added to the Manifest that already exists for the “my-app” Application
  • During the start of this Init Container, the OpenTelemetry Java Agent JAR is downloaded and placed on the Volume /otel-home shared by the Init Container and the Application Container
  • The OpenTelemetry Agent is hooked into the Application via the JAVA_TOOL_OPTIONS
  • Find-and-replace $PROTOCOL with http or https based on the VF Server configuration
  • Find-and-replace $VF_SERVER_ADDRESS with the URL for login to your organization’s vFunction Server
  • Find-and-replace $VF_APP_ID with the Application UUID created with the Installation Instructions provided after creating the Distributed Application in the vFunction Server UI
apiVersion: apps/v1
kind: Deployment
...
template:
  spec:
    initContainers:
    - name: otel-installer
      command:
      - sh
      - -c
      - |
        cd /otel-home \
        && wget -q https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar \        
      image: alpine:latest
      imagePullPolicy: IfNotPresent
      resources: {}
      volumeMounts:
      - mountPath: /otel-home
        name: otel-home
    containers:
    - name: my-app
      env:
      - name: JAVA_TOOL_OPTIONS
        value: "-javaagent:/otel-home/opentelemetry-javaagent.jar -Dotel.exporter.otlp.protocol=http/protobuf -Dotel.exporter.otlp.endpoint=$PROTOCOL://$VF_SERVER_ADDRESS/api/unauth/otlp -Dotel.traces.exporter=otlp -Dotel.exporter.otlp.traces.headers=X-VF-APP=$VF_APP_ID -Dotel.metrics.exporter=none -Dotel.logs.exporter=none"
      volumeMounts:
      - mountPath: /otel-home
        name: otel-home
        readOnly: true
    volumes:
    - emtpyDir:
      sizeLimit: 500Mi
      name: otel-home
  1. Build-and-Deploy your Application with the OpenTelemetry Agent hooked into the Application