Skip to main content
Version: v2.x

Azure Monitor Integration on Hasura Cloud

Introduction

You can export metrics, operation logs and traces of your Hasura Cloud project to Azure Monitor. This can be configured on the integrations tab on the project's setting page.

Note

For Hasura Cloud projects, the Azure Monitor Integration is only available on the Standard (pay-as-you-go) tier and above.

More metrics on OpenTelemetry exporter

Try the new OpenTelemetry exporter to get advanced metrics and traces to connect with Azure Monitor. This integration will export the metrics as detailed here.

Pre-requisites

  • 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 to 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 to 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
  • Create an Application Insights resource in Azure.

  • From the Overview tab of the created Application Insights resource, retrieve Instrumentation Key

    Instrumentation Key

Configure Azure Monitor integration

On the Project settings page, navigate to Integrations > Azure Monitor.

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:

FieldDescription
NamespaceNamespaces are a way to categorize or group similar metrics together.
Log typeThe 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 Connect Integration.

Checking the status of the integration

The green/red dot signifies the status of the integration. For each of the telemetry types (logs, metrics, traces) green signifies successful exporting of the telemetry to Azure monitor. Last Exported is continuously updated, indicating the timestamp of the last telemetry (log, metric, trace) successfully exported to your Azure monitor dashboard.

Azure monitor Integration successfully configured

In case of error while exporting any of telemetries(logs, metrics, traces) to Azure monitor, the dot becomes red and the error messages/instructions are displayed. Click Update Settings button to update the config parameters.

Azure monitor Integration unable to push logs

View metrics

The integration exports the following five metrics to Azure monitor:

Metric ExportedMetric Name in Azure monitor
Average number of requestsaverage_requests_per_minute
Average request execution timeaverage_execution_time
Success rate of requestssuccess_rate
Active subscriptionsactive_subscriptions
Number of websockets openwebsockets_open

Non-zero values of all the above metrics are exported over a 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

View traces

To navigate to Azure monitor traces dashboard, click View traces.

Application Insights Instrumentation Key

Select the appropriate Application Insights and click Transaction search. The traces can be filtered using Trace and Dependency Event types. Clicking any of the Dependency result shows the End-to-end transaction details for the corresponding trace.

Traces successfully exported to Azure monitor