Can I use resource detectors combined with some custom resource attributes? #5717
-
|
I need to use a resource detector while also specifying some resource attributes manually, can I use both of const sdk = new opentelemetry.NodeSDK({
resourceDetectors: [dockerCGroupV1Detector],
resource: resourceFromAttributes({
[ SEMRESATTRS_SERVICE_NAME ]: process.env.SERVICE_NAME,
[ SEMRESATTRS_SERVICE_INSTANCE_ID ]: randomUUID(),
})
}); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
you can use both. 🙂 If you need to change the precedence, please use |
Beta Was this translation helpful? Give feedback.
you can use both. 🙂
The explicit resource you passed will take precedence over the one from the detectors.
If you need to change the precedence, please use
detectResources()from@opentelemetry/resourcesandResource#merge()on resulting resource to merge them according to your preferred precedence :)