lib/protoparser/opentelemetry: support disable scope and resource attributes label promotions
commit c3525bf ↗ · VictoriaMetrics/VictoriaMetrics · · committed May 26, 2026 · +299−19 · base 9e4bfebb7439
Agent prompt
what a new run launched now would send
When ingesting OpenTelemetry metrics, VictoriaMetrics currently always promotes OTel instrumentation scope metadata (name, version, schema URL, attributes) and all resource attributes onto the resulting metric labels. Users need Prometheus-compatible control over that promotion so they can turn scope-metadata promotion off, promote only selected resource attributes, or promote all resource attributes except an ignore list—without changing the default behavior for existing deployments.
Add command-line flags (usable on vmagent, vminsert, and single-node) with these semantics:
- `-opentelemetry.promoteScopeMetadata` — whether to promote OTel scope metadata to labels (default enabled).
- `-opentelemetry.promoteAllResourceAttributes` — whether to promote all resource attributes to labels except those in the ignore list (default enabled).
- `-opentelemetry.promoteResourceAttributes` — promote only the listed resource attributes; must not be set together with promote-all.
- `-opentelemetry.ignoreResourceAttributes` — attributes to skip; only valid when promote-all is enabled.
Invalid flag combinations should fail fast at startup. With defaults, decoded samples must keep today’s labels (resource attrs + scope metadata + datapoint attrs). When promotion is narrowed or disabled, only the allowed attributes/metadata appear as labels. Wire the options into OTLP decode/ingest so the flags actually take effect.
Interface contract — the change must expose exactly this surface:
DecodeMetricsData(src []byte, mp MetricPusher, options DecodeMetricsOptions) error; DecodeMetricsOptions has DisableScopeMetadata bool, DisableResourceAttributes bool, ResourceAttributesList map[string]struct{} (list is ignore-keys when DisableResourceAttributes is false, promote-keys when true).
Work only inside this repository checkout. Make the code change the task
describes, keeping the diff focused — no drive-by refactors.
When you are done, leave your changes committed or in the working tree;
they are collected automatically.
Stay on this snapshot checkout (`task/ycb_VictoriaMetrics_cc3525bf0bcfa`). Never checkout, pull, or rebase onto `main`. That branch is a README-only orphan.
Stay on this HEAD. Do not fetch another default branch. Push only on the Cursor-created `crazy-cursor/…` side branch from this HEAD.
Some past runs of this task were launched with a different prompt (the prompt template changed since, or those runs predate this benchmark's stored prompt). Each run persists the exact prompt it sent at launch — that per-launch record is the audit trail; this page shows only the current one.
Reference diff
The task commit's diff against its first parent — the judge's comparison target.