elastic / elastic/observability-migration-platform
grafana-migrate: label_replace() not implemented in Kibana PromQL — panels fail with verification_exception
- Dominant language
- Python
- Stars
- 6
- Forks
- 8
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 23
Description
## Problem
Panels that use \`label_replace()\` fail at render time in Kibana with:
\`\`\`
Unexpected error from Elasticsearch: verification_exception - Found 1 problem
line 1:39: Function [label_replace] is not yet implemented
\`\`\`
This surfaces on Kubernetes cluster monitoring dashboards sourced via Prometheus — for example the [Elasticsearch dashboard #266](https://grafana.com/grafana/dashboards/266-elasticsearch/).
## Context
The error comes from Elasticsearch's PromQL engine, which does not yet support \`label_replace()\`. The migration engine already has a working ES|QL translation for \`label_replace()\` (regex patterns are mapped to ES|QL \`EVAL\`/\`GROK\`), so the ES|QL path is a viable fallback today.
This means there are two options:
1. **Route \`label_replace()\` expressions to the ES|QL path now**, so panels migrate cleanly instead of producing a runtime error — using the translation that already exists.
2. **Wait for [elastic/metrics-program#274](https://github.com/elastic/metrics-program/issues/274) to be resolved**, at which point Elasticsearch's PromQL engine will support \`label_replace()\` natively and panels can use the native PromQL lens instead.
## Expected behaviour
Panels using \`label_replace()\` should not produce a runtime error. Either path above is acceptable; the choice determines whether they land as ES|QL or native PromQL.
## Action
**Do not implement a fix here until [elastic/metrics-program#274](https://github.com/elastic/metrics-program/issues/274) is resolved.** Once that issue is closed, revisit this ticket to assess whether to route to native PromQL or keep the ES|QL path.
Contributor guide
Assessment
This issue has not been assessed yet.