Closed isarns closed 4 months ago
It looks like this is possible with the current grafonnet, example:
local g = import 'github.com/grafana/grafonnet/gen/grafonnet-latest/main.libsonnet';
local query = g.dashboard.variable.query;
local cloudwatch = g.query.cloudWatch.CloudWatchMetricsQuery;
query.new(
'ALB',
cloudwatch.withQueryType('dimensionValues')
+ cloudwatch.withNamespace('AWS/ApplicationELB')
+ cloudwatch.withRefId('CloudWatchVariableQueryEditor-VariableQuery')
+ cloudwatch.withMetricName('RequestCount')
+ { dimensionKey: 'LoadBalancer' } // didn't find in `cloudwatch`
)
+ query.withDatasource('cloudwatch', 'cloudwatch-ds')
+ query.generalOptions.withLabel('alb_name')
+ query.generalOptions.withCurrent('app/alb-name123123')
+ { multi:: false } // workaround for bug on `withCurrent`
Expected Behavior
I would like to be able to define a Grafana variable with a CloudWatch datasource in my Jsonnet code. The expected JSON output for the variable should look like this:
Current Behavior
Currently, I am unable to find a way to specify a CloudWatch datasource for a Grafana variable using Graffonet.
Environment
Possible Solution
Any suggestions for a possible solution or workaround.