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

# Monitor AMD GPUs using OpenTelemetry

OpenLIT uses OpenTelemetry to help you monitor AMD GPUs. This includes tracking GPU metrics like utilization, temperature, memory usage and power consumption.

## Get started

<CardGroup cols={2}>
  <Card title="Using the SDK" href="#using-the-sdk" icon="file-code">
    Collect and send GPU performance metrics directly from your application to an OpenTelemetry endpoint.
  </Card>

  <Card title="Using the Collector" href="#using-the-collector" icon="robot">
    Install the OpenTelemetry GPU Collector as a Docker container to collect and send GPU performance metrics to an OpenTelemetry endpoint.
  </Card>
</CardGroup>

<AccordionGroup>
  <Accordion title="Using the SDK">
    <Steps>
      <Step title="Install OpenLIT">
        Open your command line or terminal and run:

        ```shell theme={null}
        pip install openlit
        ```
      </Step>

      <Step title="Initialize OpenLIT in your Application">
        <Tabs>
          <Tab title="Python">
            <Tabs>
              <Tab title="Zero Code Instrumentation">
                Perfect for existing applications - no code modifications needed:

                <Tabs>
                  <Tab title="Via CLI Arguments">
                    ```bash theme={null}
                    # Configure via CLI arguments
                    openlit-instrument \
                      --service-name my-ai-app \
                      --environment production \
                      --otlp-endpoint YOUR_OTEL_ENDPOINT \
                      python your_app.py
                    ```
                  </Tab>

                  <Tab title="Via Environment Variables">
                    ```bash theme={null}
                    # Configure via environment variables
                    export OTEL_SERVICE_NAME=my-ai-app
                    export OTEL_DEPLOYMENT_ENVIRONMENT=production
                    export OTEL_EXPORTER_OTLP_ENDPOINT=YOUR_OTEL_ENDPOINT

                    # Run with zero code changes
                    openlit-instrument python your_app.py
                    ```
                  </Tab>
                </Tabs>

                <Info>
                  **Perfect for**: Legacy applications, production systems where code changes need approval, quick testing, or when you want to add observability without touching existing code.
                </Info>
              </Tab>

              <Tab title="One-Line Instrumentation">
                <Tabs>
                  <Tab title="Via Function Parameters">
                    ```python theme={null}
                    import openlit

                    openlit.init(otlp_endpoint="YOUR_OTEL_ENDPOINT")
                    ```
                  </Tab>

                  <Tab title="Via Environment Variables">
                    Add the following two lines to your application code:

                    ```python theme={null}
                    import openlit

                    openlit.init()
                    ```

                    Then, configure the your OTLP endpoint using environment variable:

                    ```shell theme={null}
                    export OTEL_EXPORTER_OTLP_ENDPOINT=YOUR_OTEL_ENDPOINT
                    ```
                  </Tab>
                </Tabs>
              </Tab>
            </Tabs>
          </Tab>

          <Tab title="Typescript">
            <Tabs>
              <Tab title="One-Line Instrumentation (SDK)">
                <Tabs>
                  <Tab title="Via Function Parameters">
                    ```typescript theme={null}
                    import openlit from "openlit"

                    openlit.init({ otlpEndpoint: "YOUR_OTEL_ENDPOINT" })
                    ```
                  </Tab>

                  <Tab title="Via Environment Variables">
                    Add the following two lines to your application code:

                    ```typescript theme={null}
                    import openlit from "openlit"

                    openlit.init()
                    ```

                    Then, configure the your OTLP endpoint using environment variable:

                    ```shell theme={null}
                    export OTEL_EXPORTER_OTLP_ENDPOINT=YOUR_OTEL_ENDPOINT
                    ```
                  </Tab>
                </Tabs>
              </Tab>
            </Tabs>
          </Tab>
        </Tabs>

        **Replace:** `YOUR_OTEL_ENDPOINT` with the URL of your OpenTelemetry backend, such as `http://127.0.0.1:4318` if you are using OpenLIT and a local OTel Collector.

        To send metrics and traces to other Observability tools, refer to the [supported destinations](/latest/sdk/destinations/overview).

        For more advanced configurations and application use cases, visit the [OpenLIT Python repository](https://github.com/openlit/openlit/tree/main/sdk/python) or [OpenLIT Typescript repository](https://github.com/openlit/openlit/tree/main/sdk/typescript).
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Using the Collector">
    <Steps>
      <Step title="Pull `otel-gpu-collector` Docker Image">
        You can quickly start using the OTel GPU Collector by pulling the Docker image:

        ```sh theme={null}
        docker pull ghcr.io/openlit/otel-gpu-collector:latest
        ```
      </Step>

      <Step title="Run `otel-gpu-collector` Docker container">
        You can quickly start using the OTel GPU Collector by pulling the Docker image:
        Here's a quick example showing how to run the container with the required environment variables:

        ```sh theme={null}
        docker run --gpus all \
            -e OTEL_SERVICE_NAME='chatbot' \
            -e OTEL_RESOURCE_ATTRIBUTES='deployment.environment=staging' \
            -e OTEL_EXPORTER_OTLP_ENDPOINT="YOUR_OTEL_ENDPOINT" \
            -e OTEL_EXPORTER_OTLP_HEADERS="YOUR_OTEL_HEADERS" \
            ghcr.io/openlit/otel-gpu-collector:latest
        ```

        For more advanced configurations of the collector, visit the [OTel GPU Collector repository](https://github.com/openlit/openlit/tree/main/opentelemetry-gpu-collector/).

        **Note:** If you've deployed **OpenLIT** using [Docker Compose](https://github.com/openlit/openlit/blob/main/docker-compose.yml), make sure to use the host's IP address or add OTel GPU Collector to the [Docker Compose](https://github.com/openlit/openlit/blob/main/docker-compose.yml):

        <AccordionGroup>
          <Accordion title="Docker Compose: Add the following config under `services`">
            ```yaml theme={null}
            otel-gpu-collector:
              image: ghcr.io/openlit/otel-gpu-collector:latest
              environment:
                OTEL_SERVICE_NAME: 'chatbot'
                OTEL_RESOURCE_ATTRIBUTES: 'deployment.environment=staging'
                OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector:4318"
              device_requests:
              - driver: nvidia
                count: all
                capabilities: [gpu]
              depends_on:
              - otel-collector
              restart: always
            ```
          </Accordion>

          <Accordion title="Host IP: Use the Host IP to connect to OTel Collector">
            ```sh theme={null}
            OTEL_EXPORTER_OTLP_ENDPOINT="http://192.168.10.15:4318"
            ```
          </Accordion>
        </AccordionGroup>

        ### Environment Variables

        OTel GPU Collector uses standard OpenTelemetry environment variables for configuration:

        | Environment Variable          | Description                                                   | Default Value                    |
        | ----------------------------- | ------------------------------------------------------------- | -------------------------------- |
        | `OTEL_SERVICE_NAME`           | Service/application name attached to all metrics              | `default`                        |
        | `OTEL_RESOURCE_ATTRIBUTES`    | Resource attributes, e.g. `deployment.environment=production` | `deployment.environment=default` |
        | `OTEL_EXPORTER_OTLP_ENDPOINT` | OpenTelemetry OTLP endpoint URL                               | (required)                       |
        | `OTEL_EXPORTER_OTLP_HEADERS`  | Headers for authenticating with the OTLP endpoint             | Ignore if using OpenLIT          |
        | `OTEL_METRIC_EXPORT_INTERVAL` | Metric polling interval in milliseconds                       | `10000`                          |
      </Step>
    </Steps>
  </Accordion>
</AccordionGroup>

<Card title="Collected Metrics" href="/latest/openlit/observability/metrics#gpu-metrics" icon="table">
  Details on the types of metrics collected and their descriptions.
</Card>

***

<CardGroup cols={3}>
  <Card title="Quickstart: LLM Observability" href="/latest/sdk/quickstart-ai-observability" icon="bolt">
    Production-ready AI monitoring setup in 2 simple steps with zero code changes
  </Card>

  <Card title="Configuration" href="/latest/sdk/configuration" icon="bolt">
    Configure the OpenLIT SDK according to you requirements.
  </Card>

  <Card title="Destinations" href="/latest/sdk/destinations/overview" icon="link">
    Send telemetry to Datadog, Grafana, New Relic, and other observability stacks
  </Card>
</CardGroup>

<Card title="Zero-code observability with the OpenLIT Controller" icon="tower-broadcast" href="/latest/controller/overview">
  Discover and instrument LLM traffic across Kubernetes, Docker, and Linux using eBPF — no code changes required.
</Card>
