Skip to content

pavolloffay/opentelemetry-instrumentation-operator

Repository files navigation

OpenTelemetry instrumentation operator

This project is POC/work in progress!

OpenTelemetry instrumentation operator injects OpenTelemetry auto instrumentation into deployment. For the configuration see instrumentation-cr.

Enable instrumentation

Right now the instrumentation CR has to be created in every namespace where instrumentation is enabled. Then label opentelemetry-inst-java=enabled has to be added on a workload or namespace.

Create the following CR in a namespace:

cat <<EOF | kubectl apply -f -
apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryInstrumentation
metadata:
  name: opentelemetry-instrumentation
spec:
  OTLPEndpoint: http://otel-collector.otel:4317
  javaagentImage: ghcr.io/pavolloffay/otel-javaagent:1.5.3
  tracesSampler: parentbased_traceidratio
  tracesSamplerArg: "1"
  resourceAttributes:
    environment: prod
EOF

Enable instrumentation for all applications in a namespace:

kubectl label namespace/default opentelemetry-inst-java=enabled

Enable instrumentation per workload

kubectl label deployment.apps/java-app opentelemetry-inst-java=enabled

List instrumented apps

kubectl get deployments -l opentelemetry-java-enabled=true

The status object will list instrumentations in the future.

List Instrumentation CRs

kubectl get opentelemetryinstrumentations 

About

OpenTelemetry instrumentation operator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages