sensu / grafana-sensu-go-datasource

A Grafana data source plugin for querying the Sensu Go API
MIT License
22 stars 15 forks source link

Escaping in entity names using variable cause incorrect lookups #43

Closed ninjaslothx closed 4 years ago

ninjaslothx commented 4 years ago

Using an $entity variable in the query causes entities with a FQDN to have the periods escaped.

Reproduce: Have an entity with an FQDN. Create entity variable: QUERY API entity IN NAMESPACE $namespace SELECT metadata.name LIMIT 0

Create a new query: image

Entity filter is not returned as expected. Query response shows the periods being escaped but the entity name is in a quoted string.

Object
request:Object
method:"GET"
url:"api/datasources/proxy/103/api/core/v2/namespaces/default/events"
params:Object
fieldSelector:"event.entity.name == "my-host-01\.mydomain\.org""
hideFromInspector:false
response:Array[0]
mariusoe commented 4 years ago

Hi,

you should be able to use the variable with Grafana's advanced variable formatting and force the raw value without any escaping: ${entity:raw}

ninjaslothx notifications@github.com schrieb am Mo., 28. Sept. 2020, 07:31:

Using an $entity variable in the query causes entities with a FQDN to have the periods escaped.

Reproduce: Have an entity with an FQDN. Create entity variable: QUERY API entity IN NAMESPACE $namespace SELECT metadata.name LIMIT 0

Create a new query: [image: image] https://user-images.githubusercontent.com/56047571/94393968-b9568f00-01b8-11eb-8e9a-7d8760e1641d.png

Entity filter is not returned as expected. Query response shows the periods being escaped but the entity name is in a quoted string.

Object request:Object method:"GET" url:"api/datasources/proxy/103/api/core/v2/namespaces/default/events" params:Object fieldSelector:"event.entity.name == "my-host-01.mydomain.org"" hideFromInspector:false response:Array[0]

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sensu/grafana-sensu-go-datasource/issues/43, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJJJ5ROEEHHWK3VODVHSWLSIANULANCNFSM4R4BYMKA .

ninjaslothx commented 4 years ago

That has resolved the issue! Thank you I was unaware of the advanced formatting.