open-telemetry / open-telemetry/opentelemetry-ruby

`OTEL_RESOURCE_ATTRIBUTES` parsing has whitespace in keys

Open
#1,540 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug keep
Dominant language
Ruby
Stars
606
Forks
301
Avg merge
3d 19h
Merged PRs (30d)
42

Description

We run all of our services in Kubernetes, and define our open telemetry resource attributes like so:

            - name: OTEL_RESOURCE_ATTRIBUTES
              value: >
                service.name=redacted,
                service.version=redacted,
                k8s.node.name=$(KUBE_NODE_NAME),
                k8s.pod.name=$(KUBE_POD_NAME),
                k8s.pod.uid=$(KUBE_POD_ID),
                k8s.namespace.name=$(KUBE_NAMESPACE)

All of our other services (java, python) seem to split on "=" and then clean up whitespace in the key, but unfortunately the ruby library sends over service.version=redacted (note the whitespace in front of the key).

Looks like the problem is here: https://github.com/open-telemetry/opentelemetry-ruby/blob/main/sdk/lib/opentelemetry/sdk/resources/resource.rb#L47-L50

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in sdk/lib/opentelemetry/sdk/resources/resource.rb at the parsing logic around lines 47–50. Reproduce the issue with the multiline OTEL_RESOURCE_ATTRIBUTES value shown, then verify that parsed attribute keys do not retain leading whitespace. Done when the corrected parsing behavior is covered by the relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
observability
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.