Notes
This release of the Python agent adds new ways of passing errors to notice_error(), adds support for Strands-Agent synchronous tool error capturing, adds support for gpt-5 and newer OpenAI LLM models, and fixes a crash in Azure Functions' utilization logic.
Install the agent using easy_install/pip/distribute via the Python Package Index, using conda via the Conda-Forge Package Index, or download it directly from the New Relic download site.
Features
Add support for exception instances as arguments to
notice_error()notice_error()can now accept a caught exception instance (such as one from a try/except block) for theerrorargument, rather than an exception tuple fromsys.exc_info().This is in addition to and does not replace the existing behavior. Previous usage of
notice_error()with zero arguments or with an exception tuple should still function correctly.
Add support for
gpt-5and newer OpenAI LLM models- Add updates to OpenAI instrumentation to support newer attribute names used with later OpenAI models
Add support for Strands-Agent synchronous tool error capturing
- Synchronous Python functions used as tools in Strands-Agents now have proper error capturing, and capture traces within tools such as database lookups.
Bug fixes
Guard against crashes in Azure Functions utilization
- Previously, some users experienced edge cases where Azure Functions utilization detection would crash when attempting to match regular expressions. The crash has been fixed, and should no longer be possible in the future.
Support statement
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 Python agent EOL policy for information about agent releases and support dates.
メモ
このリリースの Python エージェントでは、以下のサポートが追加されました。
- ストランド
- AWS Bedrock コンバースストリーミング
- Redisメソッド
hybrid_searchとmsetex - LLM イベントのLangChainロールの割り当て
- LLM 要求時にキャプチャされた LLM イベントのタイムスタンプ
loop_factory問題ありasyncio.Runner
このリリースでは、Web サーバーによってヘッダーが報告されない ASGI モジュールのバグも修正されています。
Python パッケージ インデックス経由でeasy_install/pip/distributeを使用するか、 Conda-Forge パッケージ インデックス経由でcondaを使用してエージェントをインストールするか、 New Relic ダウンロード サイトから直接ダウンロードします。
特徴
ストランドのサポートを追加
- 単一および複数エージェント (群、グラフなど) 設定にストランド ツールとエージェントの計装を追加します。
AWS Bedrock Converse Streamingのサポートを追加
- ストリーミング Converse API の監視サポートを追加します。これには、
converse_stream()を使用して boto3 および aioboto3 クライアントで行われた Converse チャット完了呼び出しのサポートが含まれます。
- ストリーミング Converse API の監視サポートを追加します。これには、
Redisメソッドのサポートを追加
次のメソッドのサポートを追加します。
hybrid_searchmsetex
loop_factoryのサポートを追加asyncio.Runner- Python 3.11 では、
asyncio.Runnerloop_factoryが追加されました。loop_factory問題は、ループ ポリシーの代替手段を提供します。 これで、グローバル イベント ループ設定またはカスタムイベント ループのどちらを介したものであっても、作成されたループはインストゥルメント化されます。
- Python 3.11 では、
LLM イベントでLangChain のロール割り当てをキャプチャする
- LangChain
LlmChatCompletionMessageイベントには、 LangChainから割り当てられたロールが含まれるようになりました。
- LangChain
LLM 要求時に LLM イベントのタイムスタンプをキャプチャします。
- 以前は、LLM イベントのタイムスタンプはイベントの作成時にキャプチャされていました。現在では、LLM リクエスト時により正確にキャプチャされるようになりました。
バグ修正
ASGIヘッダーの消費
ASGIWebTransactionがhttp.response.startイベントからヘッダーを使用する際、許容される入力タイプを考慮せずに使用していました。ヘッダーがジェネレーターである場合、ジェネレーターはprocess_response()呼び出しによって消費され、Web サーバーが送信するヘッダーが残っていません。これは修正されました。
サポートステートメント
最新のエージェント バージョンが利用可能になったらすぐに更新することをお勧めします。最新バージョンにアップグレードできない場合は、エージェントを 90 日以内のバージョンに更新してください。エージェントを最新の状態に保つ方法の詳細については、こちらをご覧ください。
エージェントのリリースとサポート日については、New Relic Python エージェントのEOL ポリシーを参照してください。
メモ
このリリースの Python エージェントでは、Python 3.14 のサポート、属性フィルター設定用の新しい環境変数、トランザクション デコレータの非同期ジェネレータのサポート、 AWS Bedrockの追加モデル、 AWS Kinesisの新しいメソッドが追加されています。このリリースでは、 ConnectionPoolが複数回ラップされているときにRecursionError引き起こすaiomysqlのバグ、 kombuのプロデューサーでプロパティが適切に渡されないバグ、およびshutdown_agent収集スレッド内から呼び出されたときにエラーが発生するバグも修正されています。
Python パッケージ インデックス経由でeasy_install/pip/distributeを使用するか、 Conda-Forge パッケージ インデックス経由でcondaを使用してエージェントをインストールするか、 New Relic ダウンロード サイトから直接ダウンロードします。
特徴
Python 3.14のサポートを追加
- Python 3.14 のサポートを追加します。
属性フィルター設定用の環境変数を追加する
以下の設定は、環境変数を通じて設定できるようになりました。
構成設定 環境変数 attributes.enabledNEW_RELIC_ATTRIBUTES_ENABLEDattributes.excludeNEW_RELIC_ATTRIBUTES_EXCLUDEattributes.includeNEW_RELIC_ATTRIBUTES_INCLUDEbrowser_monitoring.attributes.enabledNEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_ENABLEDbrowser_monitoring.attributes.excludeNEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_EXCLUDEbrowser_monitoring.attributes.includeNEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_INCLUDEerror_collector.attributes.enabledNEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_ENABLEDerror_collector.attributes.excludeNEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_EXCLUDEerror_collector.attributes.includeNEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_INCLUDEspan_events.attributes.enabledNEW_RELIC_SPAN_EVENTS_ATTRIBUTES_ENABLEDspan_events.attributes.excludeNEW_RELIC_SPAN_EVENTS_ATTRIBUTES_EXCLUDEspan_events.attributes.includeNEW_RELIC_SPAN_EVENTS_ATTRIBUTES_INCLUDEtransaction_events.attributes.enabledNEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_ENABLEDtransaction_events.attributes.excludeNEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_EXCLUDEtransaction_events.attributes.includeNEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_INCLUDEtransaction_segments.attributes.enabledNEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_ENABLEDtransaction_segments.attributes.excludeNEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_EXCLUDEtransaction_segments.attributes.includeNEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_INCLUDEtransaction_tracer.attributes.enabledNEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_ENABLEDtransaction_tracer.attributes.excludeNEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_EXCLUDEtransaction_tracer.attributes.includeNEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_INCLUDE
トランザクション デコレータに非同期ジェネレータのサポートを追加する
- 以前は、トランザクション デコレータは非同期ジェネレータをラップすることをサポートしていませんでした。このサポートが追加され、非同期ジェネレーター トランザクションはイベント ループの待機時間やその他の統計を自動的に測定するようになりました。
AWS Bedrock 計装に追加モデルのサポートを追加
botocoreおよびaiobotocoreを通じてAWS Bedrock 計装を更新し、以下の追加モデルをサポートします。
- クロード・ソネット 3+ モデル
- リージョンがプレフィックスとして付いたモデル(リージョン対応)
新しい Kinesis メソッド用の計装を追加
新しいAWS Kinesis メソッドをサポートするためにbotocore計装を追加
describe_account_settingsupdate_account_settingsupdate_max_record_sizeupdate_stream_warm_throughput
バグ修正
aiomysql ConnectionPool での再帰エラーを防ぐ
- 以前は、プールされた接続を使用すると、 aiomysqlで
RecursionErrorが発生していました。繰り返しのラッピングにより、プールされた接続の周囲に深いObjectProxyチェーンが作成されました。これは修正されました。
- 以前は、プールされた接続を使用すると、 aiomysqlで
kombuのプロデューサーでプロパティが適切に渡されないバグを修正しました
kombu.messaging.Producer.publish()の計装により、プロパティが誤って辞書内にネストされ、プロパティが間違った場所に配置され、下流のパッケージによって読み取られなくなるバグを修正しました。
shutdown_agentが収集スレッド内から呼び出されたときのエラーを修正しました- 以前は、
shutdown_agent収集スレッド内から呼び出されたときにRuntimeErrorが発生する可能性がありました。これにより、クラッシュを防ぐガードが追加され、問題が修正されます。
- 以前は、
サポートステートメント
最新のエージェント バージョンが利用可能になったらすぐに更新することをお勧めします。最新バージョンにアップグレードできない場合は、エージェントを 90 日以内のバージョンに更新してください。エージェントを最新の状態に保つ方法の詳細については、こちらをご覧ください。
エージェントのリリースとサポート日については、New Relic Python エージェントのEOL ポリシーを参照してください。
メモ
Pythonエージェントのこのリリースでは、 Django計装の早期アクティベーションの修正、無視されるmax_samples_storedサーバー側オーバーライド、およびtrace_cache.pop()からのクラッシュに対する保護が提供されます。
Python パッケージ インデックス経由でeasy_install/pip/distributeを使用してエージェントをインストールするか、 New Relic ダウンロード サイトから直接ダウンロードします。
バグ修正
Django計装での早期アクティベーションを防止します
- フォーク前のアプリケーションでの早期アクティベーションの問題を防ぐために、 Django計装の
application_settings()への呼び出しを削除します。
- フォーク前のアプリケーションでの早期アクティベーションの問題を防ぐために、 Django計装の
サーバー設定とローカル設定の同期の問題を修正
- これは、
event_harvest_config.harvest_limits.*設定が廃止され、*.max_samples_stored設定に置き換えられたときに発生したバグを修正します。一部のサーバー側設定がクライアント側設定をオーバーライドしていないため、ユーザーがこれを無効にしているにもかかわらず、データがコレクターに送信されてしまいました。
- これは、
衝突から守る
trace_cache.pop()ContextOfクラスで、デフォルト値のないpop(key)経由のtrace_cacheへの安全でないアクセスがありました。これにより、辞書内のweakrefがすでにガベージ コレクションされている場合にクラッシュが発生しました。
サポートステートメント
最新のエージェント バージョンが利用可能になったらすぐに更新することをお勧めします。最新バージョンにアップグレードできない場合は、エージェントを 90 日以内のバージョンに更新してください。エージェントを最新の状態に保つ方法の詳細については、こちらをご覧ください。
エージェントのリリースとサポート日については、New Relic Python エージェントのEOL ポリシーを参照してください。
メモ
Cuidado
このバージョンのエージェントは撤回されました。
このリリースの Python エージェントでは、次の変更が加えられています。
- Python 3.7のサポートを削除
- さまざまなAPIと設定を削除または廃止します
- aioredis計装を廃止します
setuptoolsのサポートされている最小バージョンを上げ、setuptools_scm- AutoGen用の新しい計装を追加
- Pyzeebe用の新しい計装を追加
- 新しいMCP(モデルコンテキストプロトコル)名前付きスパンを追加します
- psycopgのクラッシュを修正
- AIモニタリングが有効な場合にのみMCPスパンが記録されるようにします
Python パッケージ インデックス経由でeasy_install/pip/distributeを使用してエージェントをインストールするか、 New Relic ダウンロード サイトから直接ダウンロードします。
削除された機能
Python 3.7のサポートを削除
- Python 3.7 は 2023 年 6 月 27 日に EOL となりました。Python エージェントでは、そのサポートが廃止されました。
さまざまな非推奨APIを削除します
次の API は削除されました:
レガシーAPI リプレースメントAPI accept_distributed_trace_payloadaccept_distributed_trace_headersadd_custom_parameteradd_custom_attributeadd_custom_parametersadd_custom_attributescreate_distributed_trace_payloadinsert_distributed_trace_headersget_browser_timing_footerこの機能は get_browser_timing_header()にラップされていますrecord_exceptionnotice_error()NewRelicLogHandlerNewRelicLogForwardingHandlerlambda_handler&LambdaHandlerWrapperこれらの API は newrelic-lambdaパッケージに移動されました。
さまざまな非推奨の設定を削除します
以下の設定は削除されました:
レガシー設定 置換設定 transaction_tracer.capture_attributestransaction_tracer.attributes.enablederror_collector.capture_attributeserror_collector.attributes.enabledbrowser_monitoring.capture_attributesbrowser_monitoring.attributes.enabledanalytics_events.enabledtransaction_events.enabledanalytics_events.capture_attributestransaction_events.attributes.enablederror_collector.ignore_errorserror_collector.ignore_classesstrip_exception_messages.whiteliststrip_exception_messages.allowlistsslこれは現在 trueにハードコードされているため、設定オプションとしては削除されました。ignored_params代わりに newrelic.attributes.exclude = request.parameters.{name}使用してください。各リクエストのキーをカンマで区切ってnewrelic.attributes.excludeリストに追加します。 キーの先頭に必ずrequest.parametersを付けてください。agent_limits.merge_stats_maximumこれは、サーバー側の設定を優先して完全に無視されるようになりました。
非推奨の機能
aioredisの計装は非推奨になりました
他の言語エージェントと一致するように、既存の収穫設定の一部を廃止します。
他の言語エージェントの規則との一貫性を保つために、次の収集設定は非推奨になりました。
レガシー設定 置換設定 event_harvest_config.harvest_limits.analytic_event_datatransaction_events.max_samples_storedevent_harvest_config.harvest_limits.span_event_dataspan_events.max_samples_storedevent_harvest_config.harvest_limits.error_event_dataerror_collector.max_event_samples_storedevent_harvest_config.harvest_limits.custom_event_datacustom_insights_events.max_samples_storedevent_harvest_config.harvest_limits.log_event_dataapplication_logging.forwarding.max_samples_storedこれは、これらの設定の名前を
*.max_samples_storedからevent_harvest_config.harvest_limits.*フォームに変更した以前の変更を元に戻したものです。この決定は覆され、設定名を変更しなかった他の言語エージェントと一致するように、元の設定名が復元されました。非推奨の設定は今のところは引き続き機能しますが、将来のリリースでは削除される予定です。
WSGI環境辞書によるエージェントの設定を非推奨にします
以前は WSGI environ 辞書を通じて構成可能だった以下の設定は非推奨になりました。これらの設定は、環境変数または設定ファイルを通じて構成してください。
newrelic.set_background_tasknewrelic.suppress_apdex_metricnewrelic.suppress_transaction_tracenewrelic.capture_request_paramsnewrelic.disable_browser_autorum
setuptools<61.2またはsetuptools_scm<6.4setuptoolsとsetuptools_scmのサポートされる最小バージョンがそれぞれ61.2と6.4に増加されました。これは、パッケージ メタデータとビルド手順を構成するためのpyproject.tomlの使用をサポートするためのものです。エージェントは、より新しいビルド ツールを使用してビルドできるようになり、pyproject.tomlファイルがないことに関する警告がログに記録されなくなりました。- この変更により、パッケージに新しいバージョン属性
newrelic.__version__とnewrelic.__version_tuple__が追加され、実行時にエージェントのバージョンをプログラムで確認できるようになります。
新機能
AutoGen用の新しい計装を追加
- AutoGenのエージェントとツールの計装 (名前付きスパンとカスタム
Llmイベント) を追加します
- AutoGenのエージェントとツールの計装 (名前付きスパンとカスタム
Pyzeebe用の新しい計装を追加
- Pyzeebeに自動計装およびフレームワーク固有のエージェント プロパティを追加
新しいMCP(モデルコンテキストプロトコル)名前付きスパンを追加します
- ツール マネージャー経由で行われる MCP (モデル コンテキスト プロトコル) ツール呼び出しに新しい名前付きスパンを追加して、ストリーミング可能な HTTP をサポートします。
バグ修正
psycopg>=3.2.0を呼び出すときに発生するクラッシュを修正しましたas_string()as_string()メソッドで引数が不要になり、クラッシュが発生する可能性があるpsycopg>=3.2.0の問題を修正しました。この問題は修正され、このメソッドの両方のシグネチャがサポートされるようになりました。
AIモニタリングが有効な場合にのみMCP(モデルコンテキストプロトコル)スパンが記録されるようにします
- 設定
ai_monitoring.enabledが有効になっている場合にのみ、MCP (モデル コンテキスト プロトコル) スパンが記録されるようにします。
- 設定
サポートステートメント
最新のエージェント バージョンが利用可能になったらすぐに更新することをお勧めします。最新バージョンにアップグレードできない場合は、エージェントを 90 日以内のバージョンに更新してください。エージェントを最新の状態に保つ方法の詳細については、こちらをご覧ください。
エージェントのリリースとサポート日については、New Relic Python エージェントのEOL ポリシーを参照してください。
Notes
This release of the Python agent adds support for the following:
- Custom tasks in Celery
- Graphene-Django monitoring
- Middleware filtering in Django
- AWS Bedrock Converse API
- W3CTraceParent header sampled flag
This release also provides the following fixes:
- Safeguards for the deepest unique path in GraphQL
- Safeguards for web URL request parsing
- Fallback for ElasticSearch and GraphQL when
trace.settings==None - Remove
optionsmethod from async ElasticSearch client list
Install the agent using easy_install/pip/distribute via the Python Package Index or download it directly from the New Relic download site.
New features
Adds support for custom tasks in Celery
Adds support for Graphene-Django
- Add monitoring support for synchronous schemas created with Graphene-Django. Previously, schemas created with Graphene-Django would only be partially monitored, resulting in missing GraphQL related attributes.
Adds support for middleware filtering in Django
Users are now able to filter which Django middleware to monitor. There are now three additional settings:
instrumentation.middleware.django.enabled(Default istrue)instrumentation.middleware.django.excludeinstrumentation.middleware.django.include
See the Django Middleware Filtering page for more information and examples.
Adds support for AWS Bedrock Converse API
- Add monitoring support for non-streaming Converse API. This includes support for
conversechat completion calls made usingboto3andaioboto3clients.
- Add monitoring support for non-streaming Converse API. This includes support for
Adds support for W3CTraceParent header sampled flag
- When an upstream service sends the W3CTraceParent header with the sampling flag set, New Relic will take into account that sampling decision when deciding whether the current transaction will be sampled.
Added support for sampling decisions based on whether the remote parent is sampled
Added support for two new configuration options:
distributed_tracing.sampler.remote_parent_sampleddistributed_tracing.sampler.remote_parent_not_sampled
defaultis the default behavior and behaves as it did before this change (it passes the sampling decision to the adaptive sampling algorithm to determine whether the transaction will be sampled).always_onmeans that the trace that has a remote parent sampled or remote parent not sampled will always be sampled.always_offmeans that the trace that has a remote parent sampled or remote parent not sampled will never be sampled.
Bug fixes
Add safeguard for deepest unique path in GraphQL
- Some users were experiencing issues with the deepest unique path in GraphQL not being generated due to a field name returning
None. This issue has been fixed.
- Some users were experiencing issues with the deepest unique path in GraphQL not being generated due to a field name returning
Add safeguard for web request parsing
- Some users experienced a parsing error when
request_uriwas malformed or contained invalid characters. This can happen at this point if therequest_uriin the request header is invalid and does not match the (valid) URL originally given. While this safeguard has now been put in place in New Relic,urllibhas resolved this issue for versions of Python released after Jan 31, 2025.
- Some users experienced a parsing error when
Fix crash in ElasticSearch and GraphQL when
trace.settings==None- In cases where
trace.settingsisNone, the instrumentation for ElasticSearch crashed the application. Aglobal_settingsfallback has been put in place. This also resolves the same issue found in GraphQL.
- In cases where
Remove
optionsmethod from async ElasticSearch client list- The previous instrumentation of ElasticSearch caused a crash because
optionswas in the list of async methods. This method is no longer wrapped in aDatastoreTracesince it is not one that conducts any datastore operations/requests.
- The previous instrumentation of ElasticSearch caused a crash because
Support statement
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 Python agent EOL policy for information about agent releases and support dates.