> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usedatabrain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Kloudfuse integration

# Integrating Databrain with Kloudfuse

This guide explains how to send OpenTelemetry traces and metrics from your self-hosted Databrain instance to Kloudfuse.

## Prerequisites

* Databrain self-hosted version with OpenTelemetry support
* Kloudfuse account with OTLP ingestion enabled
* Your Kloudfuse OTLP endpoint URL

## Configuration

### 1. Get Your Kloudfuse OTLP Endpoint

In your Kloudfuse console, locate your OTLP ingestion endpoint. It typically follows this format:

```
https://<your-kloudfuse-instance>.kloudfuse.io/otlp
```

Or if using the Kloudfuse collector deployed in your cluster:

```
http://kfuse-otel-collector.kloudfuse.svc.cluster.local:4318
```

### 2. Configure Databrain Environment Variables

Add these environment variables to your Databrain backend service:

```bash theme={"dark"}
# Enable OpenTelemetry
OTEL_ENABLED=true

# Kloudfuse OTLP endpoint (HTTP)
OTEL_EXPORTER_OTLP_ENDPOINT=https://<your-kloudfuse-instance>.kloudfuse.io/otlp

# Service name (appears in Kloudfuse UI)
OTEL_SERVICE_NAME=databrain-api

# Optional: Set log level for debugging
LOG_LEVEL=info
```

### 3. Docker Compose Configuration

Update your `docker-compose.yml`:

```yaml theme={"dark"}
services:
  databrainbackend:
    environment:
      OTEL_ENABLED: "true"
      OTEL_EXPORTER_OTLP_ENDPOINT: "https://<your-kloudfuse-instance>.kloudfuse.io/otlp"
      OTEL_SERVICE_NAME: "databrain-api"
      LOG_LEVEL: "info"
```

### 4. Kubernetes Configuration

If deploying on Kubernetes, add to your deployment:

```yaml theme={"dark"}
env:
  - name: OTEL_ENABLED
    value: "true"
  - name: OTEL_EXPORTER_OTLP_ENDPOINT
    value: "http://kfuse-otel-collector.kloudfuse.svc.cluster.local:4318"
  - name: OTEL_SERVICE_NAME
    value: "databrain-api"
```

## What Gets Sent to Kloudfuse

Once configured, Databrain automatically sends:

| Telemetry Type | Description                                              |
| -------------- | -------------------------------------------------------- |
| **Traces**     | API request spans with timing, status codes, and errors  |
| **Metrics**    | Request latency histograms, error rates, throughput      |
| **Logs**       | Correlated logs with trace context (trace\_id, span\_id) |

## Verification

1. **Restart Databrain** after configuration changes
2. **Make a few API requests** to generate telemetry
3. **Check Kloudfuse UI**:
   * Navigate to **Traces** → filter by `service.name = databrain-api`
   * Check **Metrics** for `http.server.duration` histograms
   * View **Logs** correlated with trace IDs

## Troubleshooting

| Issue                | Solution                                                         |
| -------------------- | ---------------------------------------------------------------- |
| No data in Kloudfuse | Verify `OTEL_ENABLED=true` and endpoint is reachable             |
| Connection refused   | Check network connectivity and firewall rules                    |
| 401/403 errors       | Verify Kloudfuse API credentials if authentication is required   |
| Missing traces       | Ensure requests are being made; traces appear after \~30 seconds |

### Debug Mode

Enable debug logging to troubleshoot:

```bash theme={"dark"}
LOG_LEVEL=debug
```

Check Databrain logs for messages like:

```
OpenTelemetry initialized successfully
Exporting traces to: https://...
```

## Support

For Kloudfuse-specific issues, contact [Kloudfuse support](https://kloudfuse.com/support).
For Databrain configuration issues, contact your Databrain support team.
