Menu
DocumentationGrafana CloudTesting and syntheticsPerformance testingAuthor and run testsCloud scripting extrasCloud execution context variables
Grafana Cloud
Cloud execution context variables
When you run a cloud test, you can use three additional environment variables to find out in which load zone, server instance, and distribution label the script is currently running.
Name | Value | Description |
---|---|---|
K6_CLOUDRUN_LOAD_ZONE | string | The load zone from where the metric was collected. Values are in the following format: amazon:us:ashburn . |
K6_CLOUDRUN_INSTANCE_ID | number | A sequential number representing the unique ID of a load generator server taking part in the test, starts at 0. |
K6_CLOUDRUN_DISTRIBUTION | string | The value of the cloud.distribution label" corresponding to the load generator instance. |
You can read the values of these variables in your k6 script as usual.
JavaScript
export const options = {
vus: 50,
duration: '30s',
cloud: {
distribution: {
ashburnDistribution: { loadZone: 'amazon:us:ashburn', percent: 50 },
dublinDistribution: { loadZone: 'amazon:ie:dublin', percent: 50 },
},
},
};
export default function () {
if (__ENV.K6_CLOUDRUN_DISTRIBUTION === 'ashburnDistribution') {
// do something
} else if (__ENV.K6_CLOUDRUN_DISTRIBUTION == 'dublinDistribution') {
// do something
}
}
Was this page helpful?
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:
Video
Getting started with the Grafana LGTM Stack
In this webinar, we’ll demo how to get started using the LGTM Stack: Loki for logs, Grafana for visualization, Tempo for traces, and Mimir for metrics.
Video
Intro to Kubernetes monitoring in Grafana Cloud
In this webinar you’ll learn how Grafana offers developers and SREs a simple and quick-to-value solution for monitoring their Kubernetes infrastructure.
Video
Building advanced Grafana dashboards
In this webinar, we’ll demo how to build and format Grafana dashboards.