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:
support for handling results with matches (filter queries)
support for evaluating $var before executing APL queries
support for using APL to define query variables
now you can use logs and table panels in dashboard
combine these panels with variables for dynamic dashboards
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:
Logs panel needs to have _time. You can customize what you project, but be sure to include _time
Some queries should NOT include _time, specifically if you are building a variable query, trying to find distinct values to filter with
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:
Here is the edit page for that logs panel, you can see the APL query used:
Here I am defining a new variable of type Query with an Axiom datasource, the APL query finds distinct values, useful for filtering:
Here you can see the values returned to verify before saving:
Here I have updated the query to combine the Grafana variable with APL variables:
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:
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:
Here is the edit page for that logs panel, you can see the APL query used:
Here I am defining a new variable of type Query with an Axiom datasource, the APL query finds distinct values, useful for filtering:
Here you can see the values returned to verify before saving:
Here I have updated the query to combine the Grafana variable with APL variables:
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: