Azure Monitor Integration¶
Table of contents
Introduction¶
You can export metrics and operation logs of your Hasura Cloud project to Azure Monitor. This can be configured on the integrations tab on the project’s setting page.
Note
Azure monitor Integration is only available for Hasura Cloud projects on the Standard (pay-as-you-go) tier and above.
Prerequisites¶
Create a Service Principal in Azure.
From the
Overviewtab of the created Service principal , retrieveApplication (client) ID(Referred asActive Directory Client IDin this context) andDirectory (tenant) ID(Referred asActive Directory Tenant IDin this context)
From the
Certificates & secretstab of the created service principal, Create a client secret by clickingNew client secret. Add a suitable description and expiry period for the secret and clickAdd. Copy the value of the created secret (Referred asActive Directory Client Secretin this context)
Create a Log Analytics Workspace in Azure.
From the
Agents managementtab of the created log analytics workspace, retrieveWorkspace IDandPrimary Key(Referred asShared Keyin this context).
From the
Propertiestab of the created log analytics workspace, retrieveResource IDandLocation(Referred asRegionin this context)
Assign the Role
Monitoring Metrics Publisherto the Service principal against the Log analytics workspace. From theAccess control (IAM)tab of the created log analytics workspace, Click onAddand selectAdd role assignment. In the Add role assignment panel, Select the Role asMonitoring Metrics Publisherand select the created service principal for role assignment and clickSave.
Configure Azure Monitor integration¶
Navigate to the integrations tab on project settings page to find Azure Monitor integration.
Enter the values of config parameters obtained from the steps in pre-requisites in the Azure monitor integration form. In addition to the above parameters, the following fields are also needed:
| Field | Description |
|---|---|
| Namespace | Namespaces are a way to categorize or group similar metrics together. |
| Log type | The record type of the log that is being submitted. It can contain only letters, numbers, and the underscore (_) character, and it can’t exceed 100 characters. |
| Custom Attributes (Optional) | Custom Attributes associated with your logs. A default source tag hasura-logs is added to all exported logs. |
After adding appropriate values in the Azure monitor Integration panel, click Save.
Checking the status of the integration¶
The green/red dot signifies the status of the integration. Green signifies successful exporting of logs to Azure monitor.
When logs are successfully exported, Last Exported is continuously updated, indicating the timestamp of the last log
line successfully exported to your Azure monitor dashboard.
In case there is an error while exporting logs to Azure monitor, the dot is red and the HTTP status code of the error and the message is displayed right below it.
View metrics¶
The integration exports the following five metrics to Azure monitor:
| Metric Exported | Metric Name in Azure monitor |
|---|---|
| Average number of requests | average_requests_per_minute |
| Average request execution time | average_execution_time |
| Success rate of requests | success_rate |
| Active subscriptions | active_subscriptions |
| Number of websockets open | websockets_open |
Non zero values of all the above metrics are exported over a one minute time interval.
To navigate to Azure monitor metrics dashboard
,click View Metrics.
From the Select a scope panel, expand the resource group which contains the Log analytics workspace and select it
and click Apply.In the filter menu, select the correct namespace and Add filter to view the individual metric.
View logs¶
To navigate to Azure monitor logs dashboard
, click View Logs.
From the Select a scope panel, expand the resource group which contains the Log analytics workspace and select it
and click Apply. The logs can be filtered using Log type. Use {YOUR_LOG_TYPE}_CL search parameter to filter the
logs. Custom log types are displayed in the left of the Query panel.