---
title: "How to Export Metrics to an OTLP Endpoint"
url: "https://www.openstatus.dev/docs/guides/how-to-export-metrics-to-otlp-endpoint"
date: "2018-10-20"
author: "openstatus"
description: "A step-by-step guide to sending openstatus metrics to your observability platform via OTLP."
category: "Guides"
---

## Problem

You want to analyze your openstatus monitoring data alongside other telemetry data in your existing observability platform (like Grafana, New Relic, or Honeycomb). You need a standardized way to export these metrics without building a custom integration.

## Solution

openstatus can export monitoring metrics to any OTLP (OpenTelemetry Protocol) compatible endpoint. Add an `open_telemetry` block to a monitor in your Terraform configuration and metrics from every check that monitor runs are sent straight to your monitoring stack.

## Prerequisites

- An observability platform that supports OTLP metric ingestion over HTTP.
- A workspace on a plan that includes OTLP export (**Pro** and **Scale**).
- Terraform and the [openstatus provider](/docs/reference/terraform) configured — see [Manage openstatus with Terraform](/docs/guides/how-to-manage-openstatus-with-terraform) if you have not set it up yet.

## Step-by-step guide

### 1. Locate your OTLP endpoint URL and headers

First, you need to find the specific URL and any required authentication headers from your observability platform. This is usually found in the documentation under "OTLP", "OpenTelemetry", or "Metrics Export".

- **Endpoint URL** — look for an HTTP endpoint for OTLP metrics. It typically ends in `/v1/metrics`. For example: `https://otlp.your-provider.com/v1/metrics`.
- **Headers** — you will likely need an authentication header, such as `Authorization: Bearer YOUR_API_KEY` or `X-API-Key: YOUR_API_KEY`.

### 2. Add an `open_telemetry` block to your monitor

`open_telemetry` is a block on the monitor resource, so each monitor declares its own export
target. It is available on every monitor type — `openstatus_http_monitor`,
`openstatus_tcp_monitor`, `openstatus_dns_monitor`, and `openstatus_icmp_monitor`.

```terraform
variable "otlp_token" {
  type      = string
  sensitive = true
}

resource "openstatus_http_monitor" "api" {
  name        = "API Health Check"
  url         = "https://api.example.com/health"
  periodicity = "1m"
  active      = true
  regions     = ["fly-iad", "fly-ams"]

  open_telemetry {
    endpoint = "https://otlp.your-provider.com/v1/metrics"

    headers {
      key   = "Authorization"
      value = "Bearer ${var.otlp_token}"
    }
  }
}
```

Mark the token `sensitive` and pass it in with `TF_VAR_otlp_token` or from a secrets manager
rather than committing it.

**Note**: Currently, we only support OTLP over HTTP.

### 3. Share one endpoint across many monitors

Because the block lives on each resource, put the endpoint and headers in a `locals` block and
use `dynamic` so a change to the destination is a one-line edit rather than a sweep across every
monitor:

```terraform
locals {
  otlp_endpoint = "https://otlp.your-provider.com/v1/metrics"
  otlp_headers = {
    Authorization = "Bearer ${var.otlp_token}"
  }
}

resource "openstatus_http_monitor" "api" {
  name        = "API Health Check"
  url         = "https://api.example.com/health"
  periodicity = "1m"
  active      = true
  regions     = ["fly-iad", "fly-ams"]

  open_telemetry {
    endpoint = local.otlp_endpoint

    dynamic "headers" {
      for_each = local.otlp_headers
      content {
        key   = headers.key
        value = headers.value
      }
    }
  }
}
```

### 4. Apply the configuration

```bash
terraform plan    # confirm only the open_telemetry block is changing
terraform apply
```

Once applied, openstatus sends metrics to your endpoint after every check completes.

### 5. Verify in your observability platform

Go to your observability platform and look for the new metrics coming from openstatus. You should be able to build dashboards and alerts based on this data.

Here are some examples of what it can look like:

#### Grafana

![openstatus metrics in grafana](/docs/guides/how-to-export-metrics-via-otel/grafana.png)

#### Honeycomb

![openstatus metrics in honeycomb](/docs/guides/how-to-export-metrics-via-otel/honeycomb.jpg)

#### New Relic

![openstatus metrics in new-relic](/docs/guides/how-to-export-metrics-via-otel/newrelic.jpg)

#### SigNoz

![openstatus metrics in signoz](/docs/guides/how-to-export-metrics-via-otel/signoz.jpg)