I have K6- InfluxDB - Grafana stack which was integrated into the Azure release pipeline. In Grafana, I can filter results based on timelines since Influxdb is a time-series database. But I would like to have the flexibility to filter results based on the release pipeline number as well. Is it possible to do it? Can we pass the release number as an environment variable? But what do I do with a release number, how do I integrate it in my k6 script or Influxdb so that Grafana can read it.
Any suggestions?
I'm doing something similar in my load tests. You can set a test wide tag in your options
object, or if using scenarios, a tag per scenario. The tag value can be injected via environment variable.
When using the InfluxDB output, tags are automatically added to every data point. Be careful though with the number of time series this will create.
export const options = {
tags = {
pipeline_id = __ENV.AZURE_PIPELINE_ID || 'unknown',
},
};
With scenarios:
export const options = {
scenarios: {
executor: '…',
tags: {
pipeline_id = __ENV.AZURE_PIPELINE_ID || 'unknown',
},
…,
},
};
Note that one of the two alternatives is sufficient, depending on your use case.
You can then easily define filters on the tag "pipeline_id" in your Grafana dashboards with InfluxDB data sources:
SELECT max("value") FROM "vus" WHERE ("pipeline_id" = '$pipeline_id') AND $timeFilter GROUP BY time($__interval) fill(none)
(or by using the query builder)