-
Notifications
You must be signed in to change notification settings - Fork 454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node.js resource detectors can't be disabled with OTEL_NODE_RESOURCE_DETECTORS
#2626
Comments
OTEL_NODE_RESOURCE_DETECTORS
You should add that to the otelins resource like this as the one on the pod/container will be overwritten: apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
metadata:
name: my-instrumentation
spec:
exporter:
endpoint: http://otel-collector:4317
...
nodejs:
env:
- name: OTEL_NODE_RESOURCE_DETECTORS
value: env,host,os,process,container |
I've tried that too, still doesn't take effect. See open-telemetry/opentelemetry-js-contrib#1780 (comment). |
I did this in my cluster and it worked. Are you using the latest version of the operator? |
Stumbled upon this one today and can confirm that this is a real issue. Modifying
Since SDK will check |
Is this as simple as changing the affected lines to use the env util? const sdk = new NodeSDK({
autoDetectResources: true,
instrumentations: [getNodeAutoInstrumentations()],
traceExporter: new OTLPTraceExporter(),
metricReader: getMetricReader(),
resourceDetectors: getResourceDetectorsFromEnv()
}); |
Any news on this issue? |
Signed-off-by: matteo.gazzetta <[email protected]>
Component(s)
instrumentation
What happened?
Description
The Node.js auto-instrumentation includes a series of cloud provider resource detectors which cannot be toggled off. I'm running on AKS, so the instrumentation keeps attempting to retrieve metadata related to other cloud providers (for example, calling the API server on
https://kubernetes.default.svc/api/v1/namespaces/kube-system/configmaps/aws-auth
), but this naturally fails because the metadata doesn't exist.The auto-instrumentations-node package exposes
OTEL_NODE_RESOURCE_DETECTORS
to give users control over which resource detectors to use, but here in the Operator, since all resource detectors are hardcoded when instantiating the SDK, this variable has no effect.opentelemetry-operator/autoinstrumentation/nodejs/src/autoinstrumentation.ts
Lines 49 to 55 in c10fe8a
Steps to Reproduce
instrumentation.opentelemetry.io/inject-nodejs: "my-instrument"
OTEL_LOG_LEVEL="debug"
OTEL_NODE_RESOURCE_DETECTORS="env,host,os,process,container"
on the application to try and exclude cloud-specific resource detectorsExpected Result
OTEL_NODE_RESOURCE_DETECTORS
should work as per https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/metapackages/auto-instrumentations-node/README.md#usage-auto-instrumentationActual Result
OTEL_NODE_RESOURCE_DETECTORS
has no effectKubernetes Version
1.26.6
Operator version
0.92.1
Collector version
0.92.0
Environment information
Environment
AKS
Log output
Additional context
Originally posted in open-telemetry/opentelemetry-js-contrib#1780
The text was updated successfully, but these errors were encountered: