# Enhance Go apps with OTel auto-instrumentation If you don't want to manually change the application code, you can try This page's eBPF-based automatic enhancement method. This feature is currently in the review stage of donating to the OpenTelemetry community, and does not support Operator injection through annotations (it will be supported in the future), so you need to manually change the Deployment YAML or use a patch. ## Prerequisites Make sure Insight Agent is ready. If not, see [Install insight-agent to collect data](../install/install-agent.md) and make sure the following three items are in place: - Enable trace feature for Insight-agent - Whether the address and port of the trace data are filled in correctly - Pods corresponding to deployment/opentelemetry-operator-controller-manager and deployment/insight-agent-opentelemetry-collector are ready ## Install Instrumentation CR Install under the Insight-system namespace, skip this step if it has already been installed. Note: This CR currently only supports the injection of environment variables (including service name, link reporting address, etc.) required to connect to Insight, and will support the injection of Golang probes in the future. ```bash kubectl apply -f - <- http://insight-agent-opentelemetry-collector.insight-system.svc.cluster.local:4317 - name: OTEL_EXPORTER_OTLP_TIMEOUT value: '200' - name: SPLUNK_TRACE_RESPONSE_HEADER_ENABLED value: 'true' - name: OTEL_SERVICE_NAME value: voting - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME valueFrom: fieldRef: apiVersion: v1 fieldPath: metadata.name - name: OTEL_RESOURCE_ATTRIBUTES_POD_UID valueFrom: fieldRef: apiVersion: v1 fieldPath: metadata.uid - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME valueFrom: fieldRef: apiVersion: v1 fieldPath: spec.nodeName - name: OTEL_PROPAGATORS value: jaeger,b3 - name: OTEL_TRACES_SAMPLER value: always_on - name: OTEL_RESOURCE_ATTRIBUTES value: >- k8s.container.name=voting-svc,k8s.deployment.name=voting,k8s.deployment.uid=79e015e2-4643-44c0-993c-e486aebaba10,k8s.namespace.name=default,k8s.node.name=$(OTEL_RESOURCE_ATTRIBUTES_NODE_NAME),k8s.pod.name=$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME),k8s.pod.uid=$(OTEL_RESOURCE_ATTRIBUTES_POD_UID),k8s.replicaset.name=voting-84b696c897,k8s.replicaset.uid=63f56167-6632-415d-8b01-43a3db9891ff resources: requests: cpu: 100m volumeMounts: - name: launcherdir mountPath: /odigos-launcher - name: kube-api-access-gwj5v readOnly: true mountPath: /var/run/secrets/kubernetes.io/serviceaccount terminationMessagePath: /dev/termination-log terminationMessagePolicy: File imagePullPolicy: IfNotPresent - name: emojivoto-voting-instrumentation image: keyval/otel-go-agent:v0.6.0 env: - name: OTEL_TARGET_EXE value: /usr/local/bin/emojivoto-voting-svc - name: OTEL_EXPORTER_OTLP_ENDPOINT value: jaeger:4317 - name: OTEL_SERVICE_NAME value: emojivoto-voting resources: {} volumeMounts: - name: kernel-debug mountPath: /sys/kernel/debug - name: kube-api-access-gwj5v readOnly: true mountPath: /var/run/secrets/kubernetes.io/serviceaccount terminationMessagePath: /dev/termination-log terminationMessagePolicy: File imagePullPolicy: IfNotPresent securityContext: capabilities: add: - SYS_PTRACE privileged: true runAsUser: 0 ······ ``` ## Reference - [Getting Started with Go OpenTelemetry Automatic Instrumentation](https://github.com/keyval-dev/opentelemetry-go-instrumentation/blob/master/docs/getting-started/README.md) - [Donating ebpf based instrumentation](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/4)