Skip to content

Latest commit

 

History

History
219 lines (173 loc) · 6.69 KB

configure-ai-monitoring.mdx

File metadata and controls

219 lines (173 loc) · 6.69 KB
title metaDescription freshnessValidatedDate
Configure AI monitoring
You can apply certain configurations to your APM agents to change how your AI data appears in New Relic.
never

You can set limits with certain event attributes in your APM agent. These configurations may be the same configurations you're familiar with, but the nature of AI data might affect the values you assign to an event. Keep in mind when setting limits that:

* Limits tell your agent how much to sample events or spans. 
* A higher limit means less sampling, which gives a more complete picture of your app's performance, but also means higher ingest costs and higher memory usage.

Adjust agent configuration settings [#adjust-AIM]

You can update agent configuration through the New Relic configuration file or through environment variables. If you have a more complex set up with multiple environments, we recommend configuring with environment variables.

Go Java Node.js Python Ruby
<TabsPages>
    <TabsPageItem id="go-config">
        INSERT_TAB_CONTENT_HERE
    </TabsPageItem>
    <TabsPageItem id="java-config">
        INSERT_TAB_CONTENT_HERE
    </TabsPageItem>
    <TabsPageItem id="node-config">

Set limits for how many events or spans your agent collects:

* Custom events track message contents and token usage.
* Spans are pieces of a trace, which capture when an operation occurred in your app code, how long it took to complete, and other operations it relates to.
<table>
    <tbody>
    <tr>
        <th>
        Type
        </th>

        <td>
        Integer
        </td>
    </tr>

    <tr>
        <th>
        Default
        </th>

        <td>
        `3000`
        </td>
    </tr>

    <tr>
        <th>
        [Environ variable](#environment)
        </th>

        <td>
        `NEW_RELIC_CUSTOM_INSIGHTS_EVENTS_MAX_SAMPLES_STORED`
        </td>
    </tr>
    <tr>
        <th>
        `newrelic.js`
        </th>
        <td>
        `custom_insights_events.max_samples_stored`
        </td>
    </tr>
    </tbody>
</table>
        <td>
        Integer
        </td>
    </tr>

    <tr>
        <th>
        Default
        </th>

        <td>
        `2000`
        </td>
    </tr>

    <tr>
        <th>
        [Environ variable](#environment)
        </th>

        <td>
        `NEW_RELIC_SPAN_EVENTS_MAX_SAMPLES_STORED`
        </td>
    </tr>
    <tr>
        <th>
        `newrelic.js`
        </th>
        <td>
        `span_events.max_samples_stored`
        </td>
    </tr>
    </tbody>
</table>
    </TabsPageItem>
    <TabsPageItem id="python-config">

These configurations adjust how the agent captures and sends AI data. AI Monitoring is automatically configured to capture the max number of events and attributes for both settings. Reducing this limit may affect the fidelity of your data, but would lower ingest costs.

This value is set to its max at install to preserve the integrity of your prompts and responses. You may want to decrease this max value to save on ingest costs, but it will affect the quality of your data.

* When AIM ingests large messages, shortened messages can lose context. 
* The maximum value is `4095`. 

To decrease with the configuration file:

```ini
    custom_insights_events.max_attribute_value
```  

To decrease with the environment variable:

```bash
here
```
                
</Collapser>
<Collapser
    id="py-event-data"
    title="Decrease AI event harvest"
>

The Python agent sends up to 100,000 LLM events per minute. These events are pushed to NRDB every five seconds, sending up a maximum of 8,333 events per five seconds. Once the agent hits the maximum, it then samples event data.

  • When the agent samples event data, it pushes a random sampling of events instead of every single event. This gives a general representation of events at the time the agent harvests them.
  • This event is set to the maximum value (100000) at install. This means the agent will not sample event data.
  • Setting this event to a lower value (1000 or less) means the agent will sample event data. You can decrease this value if you're concerned with ingest cost, but we don't recommend it.

To decrease this value with the configuration file:

```ini
event_harvest_config.harvest_limits.custom_event_data
```

To decrease this value with environment variables:

```bash
NEW_RELIC_CUSTOM_INSIGHTS_EVENTS_MAX_SAMPLES_STORED
```
</Collapser>

If you want to make additional configurations to how your Python agent collects data about your Python app, see our Python configuration doc. For example, you can enable log forwarding for your Python app.

    </TabsPageItem>
    <TabsPageItem id="ruby-config">

In addition, you may want to adjust these existing configuration options to improve your AI Monitoring experience:

  • distributed_tracing.enabled: true When Distributed Tracing is enabled on your application, you'll be able to connect your AI Monitoring events with your traces.

  • span_events.max_samples_stored: 10_000 Increasing this configuration to the maximum value of 10,000 will minimize sampling of AI-related distributed traces.

  • custom_insights_events.max_samples_stored: 100_000 Increasing this configuration to the maximum value of 100,000 will minimize sampling of AI-related events and any custom events your application currently sends.

      </TabsPageItem>
    

Set up user feedback [#user-feedback]

asdf

Type