|
| 1 | +--- |
| 2 | +title: 'OpenTelemetry auto-instrumentation injection' |
| 3 | +description: |
| 4 | + This page describes how to inject a auto-instrumentation image into your workload |
| 5 | +path: '/docs/getting-started/adot-eks-add-on/config-auto-instrumentation' |
| 6 | +--- |
| 7 | + |
| 8 | +## OpenTelemetry auto-instrumentation injection |
| 9 | + |
| 10 | +The ADOT EKS Add-on can inject and configure OpenTelemetry auto-instrumentation libraries. To enable this feature, you have to |
| 11 | +annotate your workload with: |
| 12 | + |
| 13 | +``` |
| 14 | +instrumentation.opentelemetry.io/inject-<language>: true |
| 15 | +``` |
| 16 | + |
| 17 | +Languages that support injection are: java, nodejs, python and dotnet. |
| 18 | + |
| 19 | +The annotation can be added to a namespace, so that all pods within that namespace will get instrumentation, or by adding |
| 20 | +the annotation to individual PodSpec objects, available as part of Deployment, Statefulset, and other resources. |
| 21 | + |
| 22 | +Example: |
| 23 | + |
| 24 | +``` |
| 25 | +apiVersion: apps/v1 |
| 26 | +kind: Deployment |
| 27 | +metadata: |
| 28 | + name: my-deployment-with-multiple-containers |
| 29 | +spec: |
| 30 | + selector: |
| 31 | + matchLabels: |
| 32 | + app: my-pod-with-multiple-containers |
| 33 | + replicas: 1 |
| 34 | + template: |
| 35 | + metadata: |
| 36 | + labels: |
| 37 | + app: my-pod-with-multiple-containers |
| 38 | + annotations: |
| 39 | + instrumentation.opentelemetry.io/inject-java: "true" |
| 40 | + spec: |
| 41 | + containers: |
| 42 | + - name: myapp |
| 43 | + image: myImage1 |
| 44 | +``` |
| 45 | + |
| 46 | +## Configuring the auto-instrumentation |
| 47 | + |
| 48 | +The `Instrumentation` custom resource definition (CRD) can be used to select the auto-instrumentation version that will be injected into the workload. The `Instrumentation` CRD can also be used to configure auto-instrumentation agents. For more information on how to configure auto-instrumentation injection please refer to the [OpenTelemetry Documentation](https://github.com/open-telemetry/opentelemetry-operator/tree/main#opentelemetry-auto-instrumentation-injection). |
| 49 | + |
| 50 | +In the `Instrumentation` CRD you can define the collector endpoint used to submit the telemetry data and the images used |
| 51 | +for each language: |
| 52 | + |
| 53 | +``` |
| 54 | +apiVersion: opentelemetry.io/v1alpha1 |
| 55 | +kind: Instrumentation |
| 56 | +metadata: |
| 57 | + name: my-instrumentation |
| 58 | +spec: |
| 59 | + exporter: |
| 60 | + endpoint: <endpoint> |
| 61 | + java: |
| 62 | + image: <image> |
| 63 | +``` |
| 64 | + |
| 65 | +Bellow we can find an example with the `endpoint` and `image` fields populated: |
| 66 | + |
| 67 | +``` |
| 68 | +apiVersion: opentelemetry.io/v1alpha1 |
| 69 | +kind: Instrumentation |
| 70 | +metadata: |
| 71 | + name: my-instrumentation |
| 72 | +spec: |
| 73 | + exporter: |
| 74 | + endpoint: http://adot-collector:4317 |
| 75 | + java: |
| 76 | + image: public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v1.28.0 |
| 77 | +``` |
| 78 | + |
| 79 | +In the example above, we are configuring the endpoint that will be used to submit the telemetry signals to `http://adot-collector:4317`. If the workload |
| 80 | +already has the `OTEL_EXPORTER_OTLP_ENDPOINT` environment defined, that will be used instead. In the example |
| 81 | +we are also configuring the version of the ADOT Java Agent that should be used to `public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v1.28.0`. |
| 82 | + |
| 83 | + |
| 84 | +For detailed information on the `Instrumentation` CRD please refer to the [OpenTelemetry Instrumentation Spec](https://github.com/open-telemetry/opentelemetry-operator/blob/main/docs/api.md#instrumentation). |
| 85 | + |
| 86 | +## [Previous Topic: Collector Configuration Introduction](/docs/getting-started/adot-eks-add-on/config-intro) |
| 87 | + |
| 88 | +## Related Topics: |
| 89 | + |
| 90 | +### [Collector Configuration for Amazon Managed Prometheus](/docs/getting-started/adot-eks-add-on/config-amp) |
| 91 | + |
| 92 | +### [Collector Configuration for AWS CloudWatch](/docs/getting-started/adot-eks-add-on/config-cloudwatch) |
| 93 | + |
| 94 | +### [Advanced Collector Configuration for Amazon Managed Prometheus](/docs/getting-started/adot-eks-add-on/config-advanced) |
| 95 | + |
| 96 | +## [Next Topic: Updating and Cleanup](/docs/getting-started/adot-eks-add-on/update-and-cleanup) |
0 commit comments