重要
We recommend updating to the latest agent version as soon as it's available. If you can't upgrade to the latest version, update your agents to a version no more than 90 days old. Read more about keeping agents up to date.
See the New Relic Ruby agent EOL policy for information about agent releases and support dates.
v9.8.0
Version 9.8.0 introduces instrumentation for ruby-openai, adds the option to store tracer state on the thread-level, hardens the browser agent insertion logic to better proactively anticipate errors, and prevents excpetions from being raised in the Active Support Broadcast logger instrumentation.
Feature: Add instrumentation for ruby-openai
Instrumentation has been added for the ruby-openai gem, supporting versions 3.4.0 and higher (PR#2442). While ruby-openai instrumentation is enabled by default, the configuration option
ai_monitoring.enabled
is disabled by default and controls all AI monitoring.ai_monitoring.enabled
must be set totrue
in order to receive ruby-openai instrumentation. High-Security Mode must be disabled in order to receive AI monitoring.Calls to embedding and chat completion endpoints are automatically traced. These events can be enhanced with the introduction of two new APIs. Custom attributes can also be added to LLM events using the API
NewRelic::Agent.add_custom_attributes
, but they must be prefixed withllm.
. For example,NewRelic::Agent.add_custom_attributes({'llm.user_id': user_id})
.Feature: Add AI monitoring APIs
This version introduces two new APIs that allow users to record additional information on LLM events:
NewRelic::Agent.record_llm_feedback_event
- Records user feedback events.NewRelic::Agent.set_llm_token_count_callback
- Sets a callback proc for calculatingtoken_count
attributes for embedding and chat completion message events.
Visit RubyDoc for more information on each of these APIs.
Feature: Store tracer state on thread-level
A new configuration option,
thread_local_tracer_state
, stores New Relic's tracer state on the thread-level, as opposed to the default fiber-level storage. This configuration is turned off by default. Our thanks go to community member @markiz who contributed the idea, code, configuration option, and tests for this new feature! PR#2475.Bugfix: Harden the browser agent insertion logic
With Issue#2462, community member @miry explained that it was possible for an HTTP response headers hash to have symbols for values. Not only would these symbols prevent the inclusion of the New Relic browser agent tag in the response body, but more importantly they would cause an exception that would bubble up to the monitored web application itself. With PR#2465 symbol based values are now supported and all other potential future exceptions are now handled. Additionally, the refactor to support symbols has been shown through benchmarking to give the processing of string and mixed type hashes a slight speed boost too.
Bugfix: Prevent Exception in Active Support Broadcast logger instrumentation
Previously, in certain situations the agent could cause an exception to be raised when attempting to interact with a broadcast log event. This has been fixed. Thanks to @nathan-appere for reporting this issue and providing a fix! PR#2510