-
Notifications
You must be signed in to change notification settings - Fork 36
[FEATURE] Loki datasource plugin #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| } | ||
| }, | ||
| { | ||
| "kind": "TimeSeriesQuery", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so here I guess we need to provide another super type of Query. Like LogQuery
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what I was thinking about as well. While Loki is primarily a log query datasource, it can also return matrix response data that's consumable by other panels which support time series.
So my idea is to use it as a subclass of TimeSeriesQuery.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This plugin will probably support both as we can have metrics from logs which match the time series query format, and specific Logs data that was added perses/perses#3104
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the suggestion and PR! I’ve added a separate LokiLogQuery type of LogQuery kind, as introduced in your PR. Now we have distinct query kinds for the two main Loki query types:
- Streams (actual logs): LokiLogQuery (of LogQuery kind)
- Matrix (timeseries): LokiTimeSeriesQuery (of TimeSeriesQuery kind)
This separation should make the usage of each query type clearer and also allows panels to explicitly define which query types they support
b1b51ea to
d99286c
Compare
ffebdb3 to
4704654
Compare
| } | ||
| }, | ||
| { | ||
| "kind": "Panel", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense this panel is an independent plugin instead of being related to the Loki datasource ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question is, how much (are we confident that) this panel is agnostic to Loki specificities & could be compatible with other future log data sources?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it makes sense to keep this panel datasource-agnostic. We already have a PR with ClickHouse support #241 , but it currently duplicates current LogsTable code and defines a separate log interface. The panel should consume a small Common Log Envelope, and each datasource (Loki, ClickHouse) maps into that envelope.
ClickHouse itself doesn’t enforce a schema, but since the docs recommend OTEL logs, we should explicitly state that the ClickHouse adapter only supports OTEL and reflect that in the shared interface.
This avoids duplication and lets us add others later (Elasticsearch/OpenSearch etc.) by implementing adapters that emit the same envelope.
Aligning both datasources would require adjusting two PRs at once, which feels like too much for now. I think we should properly discuss the direction first, and I’m open for feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aligning both datasources would require adjusting two PRs at once, which feels like too much for now. I think we should properly discuss the direction first, and I’m open for feedback.
Well I think having in another PR the TableLogs panel would not hurt and it will open the discussion. Then afterwards we can align both PRs or plugins if the PRs are already merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you willing to lead the change @abelyakin ? Or at least opening the PR with the single panel, and probably the PR with the small common log envelope ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m willing to lead the change 👍
What I’m wondering is whether it makes sense to approach this in two steps: first merge this panel as is to unblock progress, and then start working on a separate datasource agnostic version. That way we can align adapters without blocking the current PR.
What do you think would be the best sequence of steps here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes that would be acceptable as long as the new panel is named LogsTable to avoid a breaking change when the panel contained in this plugin will be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this is a really cool news you are willing to lead it. Thank you @abelyakin !
Signed-off-by: Alexander Belyakin <[email protected]>
Signed-off-by: Alexander Belyakin <[email protected]>
Co-authored-by: Gabriel Bernal <[email protected]> Signed-off-by: Alexander Belyakin <[email protected]>
Signed-off-by: Alexander Belyakin <[email protected]>
Signed-off-by: Alexander Belyakin <[email protected]>
Signed-off-by: Alexander Belyakin <[email protected]>
Co-authored-by: Antoine THEBAUD <[email protected]> Signed-off-by: Alexander Belyakin <[email protected]>
Co-authored-by: Antoine THEBAUD <[email protected]> Signed-off-by: Alexander Belyakin <[email protected]>
Co-authored-by: Gabriel Bernal <[email protected]> Signed-off-by: Alexander Belyakin <[email protected]>
Signed-off-by: Alexander Belyakin <[email protected]>
Signed-off-by: Alexander Belyakin <[email protected]>
Signed-off-by: Alexander Belyakin <[email protected]>
Signed-off-by: Alexander Belyakin <[email protected]>
Signed-off-by: Alexander Belyakin <[email protected]>
Signed-off-by: Alexander Belyakin <[email protected]>
Signed-off-by: Alexander Belyakin <[email protected]>
4595117 to
40f2214
Compare
|
to fix the CI job To fix the Also as we bumped again a new version of perses/perses (0.52.0-beta.5) you will need to update again the dependencies. |
|
excepting my last comment, I think it's in a good shape. @jgbernalp do you see other things to update in this PR ? Perhaps it should follow also what you are doing in #266 ? |
Yes, there was some fixes to add. I took the liberty to also fix the dependencies and add one suggestion regarding the default values of the proxy. PTAL @abelyakin I created a PR on your fork abelyakin#1 that will fix the ci |
Signed-off-by: Gabriel Bernal <[email protected]>
[IGNORE] fix loki dependencies
Signed-off-by: Alexander Belyakin <[email protected]>
Great! thanks, merged. |
Signed-off-by: Alexander Belyakin <[email protected]>
|
added basic tests since |
jgbernalp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome contribution!
Nexucis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is amazing. Thank you for this incredible contribution @abelyakin ! Looking forward for the next one around the common LogsTable!
* init Signed-off-by: Alexander Belyakin <[email protected]> * add loki datarource with simple logql query editor Signed-off-by: Alexander Belyakin <[email protected]> * Update loki/package.json Co-authored-by: Gabriel Bernal <[email protected]> Signed-off-by: Alexander Belyakin <[email protected]> * update buildUrl Signed-off-by: Alexander Belyakin <[email protected]> * update loki query and changed response data model Signed-off-by: Alexander Belyakin <[email protected]> * add logs panel Signed-off-by: Alexander Belyakin <[email protected]> * Update loki/cue.mod/module.cue Co-authored-by: Antoine THEBAUD <[email protected]> Signed-off-by: Alexander Belyakin <[email protected]> * Update loki/cue.mod/module.cue Co-authored-by: Antoine THEBAUD <[email protected]> Signed-off-by: Alexander Belyakin <[email protected]> * Update loki/package.json Co-authored-by: Gabriel Bernal <[email protected]> Signed-off-by: Alexander Belyakin <[email protected]> * Refactor Loki Queries: Introduce Log and Time Series Queries Signed-off-by: Alexander Belyakin <[email protected]> * rename logs panel to logstable Signed-off-by: Alexander Belyakin <[email protected]> * fixes Signed-off-by: Alexander Belyakin <[email protected]> * delete unused Signed-off-by: Alexander Belyakin <[email protected]> * add go sdk Signed-off-by: Alexander Belyakin <[email protected]> * Update dependencies and clean up configuration files Signed-off-by: Alexander Belyakin <[email protected]> * fix: correct versioning Signed-off-by: Alexander Belyakin <[email protected]> * [IGNORE] fix loki dependencies Signed-off-by: Gabriel Bernal <[email protected]> * pump ver Signed-off-by: Alexander Belyakin <[email protected]> * add log query tests Signed-off-by: Alexander Belyakin <[email protected]> --------- Signed-off-by: Alexander Belyakin <[email protected]> Signed-off-by: Gabriel Bernal <[email protected]> Co-authored-by: Gabriel Bernal <[email protected]> Co-authored-by: Antoine THEBAUD <[email protected]> Co-authored-by: Gabriel Bernal <[email protected]>
Description
This PR introduces a new Loki datasource plugin for Perses, enabling log querying and visualization capabilities. The implementation provides a foundation for log-based observability within Perses dashboards.
perses/perses#2999
Key Features
@uiw/react-codemirrorand@grafana/lezer-logqlfor syntax highlighting and validation. Autocomplete version is WIP and will be released in future PR's.LogQL Editor will be improved as well as separate Logs panel will be introduced in next PRs.
Screenshots
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes