fix(telemetry): revert collector group-label build (cloud + Alloy configs)

The legend now uses raw labels in the dashboard Display name (see the paired
dashboard commit), so the collector no longer needs to build resource_group /
iac_group. Those derived labels also could not survive the dashboards' sum by()
aggregation, which is why the grouped approach was dropped.

Revert transform/legendgroups and its transform/cloudlabels datapoint copies
from the Grafana Cloud collector config and the in-repo Alloy config; both files
are now identical to their pre-change state.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Pratik Mankawde
2026-07-15 11:32:32 +01:00
parent b4af979a42
commit 5e37c5fae9
2 changed files with 2 additions and 61 deletions

View File

@@ -151,15 +151,6 @@ otelcol.processor.transform "tier" {
`delete_key(attributes, "telemetry.sdk.language")`,
`delete_key(attributes, "telemetry.sdk.name")`,
`delete_key(attributes, "telemetry.sdk.version")`,
// Grouped legend labels must be built here too, not only in
// metric_statements: span-derived RED metrics (span_calls_total,
// span_duration_*) are produced by the spanmetrics connector from these
// TRACES and go straight to the batch processor, bypassing the metric
// resource statements. Building the labels on the span resource keeps
// span-based dashboard panels' legends consistent with native metrics.
`set(attributes["resource_group"], Concat(["[", attributes["service.instance.id"], "]"], "")) where attributes["service.instance.id"] != nil and attributes["service.instance.id"] != ""`,
`set(attributes["resource_group"], Concat(["[", attributes["service.instance.id"], ", ", attributes["xrpl.network.type"], "]"], "")) where attributes["service.instance.id"] != nil and attributes["service.instance.id"] != "" and attributes["xrpl.network.type"] != nil and attributes["xrpl.network.type"] != ""`,
`set(attributes["iac_group"], Concat(["[", Concat([attributes["xrpl.branch"], attributes["xrpl.node.role"], attributes["xrpl.work.item"]], ", "), "]"], "")) where attributes["xrpl.branch"] != nil and attributes["xrpl.branch"] != "" and attributes["xrpl.node.role"] != nil and attributes["xrpl.node.role"] != "" and attributes["xrpl.work.item"] != nil and attributes["xrpl.work.item"] != ""`,
]
}
@@ -172,21 +163,6 @@ otelcol.processor.transform "tier" {
`delete_key(attributes, "telemetry.sdk.language")`,
`delete_key(attributes, "telemetry.sdk.name")`,
`delete_key(attributes, "telemetry.sdk.version")`,
// Grouped legend labels for the Grafana dashboards (kept in sync with the
// reference collector's transform/legendgroups). The Cloud gateway
// promotes these resource attributes to Prometheus labels server-side.
// Brackets and ", " separators are baked into the VALUE (e.g.
// "[node, mainnet]") so the dashboard Display name needs no literal
// brackets and an absent group renders as nothing.
// * resource_group: "[node]" or "[node, network]".
// * iac_group: "[branch, role, work-item]". A generic node like this one
// does not set those attrs, so the guard leaves iac_group unset; it is
// built only on perf-comparison nodes. The guard checks != "" as well
// as != nil because OTTL Concat emits "<nil>"/a stray separator for an
// absent or empty element.
`set(attributes["resource_group"], Concat(["[", attributes["service.instance.id"], "]"], "")) where attributes["service.instance.id"] != nil and attributes["service.instance.id"] != ""`,
`set(attributes["resource_group"], Concat(["[", attributes["service.instance.id"], ", ", attributes["xrpl.network.type"], "]"], "")) where attributes["service.instance.id"] != nil and attributes["service.instance.id"] != "" and attributes["xrpl.network.type"] != nil and attributes["xrpl.network.type"] != ""`,
`set(attributes["iac_group"], Concat(["[", Concat([attributes["xrpl.branch"], attributes["xrpl.node.role"], attributes["xrpl.work.item"]], ", "), "]"], "")) where attributes["xrpl.branch"] != nil and attributes["xrpl.branch"] != "" and attributes["xrpl.node.role"] != nil and attributes["xrpl.node.role"] != "" and attributes["xrpl.work.item"] != nil and attributes["xrpl.work.item"] != ""`,
]
}

View File

@@ -123,34 +123,6 @@ processors:
- set(attributes["service_instance_id"], resource.attributes["service.instance.id"])
- set(attributes["deployment_environment"], resource.attributes["deployment.environment"])
- set(attributes["xrpl_network_type"], resource.attributes["xrpl.network.type"])
# Copy the grouped legend labels built by transform/legendgroups onto
# datapoint attributes too (same reason as the tier attrs above: Cloud
# OTLP ingest does not promote resource attributes to labels). Guarded
# so a group absent on the resource is not created as an empty label.
- set(attributes["resource_group"], resource.attributes["resource_group"]) where resource.attributes["resource_group"] != nil
- set(attributes["iac_group"], resource.attributes["iac_group"]) where resource.attributes["iac_group"] != nil
# Build grouped legend labels from the tier / perf-iac resource attributes so
# dashboards reference one pre-built label per group. On the local scrape these
# are promoted to labels by resource_to_telemetry_conversion; on the Cloud path
# transform/cloudlabels (above) copies them onto datapoint attributes.
# The BRACKETS and comma separators are baked into the label VALUE here (e.g.
# "[node, mainnet]") rather than added in the dashboard Display name: a template
# like "... [${__field.labels.iac_group}]" renders an empty "[]" when the label
# is absent, and Grafana's renameByRegex runs pre-interpolation so it cannot
# strip it. Baking brackets into the value means an absent group is just an
# absent label -> the Display name renders nothing for it.
# - iac_group: "[branch, role, work-item]", built only on perf runs.
# - resource_group: "[node]" or "[node, network]".
# Guards check != nil and != "" because OTTL Concat renders "<nil>" for an
# absent attribute and the perf-iac collector stamps these with an empty-string
# default outside a comparison run.
transform/legendgroups:
metric_statements:
- context: resource
statements:
- set(attributes["iac_group"], Concat(["[", Concat([attributes["xrpl.branch"], attributes["xrpl.node.role"], attributes["xrpl.work.item"]], ", "), "]"], "")) where attributes["xrpl.branch"] != nil and attributes["xrpl.branch"] != "" and attributes["xrpl.node.role"] != nil and attributes["xrpl.node.role"] != "" and attributes["xrpl.work.item"] != nil and attributes["xrpl.work.item"] != ""
- set(attributes["resource_group"], Concat(["[", attributes["service.instance.id"], "]"], "")) where attributes["service.instance.id"] != nil and attributes["service.instance.id"] != ""
- set(attributes["resource_group"], Concat(["[", attributes["service.instance.id"], ", ", attributes["xrpl.network.type"], "]"], "")) where attributes["service.instance.id"] != nil and attributes["service.instance.id"] != "" and attributes["xrpl.network.type"] != nil and attributes["xrpl.network.type"] != ""
connectors:
spanmetrics:
@@ -252,19 +224,12 @@ service:
# the transform both writing a service_instance_id label on the same series.
metrics/local:
receivers: [otlp, spanmetrics]
processors:
[resource/tier, resource/stripsdk, transform/legendgroups, batch]
processors: [resource/tier, resource/stripsdk, batch]
exporters: [prometheus]
metrics/cloud:
receivers: [otlp, spanmetrics]
processors:
[
resource/tier,
resource/stripsdk,
transform/legendgroups,
transform/cloudlabels,
batch,
]
[resource/tier, resource/stripsdk, transform/cloudlabels, batch]
exporters: [otlphttp/grafanacloud]
logs:
receivers: [filelog]