GoogleCloudPlatform / GoogleCloudPlatform/cloud-logging-data-source-plugin

Logs: Unexpected format for the data source response for logs

Open
#221 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
24
Forks
17
Avg merge
13h 11m
Merged PRs (30d)
11

Description

Reported [here](https://github.com/grafana/grafana/issues/131468), and easily reproduced with a data source instance, the produced logs response is not matching the requirements of the Logs visualizations in Grafana.

As far as I can see, it seems to be producing a data frame per log line. This has the following effects:
- The Logs Table shows only one log line (as it can only display one data frame at a time).
- The Logs Visualization is unable to uniquely identify individual log lines: since there's no ID field in the response, the log lines UID are generated using a combination of the refId and the index of the log line in the response. Since all data frames belong to the same refId and every log line is the first and only item of the data frame values, every log line has the uid `refId_0`. https://github.com/grafana/grafana/blob/main/public/app/features/logs/logsModel.ts#L452 . Since they all share the same ID, log details, linking, and a lot of other Logs visualization features can't be used.

Minimally, the data source response should contain a time field (timestamp) and a string field (log line, matching the first field with type string). Any extra fields will be shown as "fields" inside log details.

Ideally, the response should match this specification: https://grafana.com/developers/dataplane/logs

Without meeting these requirements, Grafana is unable to properly handle the logs response.

Contributor guide

Open the contributing guide

Research direction

Start with the referenced Grafana logsModel.ts behavior and the plugin's logs data-source response construction, then compare the output with the Grafana logs data-plane specification. Done means the response includes a timestamp and string log-line field, preserves extra fields for log details, and no longer produces one frame per log line.

Written by the indexing model from the issue text.

Assessment

Tech stack
google-cloud, grafana, typescript
Domain
api, observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.