OpenTelemetry
GreptimeDB is an observability backend to consume OpenTelemetry Metrics natively via OTLP protocol. You can configure GreptimeDB as an OpenTelemetery collector for your applications or agents.
OpenTelemetry API/SDK
To send OpenTelemetry Metrics to GreptimeDB through OpenTelemetry SDK libraries, use the following information:
- URL: https://<host>/v1/otlp/v1/metrics
- Headers:
- X-Greptime-DB-Name:- <dbname>
- Authorization:- Basicauthentication, which is a Base64 encoded string of- <username>:<password>. For more information, please refer to Authentication and HTTP API
 
The request uses binary protobuf to encode the payload, so you need to use packages that support HTTP/protobuf. For example, in Node.js, you can use exporter-trace-otlp-proto; in Go, you can use go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp; in Java, you can use io.opentelemetry:opentelemetry-exporter-otlp; and in Python, you can use opentelemetry-exporter-otlp-proto-http.
The package names may change according to OpenTelemetry, so we recommend that you refer to the official OpenTelemetry documentation for the most up-to-date information.
OpenTelemetry Collector
We recommend Grafana Alloy as OTel collector if you use OpenTelemetry transformation or other advanced features.
A sample configuration for exporting to GreptimeDB:
otelcol.exporter.otlphttp "greptimedb" {
  client {
    endpoint = "https://<host>/v1/otlp/"
    headers  = {
      "X-Greptime-DB-Name" = "<dbname>",
    }
    auth     = otelcol.auth.basic.credentials.handler
  }
}
otelcol.auth.basic "credentials" {
  username = "<username>"
  password = "<password>"
}