docs/docs/observability/opentelemetry/grafana-cloud-otlp-guide.mdx
import Thumbnail from '@site/src/components/Thumbnail';
Grafana Cloud provides a free tier that allows you to monitor and visualize your traces, metrics, and logs. By integrating Grafana Cloud with Hasura Cloud using OpenTelemetry, you can effectively monitor your Hasura GraphQL Engine and data connectors. This guide will walk you through the steps to integrate Grafana Cloud's OTLP endpoint with Hasura Cloud, enabling you to visualize and analyze your telemetry data effectively.
Begin by logging into your existing Grafana Cloud account, or create a new one here.
<Thumbnail src="/img/observability/hge_otlp_integration_grafana_1.png" alt="Grafana Cloud Login" width="1400px" />After logging in, you will be prompted to create a new stack if you don't have one.
<Thumbnail src="/img/observability/hge_otlp_integration_grafana_2.png" alt="Create a New Stack in Grafana Cloud" width="1400px" />
Get the OTLP Endpoint Details by going to your stack's details and then locatin gthe OTLP ednpoint URL and instance ID. Then, create an API token:
<Thumbnail src="/img/observability/hge_otlp_integration_grafana_3.png" alt="OTLP Endpoint Details" width="1400px" />After logging into your Hasura Cloud account at hasura.io, go to your project's settings page and navigate to the project you want to configure. Then, open the settings page and add the OTLP Endpoint as an environment variable in Hasura Cloud.
OTLP_ENDPOINThttps://your-grafana-cloud-otlp-endpoint<Thumbnail src="/img/observability/hge_otlp_integration_grafana_4.png" alt="Add Environment Variable for OTLP Endpoint" width="1400px" />
Next, add the OTLP authorization header as an environment variable in Hasura Cloud.
OTLP_AUTH_HEADERBasic <base64(InstanceID:APIToken)><Thumbnail src="/img/observability/hge_otlp_integration_grafana_5.png" alt="Add Environment Variable for OTLP Authorization Header" width="1400px" />
Then, configure the OpenTelemetry Exporter in Hasura Cloud by opening the project's Console and navigating to the
OpenTelemetry Exporter section of the settings tab.
Set the status to enabled and enter the details for the OTLP exporter:
Traces Endpoint: {{OTLP_ENDPOINT}}/v1/traces
Metrics Endpoint: {{OTLP_ENDPOINT}}/v1/metrics
Logs Endpoint: {{OTLP_ENDPOINT}}/v1/logs
Headers: Add the environment variable OTLP_AUTH_HEADER as the value for the Authorization header.
<Thumbnail src="/img/observability/hge_otlp_integration_grafana_6.png" alt="OpenTelemetry Configuration" width="1400px" />
Finally, save and apply the configuration changes by clicking "Connect".
Perform some operations on your Hasura API to generate traces, metrics, and logs. Then log into you Grafana Cloud instance and navigate to the explore section to view the traces, metrics, and logs.
<Thumbnail src="/img/observability/hge_otlp_integration_grafana_7.png" alt="Grafana Cloud Logs" width="1400px" />There are some ready-made dashboards available for Hasura Cloud on Grafana's website here. Import these dashboards into your Grafana Cloud instance for immediate visualization of your Hasura Cloud metrics.
Additionally, you can use the Grafana UI to create additional custom dashboards that visualize the traces and metrics from Hasura.
You can also set up alerts on this data in Grafana Cloud to monitor your Hasura Cloud instance effectively.
For more detailed information, refer to the Hasura OpenTelemetry documentation. By following these steps, you can successfully integrate Grafana Cloud's OTLP endpoint with Hasura Cloud, import ready-made dashboards, and start monitoring your distributed traces effectively.