LiteLLM logs in Grafana with Prometheus, Loki and Tempo

Connect a self-hosted LiteLLM gateway to Grafana using Prometheus metrics, OTLP traces and Loki logs, and build the dashboards and alerts that matter first. Answers how the parts connect, what to configure, and what to test.

On this page

How LiteLLM reaches Grafana through Prometheus, OTLP and Loki

A shared LiteLLM gateway carries provider traffic for many teams, so the platform team needs metrics, traces and logs in Grafana without building anything custom. Three documented paths cover this: Prometheus scrapes the gateway's /metrics endpoint, including the litellm_in_flight_requests gauge; OTLP exports traces and metrics to a Grafana Cloud endpoint when LITELLM_OTEL_V2 and LITELLM_OTEL_INTEGRATION_ENABLE_METRICS are set to true; and request logs leave the gateway through a log shipper into Loki. LiteLLM does not provide a Grafana connector beyond these paths, so every integration point is a configuration decision you own and must verify against your LiteLLM version.

The stack is several separate products. Prometheus, Loki and Grafana each have their own licenses, release cadence and operating model. Prometheus is Apache-2.0 licensed and runs as a single-node store, so its local data needs its own retention planning. Loki and Grafana are AGPLv3 licensed, and Grafana Labs also offers Grafana Enterprise and Grafana Cloud as separate commercial options. Confirm the license terms that apply to your use before you choose between self-hosting and Grafana Cloud. The OTLP path to Grafana Cloud needs an access policy token with traces:write and metrics:write scopes, which your security team should review and store in a secret manager.

Decide early which path carries which signal, because the paths overlap. Metrics can arrive through Prometheus scraping or OTLP, and running both will create duplicate series if you do not separate them. Confirm which LiteLLM release supports the OTLP settings you plan to use, and check the LiteLLM Grafana Cloud documentation before enabling them in production. Then test each path with a single key and a known request before you connect the whole gateway, so you can tell a broken scrape from a broken export.

What you need before connecting LiteLLM to Grafana

Connecting a self-hosted LiteLLM gateway to Grafana touches the gateway, its database, the metrics endpoint, the telemetry path and the Grafana stack itself. Confirm each of these components before you configure any exporter, because most failed rollouts trace back to a missing dependency or an unauthenticated endpoint.

LiteLLM version and shared state

Pin the LiteLLM release you will run and check it against the release line your organization supports, using the current entries on the LiteLLM releases page. Multi-instance gateways need PostgreSQL as the primary database and Redis 7.0 or newer for shared rate limits, router state and cache. Without Redis, two proxy replicas can disagree on limits, and metrics per instance will not add up to a single view of spend and traffic.

Production guide

Authenticated metrics endpoint

LiteLLM exposes a litellm_in_flight_requests gauge and other series at /metrics. Treat that endpoint as internal: place it behind your network policy or an authenticated path so only your Prometheus or collector can scrape it. Check the scrape job's credentials and the ingress rules before you open the gateway to other networks, since request volume and model names can reveal usage patterns.

Grafana edition and HA database

A single Grafana server can use the default SQLite store for a small pilot, but the installation docs say SQLite does not scale for production. For high availability, run two or more Grafana servers behind a load balancer sharing MySQL 8.0 or later or PostgreSQL 12 or later. Confirm that alerting is configured to avoid duplicate notifications across nodes, and check which Grafana Live features your dashboards depend on.

High availability docs

Prometheus and Loki versions

Choose the Prometheus release line you will run, since the current LTS line is 3.13 and receives bug fixes for one year. Pick a Loki release from the current series and confirm its deployment mode before you size storage. Loki's simple scalable mode is being deprecated and will be removed with Loki 4.0, so a new install should plan for monolithic or microservices layouts.

Prometheus release cycle

Object storage for Loki

Loki keeps compressed log chunks and its index in object storage, and retention is disabled by default, so logs persist until you enable it. Use a production-grade store such as Amazon S3, Google Cloud Storage or Azure Blob Storage with a named bucket, access policy and lifecycle rules. Decide retention for prompt-adjacent metadata before the first ingest, because deleting logs later is harder than setting the rule up front.

Loki retention docs

Network paths and Grafana Cloud token

Map every hop from the gateway to the destination: the gateway to an OpenTelemetry collector or directly to Grafana Cloud, Prometheus to the gateway, and Grafana to Loki and Prometheus. For Grafana Cloud, create an access policy token with traces:write and metrics:write scopes, store it in a secret manager and rotate it on your schedule. Confirm egress rules and proxies allow the endpoints before you enable the LiteLLM variables.

LiteLLM Grafana Cloud docs

Which telemetry path fits your Grafana setup

This path sends LiteLLM traces and metrics over OpenTelemetry Protocol to a hosted Grafana Cloud stack. You enable the OTLP integration with the LITELLM_OTEL_V2 and LITELLM_OTEL_INTEGRATION_ENABLE_METRICS settings and authenticate with an access policy token that carries the traces:write and metrics:write scopes. Grafana Labs operates the storage and query layer, so your team owns the gateway configuration, token handling and the network path out of your environment.

  • What it sends: Traces and metrics from the gateway. Confirm with your Grafana Cloud contact whether request bodies or prompt text leave your environment through this path, since that depends on your logging settings.
  • Who operates it: Grafana Labs runs the backend. Your team rotates the access policy token and monitors export failures on the gateway side.
  • Residency: Ask which Grafana Cloud region hosts your stack and whether it satisfies your data location requirements before you create the stack.
  • Cost drivers: Platform fees and usage-based charges recur. Check current tiers on the Grafana pricing page and request a quote that states how ingest volume is billed.
  • Tooling fit: Choose this path when your teams already work in Grafana Cloud and do not want to run Prometheus or Loki themselves.

Confirm the hosting region, the token scope and the contents of exported spans against your data handling policy before enabling it in production.

Configure the LiteLLM to Grafana connection in order

This sequence connects a self-hosted LiteLLM gateway to a Grafana stack so that request metrics, traces and logs arrive in tools your operations team already uses, with a closing check at each step.

  1. Store gateway and Grafana credentials in a secret manager

    The platform team places LITELLM_MASTER_KEY, which must start with sk-, and the Grafana Cloud access policy token with traces:write and metrics:write scopes into the secret manager your organization already runs. Pods read these values at start time rather than from files in the repository or in plain environment definitions. The step is done when the gateway deployment starts from secret references and no credential appears in its configuration files or version control history.

  2. Enable OTLP v2 and metrics export on LiteLLM

    Set LITELLM_OTEL_V2=true and LITELLM_OTEL_INTEGRATION_ENABLE_METRICS=true on the proxy, then point the OTLP exporter at your Grafana Cloud endpoint with the token from the previous step. Confirm the exact endpoint and header format against the LiteLLM Grafana Cloud documentation for the version you run. The step is done when a test request produces a trace in Grafana and the proxy logs show no export errors.

  3. Expose and authenticate the LiteLLM metrics endpoint

    Confirm the proxy serves Prometheus metrics at /metrics, then restrict that path so only your Prometheus scraper can read it, for example through a network policy or an authenticating proxy in front of the gateway. Add a scrape job with the credential the scraper needs. The step is done when Prometheus shows the target as up and a query for litellm_in_flight_requests returns a visible series while a test request is in progress.

  4. Deploy Grafana with a production database

    Install Grafana by your standard method (packages, Docker image or Helm chart) and configure it to use PostgreSQL or MySQL rather than the default SQLite, because SQLite is not suitable for production. Set authentication through your identity provider and load the Prometheus, Loki and Tempo data sources from provisioning files so they are reproducible. The step is done when Grafana starts, the provisioned data sources report healthy connections, and a login through your identity provider succeeds.

  5. Ship gateway logs to Loki with a tenant header

    Run a log shipper such as Grafana Alloy on the gateway hosts or cluster to forward LiteLLM container logs to Loki. If Loki runs with auth_enabled set to true, configure the shipper to send the X-Scope-OrgID header on every request, and place an authenticating reverse proxy in front of Loki because Loki has no built-in authentication layer. The step is done when a LiteLLM log line filtered by its labels appears in Grafana Explore under the expected tenant.

  6. Confirm the trace path in the Grafana trace view

    Send one request through a test virtual key, then open the trace in Grafana's trace view and check that the span for the proxy call is present with its model and status attributes. Compare the trace timestamp with the matching log line to confirm that the same request reaches both signals. The step is done when the trace and the log entry can be matched by a shared identifier, which shows the connection works end to end.

  7. Build the first dashboard and alert rules

    Create a dashboard that charts request rate, latency, spend and litellm_in_flight_requests from Prometheus, and add a Loki panel for error lines. Define alert rules for sustained in-flight growth and error rate, and route them through Alertmanager, pointing Prometheus at every Alertmanager instance if you run more than one. Export the dashboards and rules as provisioning files so the setup can be reviewed and rebuilt. The step is done when a test alert fires and reaches the intended receiver.

Which dashboards and alerts to build first

Build the first dashboard around five questions: how many requests the gateway is handling, how long they take, how many are in flight, what they cost, and how many fail, broken down by team or virtual key. Prometheus scrapes the LiteLLM /metrics endpoint, so the in-flight gauge litellm_in_flight_requests is the signal to watch first. Put request volume, latency percentiles and error rate on the same time axis as in-flight requests so a backlog can be traced to a slow provider or a failing key. Spend panels are useful for trends and for spotting a runaway team, but treat them as operational views rather than invoices.

The alerts to add first are the ones that catch a degrading gateway early: in-flight requests rising steadily over a sustained window rather than spiking once, an error rate that stays above a threshold you set from your own baseline, and spend approaching the budget limits you configured on keys, users and teams. Confirm the exact metric names and label sets in your LiteLLM version before writing rules, because dashboards built on guessed names fail silently. Prometheus values reliability over precision and is not suited to per-request billing, so use LiteLLM's own spend records or the provider bill for chargeback and reconciliation.

Alerts only work if they reach someone. Prometheus must be configured to send alerts to every Alertmanager instance, not through a load balancer, and if you run Alertmanager as a cluster you need its --cluster settings in place so grouping, silences and inhibition behave consistently. Test the path end to end by firing a test alert and confirming the receiver gets it, then review the thresholds after the first few weeks of real traffic. Ask your Grafana and Prometheus administrators to confirm who owns each alert rule and who is paged when it fires.

How LiteLLM signals map to Grafana data sources

This table shows which LiteLLM signal goes to which Grafana-side store, what the carrier is and what to confirm before you build. Read it as a routing plan: each row names where data lands and which part still needs checking in your own environment. The main takeaway is that metrics, traces, logs and alerts each have a separate store, so each needs its own retention, access and ownership decision.

SignalCarrier and storeLabels and identityConfirm before building
Request and latency metricsPrometheus scrapes the LiteLLM /metrics endpointLabels come from the metric names your gateway exposes; avoid adding per-user labelsExact metric names in your own /metrics output
In-flight requestslitellm_in_flight_requests gauge in PrometheusGauge is sampled at scrape time, so it shows load, not per-request detailGauge is present on your release and scrape interval fits your load
TracesOTLP export to a Grafana trace store such as Tempo or Grafana Cloud tracesTrace attributes carry request context; confirm which metadata is attachedExport flags and the access policy token scopes for your Grafana setup
Request logsLog shipper (such as Grafana Alloy) to LokiTenant set with the X-Scope-OrgID header when auth_enabled is true; labels such as team or model only if confirmedWhich label names your log pipeline can create without high cardinality
Spend and budget signalsPrometheus metrics for spend, if exposed, otherwise logs in LokiKeep per-key identifiers out of metric labels to limit series growthWhether spend is exposed as a metric or only in logs on your version
Alert rulesPrometheus rules routed to Alertmanager, or Grafana alerting on any data sourceRouting keys follow the labels your rules produceSingle notification path, since Grafana HA needs extra setup to avoid duplicates
DashboardsGrafana reading Prometheus, Loki and Tempo as separate data sourcesDashboard variables should match the label names you confirmedProvisioned as code so panels survive upgrades

Securing the Grafana path for LLM telemetry

Telemetry from a LiteLLM gateway often carries more sensitive detail than teams expect: model usage, spend, user and team identifiers and, if enabled, prompt content. The controls below cover who can reach the metrics endpoint, how Grafana and Loki are protected, and what is kept out of logs by default.

Authenticate the metrics endpoint

LiteLLM exposes Prometheus metrics at /metrics, including the litellm_in_flight_requests gauge. Those series reveal traffic volume, model names and error patterns, so the endpoint should not be open to the whole network. Confirm how your LiteLLM version restricts /metrics, place it on an internal network path or behind your ingress, and confirm that Prometheus scrapes it with credentials your team controls. Test the endpoint from an unauthorized host before go-live.

Latency overhead docs

Harden Grafana cookies and metrics access

The Grafana security hardening guide recommends secure and SameSite cookies, a Content Security Policy, Trusted Types, hiding the version from unauthenticated users, and requiring authentication for Grafana's own metrics endpoint. Domain verification guards against DNS rebinding. Apply these settings in the Grafana configuration file, then verify them with a browser and an unauthenticated request so the result is documented for the security review.

Security hardening docs

Sign in through an edition-supported identity provider

Grafana's free editions support Entra ID, Okta, Google and generic OAuth, so local accounts can be avoided for most users. SAML, team sync and SCIM provisioning are limited to Grafana Enterprise and Grafana Cloud, which affects how group membership maps to dashboard folders. Decide which roles may edit alert rules and data sources, and confirm with your identity team which group claims reach Grafana before you grant access to production telemetry.

Authentication docs

Place Loki behind an authenticating proxy

Loki has no built-in authentication layer, so anything that reaches its HTTP port can read or write logs. Run an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium in front of it, and set X-Scope-OrgID at the proxy rather than trusting callers to set it. Keep the Loki ports off public networks and confirm that Alloy or other shippers reach Loki through the authenticated path.

Loki authentication docs

Keep prompt content out of telemetry

Metrics and traces should carry model, team, key alias, token counts and latency, not message bodies. Confirm that the LiteLLM OpenTelemetry settings you enable do not attach request or response content to spans, and that Alloy pipelines drop any fields that do. If the team decides to store prompts, document the decision, the retention period and who can query those logs, because Loki keeps data indefinitely until retention is configured.

Loki retention docs

Limit the scope of the metrics token

The Grafana Cloud path uses an access policy token with traces:write and metrics:write scopes. Create a dedicated policy for the LiteLLM gateway, grant only those two scopes, store the token in a secret manager, and rotate it on a schedule your security team sets. Review which token writes to which stack, and remove tokens that belong to retired gateways or test environments.

LiteLLM Grafana Cloud docs

Why the LiteLLM Grafana feed goes quiet

This table lists the failures that most often leave a Grafana view of LiteLLM empty, duplicated or incomplete, with the likely cause and the documented setting to check. Read each row against what you see in Grafana, then confirm the setting in your own configuration before changing anything.

SymptomLikely causeFix to check
No LiteLLM metrics in PrometheusThe scrape job for the /metrics endpoint lacks credentials, so Prometheus receives authentication errors instead of samplesAdd the scrape credentials to the Prometheus job, then confirm the target shows as up and litellm_in_flight_requests appears in the expression browser
No traces in Grafana CloudThe access policy token does not include the traces:write scopeCreate a token with traces:write and metrics:write scopes, set it in LITELLM_OTEL_V2 and LITELLM_OTEL_INTEGRATION_ENABLE_METRICS configuration, and send a test request
Metrics arrive but traces do not, or the reverseOnly one of the two OTLP signals was enabled or its token scope is missingCheck both signal settings and token scopes separately, since traces and metrics are authorized independently
Duplicate alert notifications from a Grafana HA pairBoth Grafana servers evaluate and send the same alert rules without the additional alerting configuration the HA docs describeApply the alerting HA settings from the Grafana high availability docs so only one node notifies, and confirm with a test alert
Loki storage grows without limitRetention is disabled by default, so the compactor keeps logs indefinitely until retention_enabled is setSet retention_enabled and a retention period in the Loki configuration, noting that each stream rule must be at least 24 hours
Prometheus history missing for the review windowLocal retention defaults to 15 days, and local storage is not replicatedSet retention by time or size to cover the review period, or send samples to external long-term storage through remote write
Loki returns no data or rejects queriesMulti-tenancy is enabled but the client does not send the X-Scope-OrgID header, or the header value does not match the tenant that wrote the logsSend the same tenant header from the shipper and the Grafana data source, and confirm auth_enabled in the Loki configuration

Questions teams ask before connecting LiteLLM to Grafana

What does it cost to connect LiteLLM to Grafana?

The software is free to use, so the cost is infrastructure plus the people who build and run it. Infrastructure covers compute for Grafana, Prometheus, Loki and Tempo, object storage for logs and traces, a PostgreSQL database for Grafana configuration, and network and backup capacity. People cover the initial design and build, dashboard and alert work, and ongoing upgrades, storage tuning and on-call response. Recurring costs grow with log volume, trace retention and the number of series Prometheus must hold, so ask any partner for a quote that separates one-time build effort from monthly running costs and states the assumed request volume and retention periods.

Is Grafana Cloud or a self-hosted Grafana stack cheaper to operate?

It depends on how much operational work your team wants to own, and on your data volume. Grafana's pricing page lists a Pro tier starting with a 19 US dollar monthly platform fee plus usage, and an Enterprise tier with a minimum commitment of 25,000 US dollars per year. Self-hosting removes the platform fee but adds server, storage, backup, upgrade and on-call costs. Grafana's upgrade guidance also sets support windows that your team must keep pace with. Compare total monthly usage charges with the staff hours a self-hosted stack would need, and confirm current prices directly on the pricing page before deciding.

How long does it take to validate a first set of LiteLLM dashboards?

Duration depends on how quickly the gateway's metrics reach Prometheus and how many dashboards and alerts are in scope. The first step is confirming that the /metrics endpoint is scraped and that the litellm_in_flight_requests gauge appears, then checking request, latency and spend series under realistic traffic. Traces need the OTLP settings and a valid access policy token before they can be checked. Validation also depends on your staff's availability, change windows and how many test runs you need. Ask for a written plan with named validation checkpoints rather than a fixed date set without seeing your environment.

What does our team need to provide before the work starts?

Plan on providing access and decisions rather than only budget. You will need a LiteLLM deployment you can reach, a Grafana or Grafana Cloud environment, a place to run Prometheus and storage for logs and traces, and a named owner for alert routing. Security teams should confirm which prompt and metadata fields may leave the gateway, where secrets such as the access policy token are stored, and how dashboards are authenticated. Engineering should provide sample traffic and expected request volume. Confirm each item in your scope document so nothing is assumed.

Can our own team set up LiteLLM monitoring in Grafana without outside help?

Yes, a team with Kubernetes or infrastructure experience and some Prometheus knowledge can often build a basic setup internally. The harder parts are sizing storage, securing endpoints, deciding retention and writing alerts that do not fire constantly. Loki has no built-in authentication layer, so an authenticating reverse proxy is required in front of it, and Prometheus is not a good choice where exact per-request accuracy is needed, such as billing. Many teams do the build themselves and bring in a partner for review, hardening or an upgrade plan. Decide which parts you will own before you choose.

Does Grafana's AGPLv3 license for Loki affect how we use it?

Grafana Labs relicensed Loki, Grafana and Tempo to AGPLv3 on April 20, 2021, and Loki is licensed under AGPLv3 today. Running Loki internally for your own organization is generally a different question from offering a modified version to users over a network, which AGPLv3 addresses. Prometheus, by contrast, is Apache-2.0. Ask your legal team to review how your deployment and any modifications fit your obligations, and check Grafana's licensing page for the current terms and for the commercial Grafana Enterprise option.

Which Grafana and Prometheus versions should we plan around?

Choose supported release lines before you install anything. Prometheus publishes a new minor release every 6 weeks, and its long-term support line 3.13 is supported until July 31, 2027. Grafana's guidance says each minor release is supported for 9 months and the last minor release of a major version for 15 months, with patch releases at least monthly. Pin versions in your configuration, track end-of-life dates, and schedule upgrades as recurring work. Confirm the current versions on each project's release page at the time you start.

How telemetry flows from the gateway into Grafana

The diagram starts at the LiteLLM proxy pods inside the gateway network. Prometheus pulls the /metrics endpoint, including the litellm_in_flight_requests gauge, while the proxy pushes OTLP traces and metrics to a collector or Grafana Cloud. Logs leave through Grafana Alloy and pass an authenticating reverse proxy before reaching Loki, because Loki has no built-in authentication. Grafana queries all three stores, and Alertmanager receives alerts from Prometheus. Check each boundary crossing: credentials for OTLP, who can scrape /metrics, and the tenant header on log writes.

Telemetry paths from LiteLLM pods to Grafana, with trust boundary.

Running Prometheus, Loki and Grafana after go-live

The version support windows for this stack are short enough to plan around from day one. Prometheus minor releases generally stop receiving bug fixes about six weeks after their release, so a team that runs a non-LTS line must upgrade on a near-continuous cadence. Prometheus long-term support lines receive bug fixes for one year, which is the safer choice for a gateway team that cannot upgrade every month. Grafana minor releases are supported for nine months, the last minor release of a major version for 15 months, and Grafana's upgrade guidance expects patch releases at least monthly. Loki's documentation states that simple scalable deployment mode is being deprecated and will be removed with Loki 4.0, so a team that starts on that mode will need a migration plan before that release. Confirm the current end-of-support dates for each component against the Prometheus release cycle page, the Grafana upgrade guidance and the Loki releases page before you commit to a version.

Upgrade ownership should be written down before go-live, with one named owner per component and a named owner for the LiteLLM side of the metric contract. The LiteLLM metric names and the litellm_in_flight_requests gauge can change between LiteLLM releases, so an upgrade of the gateway can break dashboards and alert rules even when the observability stack itself is unchanged. Test each upgrade in a staging Grafana against a copy of the dashboards, check that the panels and alert queries still return data, and only then roll forward. Store dashboards and alert rules as provisioned files so that a rebuild after an upgrade does not depend on someone's memory of how a panel was built.

Retention is a decision the team must make on purpose, because the defaults differ across the stack. Prometheus keeps local data for 15 days by default and is not clustered or replicated, so anything longer belongs in external long-term storage through remote write. Loki keeps logs indefinitely until the compactor's retention is enabled, which matters because request-level logs can contain sensitive prompt metadata. Set retention per tenant or per stream selector, and record the chosen periods in the same review that approves what the gateway logs. Ask your observability and compliance owners which retention periods they require, and confirm the Loki and Prometheus settings against the current docs for the versions you run.

How DeployOpen scopes and supports LiteLLM observability in Grafana

DeployOpen approaches LiteLLM logs in Grafana as a planned build with a written scope, covering Prometheus metrics, OTLP traces, Loki logs and the dashboards and alerts your operators will use. We build it inside infrastructure you control and hand over documentation your team can run.

How we scope

  • We confirm which Grafana stack you run or will run, and whether it is self-hosted or Grafana Cloud.
  • We agree in writing which metrics, traces, log streams and alert rules are in scope for the gateway.
  • We record retention, tenant, access and data handling decisions for prompt-adjacent logs before build starts.

How we build

  • We configure Prometheus scraping of the LiteLLM metrics endpoint and check gauges such as litellm_in_flight_requests.
  • We set up OTLP export from LiteLLM to your collector or Grafana Cloud, with scoped access tokens and tested traces.
  • We build the dashboards and alert rules agreed in scope, then test them against controlled gateway traffic.

How we hand over

  • We deliver the provisioning files, dashboard definitions and alert rule documentation so your team can reproduce the setup.
  • We document each data source, retention setting, token scope and the owner of every alert route.
  • We walk your operators through runbooks for common alerts and the checks to run before escalating.

How we support

  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
  • Ongoing support, upgrades of Grafana, Prometheus and Loki, and continuous checks are available as a retainer.
  • Before you start, confirm with your team which Grafana, Prometheus and Loki versions you will run and their support windows.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.