bug(EnvDetector): does not support otel resource attribute values containing spaces #3295
Closed
Description
What happened?
Steps to Reproduce
set any otel resource attribute to a value containing a space
export OTEL_RESOURCE_ATTRIBUTES='service.name="foo bar"'
Expected Result
I would expect the events sent to otel collector to would have the same attributes set in OTEL_RESOURCE_ATTRIBUTES
.
Actual Result
EnvDetector
throws the following error
EnvDetector failed: Attribute value should be a ASCII string with a length not exceed 255 characters.
and the otel resource attributes are not present on the events sent to the otel collector.
Additional Details
OpenTelemetry Setup Code
import { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api'
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node'
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'
import * as opentelemetry from '@opentelemetry/sdk-node'
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG)
const opentelemetrySDK = new opentelemetry.NodeSDK({
instrumentations: [
getNodeAutoInstrumentations({
'@opentelemetry/instrumentation-express': {
ignoreLayers: [/.*/],
},
'@opentelemetry/instrumentation-http': {
ignoreIncomingRequestHook: (request) => {
const ignoreIncomingRequestUrls = ['/ignore']
return ignoreIncomingRequestUrls.includes(request.url)
},
},
}),
],
traceExporter: new OTLPTraceExporter(),
})
opentelemetrySDK.start()
process.on('SIGTERM', () => {
opentelemetrySDK.shutdown().finally(() => process.exit(0))
})
package.json
{
"dependencies": {
"@opentelemetry/api": "1.2.0",
"@opentelemetry/auto-instrumentations-node": "0.31.2",
"@opentelemetry/exporter-trace-otlp-http": "0.28.0",
"@opentelemetry/sdk-node": "0.31.0"
}
}
Relevant log output
EnvDetector failed: Attribute value should be a ASCII string with a length not exceed 255 characters.