Skip to content
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

bug(EnvDetector): does not support otel resource attribute values containing spaces #3295

Closed
anthony-telljohann opened this issue Oct 5, 2022 · 2 comments · Fixed by #3302
Assignees
Labels
bug Something isn't working priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect

Comments

@anthony-telljohann
Copy link
Contributor

anthony-telljohann commented Oct 5, 2022

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.
@anthony-telljohann anthony-telljohann added bug Something isn't working triage labels Oct 5, 2022
@anthony-telljohann anthony-telljohann changed the title bug(EnvDetector): does not support attribute values containing spaces bug(EnvDetector): does not support otel resource attribute values containing spaces Oct 5, 2022
@anthony-telljohann
Copy link
Contributor Author

I was able to figure out how to patch the bug. I am currently waiting on approval from my company to submit the patch. Once approved, I'll submit a PR.

@dyladan
Copy link
Member

dyladan commented Oct 5, 2022

lmk if you can't get approval and i'll open the pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority:p2 Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants