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

Variable values fetch from query

Open Neko-Follower opened this issue 1 year ago • 4 comments
trafficstars

Hi! Thank you for the datasource plugin.

I wanted to get the variable values ​​from the query rather than defining them manually. Снимок экрана 2024-07-04 в 16 18 51

Neko-Follower avatar Jul 04 '24 11:07 Neko-Follower

@Loori-R @dmitryk-dk would you mind taking a look?

hagen1778 avatar Jul 04 '24 12:07 hagen1778

I would like to build a logs dashboard like this using victorialogs:

grafik grafik

The query for loki looks like this:

{host=~"$host",category="dockerlogs",compose_project=~"$project",compose_service=~"$service"} $filter |~ "$search" 
| line_format "{{.compose_project }}/{{.compose_service }}\t| {{ __line__ }}"

For this, the grafana plugin would need to support querying field_values. The api is implemented: https://docs.victoriametrics.com/victorialogs/querying/#querying-stream-field-values

pgassmann avatar Jul 09 '24 15:07 pgassmann

Dynamic variables allow some really useful dashboarding, looking forward to being able to do this with victorialogs.

ccgovuk avatar Jul 30 '24 08:07 ccgovuk

Hi,

I agree, allow creating vars is very usefull. It can help to focus on specific point. It can be use to create clean dashboards with both vmlogs and vmetrics content.

dginhoux avatar Aug 13 '24 19:08 dginhoux

@Loori-R is https://github.com/VictoriaMetrics/victorialogs-datasource/pull/58 enough for supporting variables in the plugin?

hagen1778 avatar Aug 21 '24 14:08 hagen1778

Yes, I think that will be enough. If anything was missed, you can reopen or create a new feature request.

Loori-R avatar Aug 21 '24 14:08 Loori-R

Hi! Thank you for feature. I tried this out and found some bugs.

Multi-value seems doesn't work. I have query: consumer: $consumer Choose 2 options and get nothing. From google devtools in network i see following query: consumer: <null>|admin I think it should have looked like this: consumer: ("<null>" OR "admin")

Query works badly with values with special characters. I have query: proxy_list: $proxy_list From google devtools in network i see following query: proxy_list: api_name:clientid-persons-v1;v1\\.14\\.1 I think it should have looked like this: proxy_list: "api_name:clientid-persons-v1;v1.14.1"

I think need to add quotes and work through the moment with multi-value

Neko-Follower avatar Aug 22 '24 09:08 Neko-Follower

Hi @Neko-Follower! Thank you for the feedback. I created a separate issue #65.

Loori-R avatar Aug 22 '24 13:08 Loori-R

The functionality for fetching variable values is supported in victorialogs-datasource starting from version v0.3.0.

Loori-R avatar Aug 22 '24 13:08 Loori-R