Skip to content

[FEATURE] Loki: add query migration script for log queries#634

Merged
jgbernalp merged 3 commits intoperses:mainfrom
rickardsjp:migrate-loki-query
Apr 21, 2026
Merged

[FEATURE] Loki: add query migration script for log queries#634
jgbernalp merged 3 commits intoperses:mainfrom
rickardsjp:migrate-loki-query

Conversation

@rickardsjp
Copy link
Copy Markdown
Contributor

Description

Add a Grafana migration script for Loki log queries (loki-log-query), enabling percli migrate to convert Grafana Loki targets to LokiLogQuery.

The script matches targets where datasource.type is "loki" and maps

  • expr to query
  • datasource.uid to datasource reference with kind: LokiDatasource

Note

This PR covers panel targets with an explicit datasource.type: "loki". Targets without type info may still be caught by the Prometheus migration script (#632). The Prometheus migration still matches targets which have expr set but no explicit type set to Loki.

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention.
  • All commits have DCO signoffs.

UI Changes

  • n/a

Signed-off-by: Jeremy Rickards <jeremy.rickards@sap.com>
Signed-off-by: Jeremy Rickards <jeremy.rickards@sap.com>

kind: "LokiLogQuery"
spec: {
if #target.datasource.uid != _|_ {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is optional, we might be missing a test case when there is no datasource.uid

Signed-off-by: Jeremy Rickards <jeremy.rickards@sap.com>
@jgbernalp jgbernalp enabled auto-merge April 21, 2026 12:56
@jgbernalp jgbernalp added this pull request to the merge queue Apr 21, 2026
Merged via the queue into perses:main with commit 4bc49ad Apr 21, 2026
16 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