Skip to content

Cloud Logging datasource appends time range without grouping OR queries #222

Description

@NicoKJarvinen

Bug

In v1.7.0, the datasource appends the dashboard time range to the user query without wrapping the user expression:

%s AND timestamp >= "<from>" AND timestamp <= "<to>"

For a query with a top-level OR, Cloud Logging parses AND before OR. For example:

jsonPayload.event_type="app.error" OR (jsonPayload.event_type="app.request" AND jsonPayload.metadata.status>=500)

becomes effectively:

jsonPayload.event_type="app.error" OR (jsonPayload.event_type="app.request" AND jsonPayload.metadata.status>=500 AND timestamp >= "<from>" AND timestamp <= "<to>")

The time range therefore applies only to the final branch.

The datasource should group the user expression before appending the time range, for example:

(<user query>) AND timestamp >= "<from>" AND timestamp <= "<to>"

This was observed in a Grafana dashboard using GoogleCloudPlatform/cloud-logging-data-source-plugin v1.7.0. A local workaround is to parenthesize any dashboard query containing OR.

Related Kaamos issue: https://github.com/Kaamos-AI/kaamos/issues/2949

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions