The configuration parameters for sending metrics to Azure Monitor are as follows:
|provider||Any APM provider name available in the supported APM provider's table.|
|tenantId||The tenantId provided by service principal. The directory (tenant) ID can be extracted from Azure's app registrations.|
|clientId||The clientId provided by service principal. The application (client) ID can be extracted from Azure's app registrations.|
|clientSecret||The clientSecret provided by service principal. The client secret can be extracted from the certificates & secrets section of Azure's app registrations.|
|azureRegion||The azureRegion you've created your Azure configurations. The supported regions listed below can be used in Cloud APM. Default is eastus.|
|subscriptionId||The subscriptionId can be viewed in the subscriptions section of Azure portal.|
|resourceGroupName||The resourceGroupName can be viewed in the resource groups section of Azure portal. It should match the subscriptionId.|
|insightsAppName||The insightsAppName can be viewed in the application insights section of Azure portal. It should match the resourceGroupName.|
|metrics||List of built-in and custom metrics to be exported.|
|includeDefaultMetrics||If set, the export will include the default metrics. Default is true.|
|resampleRate||The rate by which the metrics are resampled and sent to the APM provider in seconds. Default is 60 and constant, because Azure Monitor re-aggregates all metrics to 60 seconds by default.|
|includeTestRunId||If set, the test_run_id will be exported per each metric as an extra tag. Default is false.|
As of Jan. 2021, all keys on the configuration parameters object are in camel case. So, please update your test run script(s).
All the above configuration parameters are passed like this in your test run.
These are the supported regions for Azure Monitor integration:
|Geographic Region||Supported Azure Region(s)|
|US and Canada||westcentralus|
|Asia & Australia||centralindia|
For sending custom metrics from your test run Azure Monitor, follow these instructions:
Make sure you have an active subscription on Azure. Take note of your subscription ID for the configuration object.
Create a resource group under your active subscription.
Create a service principal by adding a new app to Azure app registrations.
Create a client secret in your service principal.
Go to your resource group and assign "Monitoring Metrics Publisher" role to the user and the service principal.
Create a log analytics workspace. The region is chosen here, so make note of it.
Create an app under application insights with your log analytics workspace. The region should match the log analytics workspace.
Start your test run with the parameters you've extracted from the steps 1-6.
Your metrics will be exported to Azure Monitor with a 3~4 minutes delay. You can view them on metrics section of the Azure Monitor. Just choose application insights name as scope, k6 as metrics namespace and your metrics (and their associated aggregation methods) will be shown in metric dropdown. If you didn't see the results, try to narrow down the time range to last 30 minutes or less.