Skip to content

Latest commit

 

History

History
49 lines (46 loc) · 1.35 KB

README.md

File metadata and controls

49 lines (46 loc) · 1.35 KB

Opentelemtry Java Agent

This repository contains the Dockerfiles to build a containerized version of the Open Telemetry Java Agent. The image is intended to be used as a Kubernetes init container to instrument a java application without changing the actual java image. Builds are provided on Dockerhub.

Example Usage

apiVersion: apps/v1
kind: Deployment
metadata:
  name: example
  labels:
    app: example
spec:
  replicas: 1
  selector:
    matchLabels:
      app: example
  template:
    metadata:
      labels:
        app: example
    spec:
      containers:
      - name: application
        image: my-application
        args:
          - "-javaagent:/mnt/otel/opentelemetry-javaagent.jar"
          - "-jar"
          - "path-to-my.jar"
        ports:
        - name: application
          containerPort: 8080
        volumeMounts:        
        - name: otel
          mountPath: /mnt/otel
      initContainers:      
      - name: otel
        command: ["sh", "-c", "cp /app/opentelemetry-javaagent.jar /mnt/otel/opentelemetry-javaagent.jar"]
        image: "demtag/otel-javaagent:1.24"
        volumeMounts:
        - name: otel
          mountPath: /mnt/otel
      volumes:        
        - name: otel
          emptyDir: {}