-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Explore: Use SeriesData format for loki/logs #16793
Conversation
Make explore expect SeriesData to be returned as logs result from datasources and for now convert SeriesData to LogsModel. Loki datasource query now returns SeriesData and all processing have been moved into explore instead.
@ryantxu Please have a look at the changes if you're interested to see if this maps to your vision in referenced issue. This is the first step and there will probably be a lot of other changes needed, but now we make it easier for each datasource to return log data. |
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.
Some comments on some of the design decision I've made.
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.
Great work! So nice to see progress on this front! Just some minor comments about the overuse of callback loops (reduce/maps etc) for arrays that can have thousands of entries.
@marefr -- this looks really good. thank you. |
LogsSeriesFieldProcessor extends SeriesFieldProcessor and can validate that series are valid for being visualized as logs. Valid log series is now defined as having a time and a string field. Also, there now support for checking if a series has a log level field. The processing and sorting of logs have been refactored to hopefully be more efficient than before.
@ryantxu @torkelo thanks for the feedback 👍 Have pushed some changes now. I guess the biggest change is the Besides this have tried to make the log processing more efficient by using regular loops instead. |
@marefr this is looking really good -- thanks. The name on As implemented it is a way to find field indexes based on name/type -- maybe |
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 work, found some very minor stuff.
@ryantxu I agree, I'm not super happy with that name. But it's not only a way for finding field indexes based on name/type - it also guesses field type for undefined/other field types and "caches" it so you don't have to iterate over all fields over and over again. And for Would it be possible/a good thing to wrap the SeriesData in some sort of class/structure, similar to I guess it's easier to start with renaming |
@ryantxu I think changes in https://github.com/grafana/grafana/pull/16793/files#diff-317237f74791e054ee61a4e01ed3cb3bR58 and https://github.com/grafana/grafana/pull/16793/files#diff-c10a219f8d98d5afcc02054eb27f23a3R36 highlights the need of using some abstraction on top of |
@marefr -- maybe, I don't think we need more now. regardless, the details of this class should not hold up merging the PR. |
FYI - this step already happens if you query with the new PanelQueryRunner right now that is only react panels, but soon will be everything. Essentially it makes sure there is a type on everything before sending it to any panel. |
I totally see the win and simplicity of using this. Next step for me in explore is to refractor how queries are executed and then I think it will make sense to use the same, |
If you get ambitions and subscribe to the results, you may get streaming to work for "free" -- see: |
Renames SeriesFieldsProcessor to FieldCache which makes it explicit to only be used for lookup of fields by type or name. Removes LogsSeriesFieldProcessor and postpone finding log level fields to later.
@ryantxu decided to rename |
@marefr -- looks great. this is a huge improvement. |
@marefr using indexes as React keys is rarely advisable. The key tells react what to unmount. Update: can't repro index-as-keys issues anymore. |
…MetricPanelCtrl * grafana/master: Explore: Use SeriesData format for loki/logs (grafana#16793) Refactor: move NavModel to @grafana/ui (grafana#16813) Auth: Enable retries and transaction for some db calls for auth tokens (grafana#16785) Provisioning: Show file path of provisioning file in save/delete dialogs (grafana#16706) Add tracing headers for prometheus datasource (grafana#16724) Config: Fixes bug where timeouts for alerting was not parsed correctly (grafana#16784) build: removes gopkg files from dev docker file (grafana#16817) Provisioning: Trying to fix failing test (grafana#16800) Table: React table fix rotate support in storybook (grafana#16816) TestData: add log level in dummy message (grafana#16815) removes gopkg.lock from root folder Explore: Support user timezone (grafana#16469) Plugins: rename vizPlugin to panelPlugin (grafana#16802) Plugins: move app/feature/plugin properties into PluginMeta (grafana#16809) Plugins: move PanelPluginMeta to grafana/ui (grafana#16804) Plugins: move datasource specific meta out of the main meta type (grafana#16803) updates changelog for 6.1.6 Fix: Fetch histogram series from other api route (grafana#16768) phantomjs: set web-security to true Chore: Lowered implicit anys limit to 5668
* grafana/master: Explore: Use SeriesData format for loki/logs (grafana#16793) Refactor: move NavModel to @grafana/ui (grafana#16813) Auth: Enable retries and transaction for some db calls for auth tokens (grafana#16785) Provisioning: Show file path of provisioning file in save/delete dialogs (grafana#16706) Add tracing headers for prometheus datasource (grafana#16724) Config: Fixes bug where timeouts for alerting was not parsed correctly (grafana#16784) build: removes gopkg files from dev docker file (grafana#16817) Provisioning: Trying to fix failing test (grafana#16800) Table: React table fix rotate support in storybook (grafana#16816) TestData: add log level in dummy message (grafana#16815) removes gopkg.lock from root folder Explore: Support user timezone (grafana#16469) Plugins: rename vizPlugin to panelPlugin (grafana#16802) Plugins: move app/feature/plugin properties into PluginMeta (grafana#16809) Plugins: move PanelPluginMeta to grafana/ui (grafana#16804) Plugins: move datasource specific meta out of the main meta type (grafana#16803) updates changelog for 6.1.6 Fix: Fetch histogram series from other api route (grafana#16768) phantomjs: set web-security to true Chore: Lowered implicit anys limit to 5668
* grafana/master: FormLabel: allow any rather than just a string for tooltip (grafana#16841) prometheus: fix regression after adding support for tracing headers (grafana#16829) area/circleci: Speed up circleci build process for branches and pr (grafana#16778) DataProxy: Restore Set-Cookie header after proxy request (grafana#16838) docs: clarify page parameter version support for folder/dashboard search (grafana#16836) Chore: revise some of the gosec rules (grafana#16713) Refactor: consistant plugin/meta usage (grafana#16834) Explore: Use SeriesData format for loki/logs (grafana#16793) Refactor: move NavModel to @grafana/ui (grafana#16813)
* grafana/master: (27 commits) FormLabel: allow any rather than just a string for tooltip (grafana#16841) prometheus: fix regression after adding support for tracing headers (grafana#16829) area/circleci: Speed up circleci build process for branches and pr (grafana#16778) DataProxy: Restore Set-Cookie header after proxy request (grafana#16838) docs: clarify page parameter version support for folder/dashboard search (grafana#16836) Chore: revise some of the gosec rules (grafana#16713) Refactor: consistant plugin/meta usage (grafana#16834) Explore: Use SeriesData format for loki/logs (grafana#16793) Refactor: move NavModel to @grafana/ui (grafana#16813) Auth: Enable retries and transaction for some db calls for auth tokens (grafana#16785) Provisioning: Show file path of provisioning file in save/delete dialogs (grafana#16706) Add tracing headers for prometheus datasource (grafana#16724) Config: Fixes bug where timeouts for alerting was not parsed correctly (grafana#16784) build: removes gopkg files from dev docker file (grafana#16817) Provisioning: Trying to fix failing test (grafana#16800) Table: React table fix rotate support in storybook (grafana#16816) TestData: add log level in dummy message (grafana#16815) removes gopkg.lock from root folder Explore: Support user timezone (grafana#16469) Plugins: rename vizPlugin to panelPlugin (grafana#16802) ...
What this PR does / why we need it:
This is the first step moving towards Explore supporting logs for additional datasources than Loki. In the first step we move all the log processing from Loki into Explore.
Summary of changes:
Make explore convert logs result returned from datasources to SeriesData,
if needed, and for now convert SeriesData to LogsModel.
Loki datasource query now returns SeriesData and all
processing have been moved into explore instead.
Removed key from LogRowModel and use log row indexes as
the unique key instead.
Removed id from LogsModel since it looks like it's not in use.
Which issue(s) this PR fixes:
Closes #16287
Special notes for your reviewer:
I removed
key
fromLogRowModel
and used index of each log row as key for rendering unique keys for<LogRow />
component. To me this seems to work and makes the row model easier, but I may have missed some important aspect?