Azure Monitor Integration

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 Overview tab of the created Service principal , retrieve Application (client) ID (Referred as Active Directory Client ID in this context) and Directory (tenant) ID (Referred as Active Directory Tenant ID in this context)

    Service Principal Properties
  • From the Certificates & secrets tab of the created service principal, Create a client secret by clicking New client secret. Add a suitable description and expiry period for the secret and click Add. Copy the value of the created secret (Referred as Active Directory Client Secret in this context)

    Service Principal Secret
  • Create a Log Analytics Workspace in Azure.

  • From the Agents management tab of the created log analytics workspace, retrieve Workspace ID and Primary Key (Referred as Shared Key in this context).

    Log Analytics workspace config parameters
  • From the Properties tab of the created log analytics workspace, retrieve Resource ID and Location (Referred as Region in this context)

    Log Analytics Properties
  • Assign the Role Monitoring Metrics Publisher to the Service principal against the Log analytics workspace. From the Access control (IAM) tab of the created log analytics workspace, Click on Add and select Add role assignment. In the Add role assignment panel, Select the Role as Monitoring Metrics Publisher and select the created service principal for role assignment and click Save.

    Service Principal Role

Configure Azure Monitor integration

Navigate to the integrations tab on project settings page to find Azure Monitor integration.

Configure 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.

Azure monitor Integration successfully configured

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.

Azure monitor Integration unable to push logs

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.

Azure monitor Integration successfully configured

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.

Metrics successfully exported to Azure monitor

View logs

To navigate to Azure monitor logs dashboard , click View Logs.

Azure monitor Integration successfully configured

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.

Logs successfully exported to Azure monitor