GoogleCloudPlatform / GoogleCloudPlatform/cloud-logging-data-source-plugin
Cloud Logging datasource appends time range without grouping OR queries
- Dominant language
- TypeScript
- Stars
- 24
- Forks
- 17
- Avg merge
- 13h 11m
- Merged PRs (30d)
- 11
Description
## Bug
In v1.7.0, the datasource appends the dashboard time range to the user query without wrapping the user expression:
```text
%s AND timestamp >= "" AND timestamp <= ""
```
For a query with a top-level OR, Cloud Logging parses AND before OR. For example:
```text
jsonPayload.event_type="app.error" OR (jsonPayload.event_type="app.request" AND jsonPayload.metadata.status>=500)
```
becomes effectively:
```text
jsonPayload.event_type="app.error" OR (jsonPayload.event_type="app.request" AND jsonPayload.metadata.status>=500 AND timestamp >= "" AND timestamp <= "")
```
The time range therefore applies only to the final branch.
The datasource should group the user expression before appending the time range, for example:
```text
() AND timestamp >= "" AND timestamp <= ""
```
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
Contributor guide
Research direction
Locate the datasource code that appends dashboard time bounds to user queries and inspect how expressions containing OR are assembled. Add coverage for a top-level OR query and verify that the complete user expression is grouped before the time constraints, while preserving existing query behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- google-cloud, grafana, typescript
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100