I need to send metrics from LiveKit to Sentry. In ...
# ask-ai
c
I need to send metrics from LiveKit to Sentry. In the documentation there is an example how to connect LangFuse https://docs.livekit.io/agents/build/metrics/. Could you make an example for Sentry integration for me?
t
Thanks for reaching out, Anna. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I understand you're looking to connect LiveKit with Sentry for sending metrics. While LiveKit doesn’t have a direct integration with Sentry, a great way to achieve this is by using the OpenTelemetry integration within LiveKit to gather your telemetry data. OpenTelemetry offers a variety of exporters, and you can often forward this data to Sentry through their APIs or SDKs. If you'd like, I’m here to help you set up OpenTelemetry or assist you in creating a custom solution to send those metrics to Sentry. Just let me know, and we can work through it together! Sources: Sources/LiveKit/Track/Metrics/MetricsManager.swift | Logs, metrics, and telemetry | LiveKit Docs | metrics/send-metrics-to-3p/send_metrics_to_3p.py
c
How to use OpenTelemetry to send data to Sentry. I do not understand the authentication part from the example
Copy code
langfuse_auth = base64.b64encode(f"{public_key}:{secret_key}".encode()).decode()
    os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = f"{host.rstrip('/')}/api/public/otel"
    os.environ["OTEL_EXPORTER_OTLP_HEADERS"] = f"Authorization=Basic {langfuse_auth}"
What auth should be done for Sentry?
t
Thanks for reaching out! I understand that finding specific details about authenticating OpenTelemetry with Sentry in the LiveKit documentation can be a bit tricky. Usually, with Sentry, you'd use their OpenTelemetry SDK or an OTLP-compatible exporter. The authentication part typically involves setting an endpoint and adding an authentication token, which you can find in your Sentry project settings. To help you move forward smoothly, I suggest taking a look at Sentry's documentation on OpenTelemetry integration to get the exact details on authentication and required headers. And please, if you have any questions or need a hand with setting up OpenTelemetry in LiveKit, just let me know—I’m here to help! Sources: Logs, metrics, and telemetry | LiveKit Docs | livekit-agents/livekit/agents/telemetry/traces.py