I am trying to instrument sample Go application with OTel Auto-instrumentation, however when I am running kubectl logs -l app.kubernetes.io/name=opentelemetry-operator --container manager -n opentelemetry-operator-system --follow
it returns:
{"level":"ERROR", timestamp:"2024-06-02T14:58:46.515432187Z","message":"support for Go auto instrumentation is not enabled","namespace":"default"}.
According to the OTel Docs:
If you want to use Go auto-instrumentation, you need to enable the feature gate. See Controlling Instrumentation Capabilities for details.
Hence, I am assuming that my issue is related to this link https://github.com/open-telemetry/opentelemetry-operator?tab=readme-ov-file#controlling-instrumentation-capabilities, however it is not clear how to set enable-go-instrumentation flag as true.
As we can see from the code here https://github.com/open-telemetry/opentelemetry-operator/blob/db1598095161ea75389165ee374f05fb46ee4bf3/main.go#L153, it is a command line flag for the operator. Here is how I would enable it.
curl -O https://github.com/open-telemetry/opentelemetry-operator/releases/latest/download/opentelemetry-operator.yaml
...
spec:
containers:
- args:
- --metrics-addr=127.0.0.1:8080
- --enable-leader-election
- --zap-log-level=info
- --zap-time-encoding=rfc3339nano
- --enable-nginx-instrumentation=true
- --enable-go-instrumentation=true
env:
- name: SERVICE_ACCOUNT_NAME
valueFrom:
fieldRef:
fieldPath: spec.serviceAccountName
image: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.101.0
...
kubectl apply -f my-modified-opentelemetry-operator.yaml