axiomhq / axiom-grafana

The official Axiom datasource plugin for Grafana.
https://axiom.co
Apache License 2.0
6 stars 3 forks source link

support matches, variables, logs and table panels #6

Closed mschoch closed 1 year ago

mschoch commented 1 year ago

Summary

First, I just want to say all of this will be nicer with tabular result format. Much of this code is working around limitations imposed by our current data-structures.

Several things going on here:

Finally, a bunch of this is simply copy/pasted from other examples I could find to make this work. Do not hesitate to ask questions about the details...

Impl Notes

Some parts of Grafana will only work correctly if you write your APL in a particular way. Some notes:

When using axiom-go with APL filter queries it is not possible for us to determine whether or not the query projected _time or not. This is an important distinction as the notes above indicate we need to support queries both with and without _time projected. I have done my best to work around this for now, using the LegacyRequest projections field to let us know whether or not to project _time or not. This seems to work OK, but it required me to duplicate a bunch of code from axiom-go. All of this code is confined to the new client.go. Long-term this should either all migrate to tabular result format, or lead to improvements in axiom-go.

Examples

Here is a dashboard with Logs and Table panels using Axiom APL query:

Screen Shot 2023-05-12 at 3 37 12 PM

Here is the edit page for that logs panel, you can see the APL query used:

Screen Shot 2023-05-12 at 3 37 30 PM

Here I am defining a new variable of type Query with an Axiom datasource, the APL query finds distinct values, useful for filtering:

Screen Shot 2023-05-12 at 3 39 49 PM

Here you can see the values returned to verify before saving:

Screen Shot 2023-05-12 at 3 40 01 PM

Here I have updated the query to combine the Grafana variable with APL variables:

Screen Shot 2023-05-12 at 3 41 21 PM

Here you can see the dynamic dashboard, I have a drop-down populated with live values from the variable query, and when I choose a new value, the dashboard will update to reflect the changed filter:

Screen Shot 2023-05-12 at 3 42 04 PM
seiflotfy commented 1 year ago

AWESOME