Skip to main content

Integrating Databrain with Grafana Cloud

This guide explains how to send OpenTelemetry traces, metrics, and logs from your self-hosted Databrain instance to Grafana Cloud.

Prerequisites

  • Databrain self-hosted version with OpenTelemetry support
  • Grafana Cloud account (free tier available)
  • Grafana Cloud API token

What You’ll Get

Grafana Cloud provides three integrated observability products:

Configuration

1. Get Your Grafana Cloud Credentials

  1. Log into Grafana Cloud
  2. Navigate to your stack (e.g., yourstack.grafana.net)
  3. Go to ConnectionsAdd new connectionOpenTelemetry
  4. Note the following:
    • Tempo endpoint: tempo-<region>.grafana.net:443
    • Prometheus endpoint: prometheus-<region>.grafana.net:443
    • Loki endpoint: logs-<region>.grafana.net
    • Instance ID: Your unique instance identifier
    • API Token: Generate one under Access Policies
Grafana Alloy is the easiest way to send telemetry to Grafana Cloud. It replaces the generic OpenTelemetry Collector.

Docker Compose Configuration

Alloy Configuration

Create alloy-config.alloy:

3. Alternative: Direct OTLP to Grafana Cloud

You can also send data directly without Alloy (less flexible):
Note: This sends traces only. For metrics and logs, use Alloy.

4. Kubernetes with Grafana Agent

For Kubernetes, use the Grafana Agent Operator:

Verification

1. Check Alloy Status

Visit the Alloy UI: http://localhost:12345 You should see:
  • Active OTLP receivers
  • Successful exports to Grafana Cloud

2. Generate Test Traffic

3. View in Grafana Cloud

Tempo (Traces)

  1. Go to Explore in Grafana
  2. Select Tempo as the data source
  3. Query: {service.name="databrain-api"}
  4. You should see traces within 1-2 minutes

Prometheus (Metrics)

  1. Go to Explore
  2. Select Prometheus as the data source
  3. Query: rate(http_server_duration_milliseconds_count{service_name="databrain-api"}[5m])

Loki (Logs)

  1. Go to Explore
  2. Select Loki as the data source
  3. Query: {service_name="databrain-api"}
  4. Click on any log to see correlated traces

Creating Dashboards

Pre-built Dashboard

Import the OpenTelemetry APM dashboard:
  1. Go to DashboardsNewImport
  2. Use dashboard ID: 19419 (OpenTelemetry APM)
  3. Select your Tempo and Prometheus data sources
  4. Filter by service_name = databrain-api

Custom Dashboard Example

Create a new dashboard with these panels: Request Rate:
Average Latency:
Error Rate:
P95 Latency:

Setting Up Alerts

Grafana Alerting

Create alert rules in Grafana: High Error Rate:
  1. Go to AlertingAlert rulesNew alert rule
  2. Query:
  1. Threshold: Alert when value > 0.05 (5% errors)
  2. Add notification channel (email, Slack, PagerDuty)
High Latency:

Trace Exemplars

Link metrics to traces using exemplars:
Now when viewing metrics, you can click on data points to see example traces.

LogQL Queries

Use LogQL to query structured logs in Loki: All errors:
Slow requests (>1s):
Logs for specific user:
Logs with trace context:

Troubleshooting

Debug Alloy

Check Alloy logs:
View Alloy UI metrics:

Test Connectivity

Cost Optimization

Grafana Cloud free tier includes:
  • Tempo: 50 GB traces/month
  • Loki: 50 GB logs/month
  • Prometheus: 10k active series
Tips to stay within limits:
  1. Sampling: Sample traces in Alloy
  1. Filter low-value logs: Exclude health checks
  1. Set retention: Adjust in Grafana Cloud settings
    • Tempo: Default 7 days
    • Loki: Default 30 days
    • Prometheus: Default 13 months

Best Practices

1. Use Service Graph

Enable service graph in Tempo to visualize service dependencies:
  1. Go to TempoService Graph
  2. View request flow between services
  3. Identify bottlenecks and failures

2. Correlate Logs with Traces

When logging, Winston automatically includes trace context:
In Loki, click the trace ID to jump to the full trace in Tempo.

3. Use Grafana Oncall

Integrate with Grafana Oncall for advanced alert management:
  • On-call rotations
  • Escalation policies
  • Alert grouping and deduplication

Support

For Databrain configuration issues, contact your Databrain support team.