

In Java, the auto-instrumentation is called Javaagent and it does bytecode manipulation that injects instrumentation points to specific code paths. The reported spans can be viewed via kubectl logs deployment.apps/otel-collector.Īuto-instrumentation is rather a complicated piece of software, the implementation depends on the language. The spans should be reported to the OpenTelemetry collector. Now we can port-forward the application HTTP port via kubectl port-forward deployment.apps/spring-petclinic 8080:8080 and explore the application in WEB browser. kubectl apply -f - < The collector will log spans to the standard output.Ĭreate the following deployment: apiVersion: apps/v1 kind: Deployment metadata: name: spring-petclinic spec: selector: matchLabels: app: spring-petclinic replicas: 1 template: metadata: labels: app: spring-petclinic annotations: /inject: "true" /inject-java: "true" spec: containers: - name: app image: ghcr.io/pavolloffay/spring-petclinic:latestĪnd apply the instrumentation annotation: kubectl patch deployment.apps/spring-petclinic -p ''Īfter the annotation is applied the spring-petclinic pod will restart and the newly started pod will be instrumented with OpenTelemetry Java auto-instrumentation. Now let’s deploy the Spring Petclinic Java application that will be instrumented and report data to an OpenTelemetry collector. Auto code collector double down Patch#

The instrumentation is enabled when an Instrumentation CR is present in the cluster and a namespace or workload is annotated: kubectl apply -f - <
Auto code collector double down how to#
There are multiple approaches how to instrument and application:

Instrumentation is the most tedious process when deploying an observability solution.

In this article, I would like to introduce OpenTelemetry Operator’s new feature that significantly simplifies instrumenting workloads deployed on Kubernetes.
