Skip to content

reporter: emit semconv resource attributes on OTLP output - #3242

Merged
gnurizen merged 1 commit into
mainfrom
otlp-semconv-resource-attrs
Oct 12, 2026
Merged

gnurizen merged 1 commit into
mainfrom
otlp-semconv-resource-attrs

Conversation

@gnurizen

@gnurizen gnurizen commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

The OTLP/profiles builder copied parca-agent's resource labels verbatim, so a
consumer saw comm and node instead of semantic convention keys, and
k8s.node.name only appeared if the operator used the relabel example in
config/examples/otlp-semconv-k8s.yaml (and then only for pod processes).

Changes (OTLP output only; arrow backends unchanged)

parca-agent label OTLP attribute
comm (resource) process.executable.name — the key upstream's OTLP reporter uses for comm
node (resource) dropped — host.name already carries --node
— k8s.node.name from --node, when KUBERNETES_SERVICE_HOST is set
cpu (sample) cpu.logical_number (int) — already the case; now pinned by a test
  • A relabel rule that sets process.executable.name or k8s.node.name
    explicitly still overrides the default. The example config keeps its
    process.executable.name rule, now documented as replacing the truncated
    comm with the full executable basename, and drops its k8s.node.name rule.
  • metadata.InKubernetes() is the existing KUBERNETES_SERVICE_HOST check,
    exported so the builder and the container metadata provider share it.
  • k8s.node.name is set on every resource, host processes included: in a
    cluster --node must match the Kubernetes node name.

Testing

  • go test ./reporter/..., including the new TestPprofileSemconvResourceAttrs
    (comm rename, explicit override, node dropped, in/out of cluster).
  • Not yet checked against a live collector.

The OTLP/profiles builder copied parca-agent's resource labels verbatim, so
consumers saw `comm` and `node` rather than semantic convention keys, and
`k8s.node.name` only appeared with a relabel config.

- `comm` is emitted as `process.executable.name`, matching upstream's OTLP
  reporter. A relabel rule targeting that key still wins.
- `node` is dropped: `host.name` already carries --node.
- `k8s.node.name` is set from --node when running in Kubernetes
  (KUBERNETES_SERVICE_HOST set), for every process on the node.

The per-sample `cpu` label was already emitted as `cpu.logical_number`; a
test now pins that no bare `cpu` key reaches OTLP. The arrow backends are
unchanged.
@gnurizen
gnurizen requested a review from brancz October 11, 2026 20:04
@gnurizen
gnurizen marked this pull request as ready for review October 11, 2026 20:04
@brancz

brancz commented Oct 12, 2026

Copy link
Copy Markdown
Member

cpu.logical_number (int) — already the case; now pinned by a test

I don't see this one.

@gnurizen

Copy link
Copy Markdown
Contributor Author

We already emit cpu.logical_number so no change was needed.

@gnurizen
gnurizen merged commit 4963005 into main Oct 12, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants