To directly send OpenTelemetry metrics and traces generated by OpenLIT SDK from your AI Application to New Relic, Follow the below steps.

1

Get your New Relic Credentials

  1. Go to the New Relic API Keys UI Page
  2. Click Create a Key Button
  3. In the Create an API Key Wizard:
    • Set Key Type as Ingest - License
    • Give the API Key Name, for example openlit and Optionally add any Notes
    • Click on Create a Key
  4. Copy the key by clicking on the three dots ().
2

Add the following two lines to your application code:

import openlit

openlit.init(
  otlp_endpoint="https://otlp.nr-data.net:443", 
  otlp_headers="api-key=YOUR_NEWRELIC_LICENSE_KEY"
)

Replace:

  1. YOUR_NEWRELIC_LICENSE_KEY with the API Key value you copied in Step 1.
    • Example - "api-key=acxxxxxxxx"

Refer to the OpenLIT Python SDK repository for more advanced configurations and use cases.

3

Import the pre-built Dashboard

  1. Go to one.newrelic.com > Dashboards.
  2. In the top-right corner, click Import dashboard.
  3. Copy the dashboard JSON provided in the accordion named Dashboard below.
  4. Paste the dashboard JSON text directly into the text area.
  5. Choose the account and permission settings for the dashboard. You can’t change the account once you’ve set it, but you can change the permissions at any time.
  6. Click Import Dashboard.