Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass "enable-go-instrumentation" flag to OpenTelemetry Operator?

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.

like image 319
Damian Avatar asked Oct 30 '25 10:10

Damian


1 Answers

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.

  1. Download the yaml
curl -O https://github.com/open-telemetry/opentelemetry-operator/releases/latest/download/opentelemetry-operator.yaml

  1. Edit the spec to include enable-go-instrumentation
...
    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
...
  1. Save and apply
kubectl apply -f my-modified-opentelemetry-operator.yaml
like image 144
Srikanth Chekuri Avatar answered Nov 01 '25 01:11

Srikanth Chekuri



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!