victorialogs-datasource icon indicating copy to clipboard operation
victorialogs-datasource copied to clipboard

More panels support for plugin

Open tenmozes opened this issue 1 year ago • 13 comments

That would be awesome to add support for the following panel types

  • stat
  • pie
  • time series
  • gauge
  • bar

tenmozes avatar Aug 21 '24 06:08 tenmozes

I managed to create a nice dashboard with pie and timeseries visualization. the data transformation needed is not trivial though. grafik

Dashboard Definition Code: logs-dashboard-victorialogs.json

Issues:

  • several Transformations needed to get data in the right format for the visualizations: Pie chart query:
host:~'^$host$' and compose_project:~'^$compose_project$' and compose_service:~'^$compose_service$' and $log_query
  | stats by (host) count() logs

Transformations: grafik

Time series:

host:~'^$host$' and compose_project:~'^$compose_project$' and compose_service:~'^$compose_service$' and $log_query
  | stats by (_time:1h, host) count() logs

grafik

  • $__interval could not be used. | stats by (_time:$__interval, host) count() logs is forwarded in the query without being evaluated.

Positive:

  • it's possible now to create dashboards with variables
  • its possible to visualize log amounts in timeline
  • victorialogs works much faster than loki! Loki is not responding in time when querying just a subset of the same ingested logs.

pgassmann avatar Aug 29 '24 12:08 pgassmann

@hagen1778 can you add support for the $__interval variable in queries?

Are there plans to simplify timeseries queries and other numeric queries for victorialogs?

pgassmann avatar Sep 02 '24 08:09 pgassmann

Stats panel support depends on https://github.com/VictoriaMetrics/VictoriaLogs/issues/310 Time series panel support depends on https://github.com/VictoriaMetrics/VictoriaLogs/issues/309

hagen1778 avatar Sep 05 '24 09:09 hagen1778

Are there plans to simplify timeseries queries and other numeric queries for victorialogs?

@pgassmann yes, see this comment https://github.com/VictoriaMetrics/victorialogs-datasource/issues/61#issuecomment-2331060221

hagen1778 avatar Sep 05 '24 09:09 hagen1778

@hagen1778 can you add support for the $__interval variable in queries?

@Loori-R do we have support for this variable? If no, would you mind creating a separate feature request for it?

hagen1778 avatar Sep 05 '24 09:09 hagen1778

@hagen1778 the $__interval variable support was just added. https://github.com/VictoriaMetrics/victorialogs-datasource/pull/69

pgassmann avatar Sep 05 '24 09:09 pgassmann

@hagen1778 can you add support for the $__interval variable in queries?

@Loori-R do we have support for this variable? If no, would you mind creating a separate feature request for it?

I have merged the PR and made a follow-up PR to provide CHANGELOG and tests.

dmitryk-dk avatar Sep 05 '24 09:09 dmitryk-dk

I thins this function can be reused https://github.com/VictoriaMetrics/victoriametrics-datasource/blob/main/pkg/plugin/step.go#L113

but loki can use this type variable https://github.com/grafana/grafana/blob/main/pkg/tsdb/loki/parse_query.go#L25

yincongcyincong avatar Sep 05 '24 11:09 yincongcyincong

I thins this function can be reused https://github.com/VictoriaMetrics/victoriametrics-datasource/blob/main/pkg/plugin/step.go#L113

but loki can use this type variable https://github.com/grafana/grafana/blob/main/pkg/tsdb/loki/parse_query.go#L25

We have similar logic in the victoriametrics-datasource. Parsing of the different templates was implemented.

dmitryk-dk avatar Sep 05 '24 16:09 dmitryk-dk

FYI, the /select/logsql/stats_query_range endpoint at VictoriaLogs is implemented in the commit 0a40064a6fa64f9d3e3ae60f6f12a9584dce459d . See these docs for details. This endpoint must be used by the VictoriaLogs datasource for building time series panel.

Also the /select/logsql/stats_query endpoint must be used by VictoriaLogs datasource for building stat, pie chart and gauge panels.

valyala avatar Sep 06 '24 22:09 valyala

FYI, the /select/logsql/stats_query_range endpoint at VictoriaLogs is implemented in the commit 0a40064a6fa64f9d3e3ae60f6f12a9584dce459d . See these docs for details. This endpoint must be used by the VictoriaLogs datasource for building time series panel.

Also the /select/logsql/stats_query endpoint must be used by VictoriaLogs datasource for building stat, pie chart and gauge panels.

Are there any plans in the short term to take this into account in victorialogs-datasource?

crocchietta avatar Sep 24 '24 14:09 crocchietta

Hi @crocchietta!

Thank you for your question. This is not planned in the near future, but we intend to address it later. The task is complex and will require time.

Loori-R avatar Oct 02 '24 12:10 Loori-R

Hi @crocchietta!

Thank you for your question. This is not planned in the near future, but we intend to address it later. The task is complex and will require time.

I understand. In the meantime, I'll continue to use the transformations on the Grafana side (Convert field type).

crocchietta avatar Oct 07 '24 13:10 crocchietta

https://github.com/VictoriaMetrics/victorialogs-datasource/pull/106 has been merged, but there are following enhancements required for better usability of this feature:

  • gauge, bar gague, stat, bar chart panel should have toggle for instant and range requests
  • support $__range variable in queries. That would be useful for building queries like _time: $__range | stats by(host) count() to get the stats over selected time range in Grafana time picker. // this is probably related to backend implementation cc @dmitryk-dk
  • stats-like panels should explicitly warn user about adding | stats pipe, because these panels can only work with stats API
  • support legend template. For example, I'd like to choose which labels from the result should be plotted in the legend. Currently, I can't control legend image

@dmitryk-dk @Loori-R could you please break it into tickets which suits you the best and implement?

hagen1778 avatar Nov 20 '24 08:11 hagen1778

Hi @tenmozes ! The feature was implemented in the v0.8.0 release. Close the ticket as implemented.

Other improvements were created in the other tickets and will be implemented soon

dmitryk-dk avatar Nov 20 '24 15:11 dmitryk-dk