> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/deployment/self-hosted/inference-server/configuration/telemetry.md).

# Inference Server Telemetry

Service telemetry provides real-time data on system health, performance, and usage. It enables:

* **Monitoring and diagnostics:** early detection of issues for quick resolution.
* **Performance optimization:** identifying bottlenecks to improve efficiency.
* **Usage insights:** understanding user behavior to guide improvements.
* **Security:** detecting suspicious activity and ensuring compliance.
* **Scalability:** predicting and managing resource demands.

The Inference server exposes two sources of telemetry:

* [Prometheus](https://prometheus.io/) metrics
* Docker container metrics provided by the Docker daemon

## Prometheus metrics

To enable metrics, set the environment variable `ENABLE_PROMETHEUS=True` on your container:

```bash
docker run -p 9001:9001 -e ENABLE_PROMETHEUS=True roboflow/roboflow-inference-server-cpu
```

Then use the `GET /metrics` endpoint to fetch the metrics in Python:

```python
import requests

result = requests.get("http://127.0.0.1:9001/metrics")
result.raise_for_status()

print(result.text)
```

or with curl:

```bash
curl http://127.0.0.1:9001/metrics
```

{% hint style="info" %}
`/metrics` is one of the endpoints that stays unauthenticated even when [API-key authentication](/deployment/self-hosted/inference-server/configuration/security.md#2-enforce-authentication) is enabled, so restrict network access to the server if the metrics are sensitive.
{% endhint %}

## Docker container metrics

{% hint style="warning" %}
**Potential security issue.** This feature relies on exposing the Docker daemon socket inside the container. That exposes container resource utilization metrics without needing a supervisor service, but it may be considered a security violation. It is disabled by default. Acknowledge the [potential security risks](https://www.lvh.io/posts/dont-expose-the-docker-socket-not-even-to-a-container/) before enabling it.
{% endhint %}

To expose container metrics, run the Inference server container with the Docker socket mounted:

```bash
docker run -p 9001:9001 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -e DOCKER_SOCKET_PATH=/var/run/docker.sock \
  roboflow/roboflow-inference-server-cpu
```

* The `-v` line **mounts** the Docker daemon socket from your host (typically `/var/run/docker.sock`, but verify your setup) into the container, here also at `/var/run/docker.sock`.
* The `-e` line sets `DOCKER_SOCKET_PATH` to the location of the Docker daemon socket **inside the container**, matching the mount above.

You can then reach the `GET /device/stats` endpoint with curl:

```bash
curl http://127.0.0.1:9001/device/stats
```

or with Python:

```python
import requests

result = requests.get("http://127.0.0.1:9001/device/stats")
result.raise_for_status()

print(result.json())
```

## Model-level monitoring

For prediction-level monitoring across deployments (rather than host telemetry), see [Model Monitoring](/deployment/monitoring-and-analytics/model-monitoring.md). It is controlled on a self-hosted server with the `METRICS_ENABLED` and `MODEL_MONITORING_CACHE_BACKEND` [environment variables](/deployment/self-hosted/inference-server/configuration/environment-variables.md#monitoring-and-telemetry).
