open-telemetry / opentelemetry-helm-charts

OpenTelemetry Helm Charts
https://opentelemetry.io
Apache License 2.0
394 stars 482 forks source link

not able to instrument in another namespace #1028

Open rahuks123 opened 9 months ago

rahuks123 commented 9 months ago

i have installed otel operator and collector using helm chart .link: https://github.com/open-telemetry/opentelemetry-helm-charts helm.sh/chart: opentelemetry-operator-0.34.0 i applied the values.yaml for both collector and operator in the namespace stk-sut and it created the respective pods for collector and operator. my application is in another namespace 'sut-application', but when i try to instrument this application by giving the annotations: instrumentation.opentelemetry.io/inject-java: "stk-sut/instrumentation" and deleted the pod, the pod which is regenerated does not show logs of instrumentation happening and in the operator logs of 'stk-sut' namespace, i am getting this below error:

msg":"failed to select an OpenTelemetry Instrumentation instance for this pod","namespace":"sut-application","name":"spring-petclinic-84547d97d7-6h2wc","error":"Instrumentation.opentelemetry.io \"instrumentation\" not found","stacktrace":"github.com/open-telemetry/opentelemetry-operator/pkg/instrumentation.(instPodMutator).Mutate\n\t/workspace/pkg/instrumentation/podmutator.go:87\ngithub.com/open-telemetry/opentelemetry-operator/internal/webhookhandler.(podSidecarInjector).Handle\n\t/workspace/internal/webhookhandler/webhookhandler.go:92\nsigs.k8s.io/controller-runtime/pkg/webhook/admission.(Webhook).Handle\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.15.0/pkg/webhook/admission/webhook.go:169\nsigs.k8s.io/controller-runtime/pkg/webhook/admission.(Webhook).ServeHTTP\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.15.0/pkg/webhook/admission/http.go:98\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerInFlight.func1\n\t/go/pkg/mod/github.com/prometheus/client_golang@v1.15.1/prometheus/promhttp/instrument_server.go:60\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2122\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1\n\t/go/pkg/mod/github.com/prometheus/client_golang@v1.15.1/prometheus/promhttp/instrument_server.go:147\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2122\ngithub.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2\n\t/go/pkg/mod/github.com/prometheus/client_golang@v1.15.1/prometheus/promhttp/instrument_server.go:109\nnet/http.HandlerFunc.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2122\nnet/http.(ServeMux).ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2500\nnet/http.serverHandler.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2936\nnet/http.(conn).serve\n\t/usr/local/go/src/net/http/server.go:1995"}

i have instrumented by 'stk-sut' namespace too :- kubectl get otelinst -n stk-sut NAME AGE ENDPOINT SAMPLER SAMPLER ARG instrumentation 5d1h http://opentelemetry-collector.stk-sut.svc.cluster.local:4318/ parentbased_traceidratio 1

could anyone tell me what i mistake i might have made.. thanks in advance

rahuks123 commented 8 months ago

i have used the latest charts now with version 0.92.1 but still same issue exists.

JaredTan95 commented 6 months ago

have you created your instrumentation CR? pls following https://github.com/open-telemetry/opentelemetry-operator?tab=readme-ov-file#opentelemetry-auto-instrumentation-injection

rahuldstk commented 5 months ago

hello @JaredTan95 it works now when i have used the latest operator for opentelemetry. but the last time i had the above issue was when i had used helm chart for the otel. not sure if that problem is still there though. thanks for the help!