Notes
This release of the Python agent adds Python 3.14 support, new environment variables for attribute filter settings, support for async generators in transaction decorators, additional models in AWS Bedrock, and new methods in AWS Kinesis. This release also fixes a bug in aiomysql which caused RecursionError when using ConnectionPool where it was wrapped multiple times, a bug where properties were not properly passed in kombu's producer, and an error when shutdown_agent is called from within the harvest thread.
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 Python 3.14
- Add support for Python 3.14.
Add environment variables for attribute filters settings
The following settings now have the option to be set through environment variables:
Configuration Setting Environment variable 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
Add support for async generators in transaction decorators
- Previously, transaction decorators did not support being wrapped around async generators. This support has been added, and async generator transactions will now automatically measure event loop wait time and other statistics.
Add support for additional models in AWS Bedrock instrumentation
Updates AWS Bedrock instrumentation through botocore and aiobotocore to support the following additional models
- Claude Sonnet 3+ models
- Models that are prefixed with a region (region-aware)
Add instrumentation for new Kinesis methods
- Adds botocore instrumentation to support new AWS Kinesis methomethods
describe_account_settingsupdate_account_settingsupdate_max_record_sizeupdate_stream_warm_throughput
- Adds botocore instrumentation to support new AWS Kinesis methomethods
Bug fixes
Prevent a RecursionError in aiomysql ConnectionPool
- Previously, a
RecursionErrorwould be raised in aiomysql when using pooled connections. DeepObjectProxychains were created around pooled connections due to repeated wrapping. This has been fixed.
- Previously, a
Fixed a bug where properties were not properly passed in kombu's producer
- Fixed a bug where instrumentation for
kombu.messaging.Producer.publish()was causing properties to accidentally be nested inside of the dictionary, causing the properties to be in the wrong spot and not read by downstream packages.
- Fixed a bug where instrumentation for
Fix error when
shutdown_agentis called from within the harvest thread- Previously, a
RuntimeErrorcould occur whenshutdown_agentwas called from within the harvest thread. This fixes that issue by adding a guard to prevent the crash.
- Previously, a
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エージェントのこのリリースでは、 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 ポリシーを参照してください。
メモ
注意
このバージョンのエージェントは撤回されました。
このリリースの 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 ポリシーを参照してください。
メモ
このリリースの Python エージェントでは、以下のサポートが追加されました。
- Celeryのカスタムタスク
- Graphene-Django監視
- Djangoのミドルウェアフィルタリング
- AWS Bedrock コンバースAPI
- W3CTraceParent ヘッダーのサンプリングフラグ
このリリースでは、次の修正も提供されています。
- GraphQL における最も深いユニークパスの保護
- ウェブ URL リクエスト解析の安全策
- ElasticSearchとGraphQLのフォールバック
trace.settings==None - 非同期 ElasticSearch クライアント リストから
optionsメソッドを削除します
Python パッケージ インデックス経由でeasy_install/pip/distributeを使用してエージェントをインストールするか、 New Relic ダウンロード サイトから直接ダウンロードします。
新機能
Celeryのカスタムタスクのサポートを追加
Graphene-Djangoのサポートを追加
- Graphene-Djangoで作成された同期スキーマの監視サポートを追加します。以前は、Graphene-Django で作成されたスキーマは部分的にしかモニターされず、 GraphQL関連の属性が欠落していました。
Django のミドルウェアフィルタリングのサポートを追加
ユーザーは、どのDjangoミドルウェアを監視するかをフィルタリングできるようになりました。 追加設定が 3 つあります。
instrumentation.middleware.django.enabled(デフォルトはtrueです)instrumentation.middleware.django.excludeinstrumentation.middleware.django.include
詳細と例については、 Django ミドルウェア フィルタリング ページを参照してください。
AWS Bedrock Converse APIのサポートを追加
- 非ストリーミングConverse API の監視サポートを追加します。これには
boto3およびaioboto3クライアントを使用して行われたconverseチャット完了呼び出しのサポートが含まれます。
- 非ストリーミングConverse API の監視サポートを追加します。これには
W3CTraceParent ヘッダーのサンプリングフラグのサポートを追加
- アップストリーム サービスがサンプリング フラグを設定した W3CTraceParent ヘッダーを送信すると、New Relic は現在のトランザクションをサンプリングするかどうかを決定する際にそのサンプリング決定を考慮します。
リモート親がサンプリングされるかどうかに基づくサンプリング決定のサポートを追加しました
2 つの新しい設定オプションのサポートが追加されました。
distributed_tracing.sampler.remote_parent_sampleddistributed_tracing.sampler.remote_parent_not_sampled
defaultこれはデフォルトの動作であり、この変更前と同じように動作します (サンプリングの決定を適応サンプリング アルゴリズムに渡して、トランザクションをサンプリングするかどうかを決定します)。always_onリモート親がサンプリングされたトレースとリモート親がサンプリングされていないトレースが常にサンプリングされることを意味します。always_offリモート親がサンプリングされたトレース、またはリモート親がサンプリングされていないトレースはサンプリングされないことを意味します。
バグ修正
GraphQL の最も深いユニークパスに安全策を追加する
- 一部のユーザーは、フィールド名が
Noneを返すため、 GraphQLの最も深い一意のパスが生成されないという問題を経験していました。この問題は修正されました。
- 一部のユーザーは、フィールド名が
Webリクエスト解析の安全策を追加する
request_uriが不正な形式であったり無効な文字が含まれていたりした場合に、一部のユーザーに解析エラーが発生しました。この時点で、リクエスト ヘッダーのrequest_uriが無効であり、最初に指定された (有効な) URL と一致しない場合にこれが発生する可能性があります。この安全対策は現在 New Relic に導入されていますが、urllib2025 年 1 月 31 日以降にリリースされた Python のバージョンに対してこの問題を解決しました。
ElasticSearchとGraphQLのクラッシュを修正
trace.settings==Nonetrace.settingsがNoneの場合、ElasticSearch の計装によりアプリケーションがクラッシュしました。global_settingsフォールバックが設定されました。これにより、GraphQL で見つかった同じ問題も解決されます。
非同期 ElasticSearch クライアント リストから
optionsメソッドを削除します- ElasticSearch の以前の計画では、
options非同期メソッドのリストにあったためクラッシュが発生しました。 このメソッドは、データストアの操作やrequestsを実行するものではないため、DatastoreTraceにラップされなくなりました。
- ElasticSearch の以前の計画では、
サポートステートメント
最新のエージェント バージョンが利用可能になったらすぐに更新することをお勧めします。最新バージョンにアップグレードできない場合は、エージェントを 90 日以内のバージョンに更新してください。エージェントを最新の状態に保つ方法の詳細については、こちらをご覧ください。
エージェントのリリースとサポート日については、New Relic Python エージェントのEOL ポリシーを参照してください。
メモ
このリリースの Python エージェントでは、新しいRedis関数のサポートが追加され、すべての内部パスがos.pathからpathlib.Pathに変換され、JSON エンコード PosixPaths に関する問題が修正されました。
Python パッケージ インデックス経由でeasy_install/pip/distributeを使用してエージェントをインストールするか、 New Relic ダウンロード サイトから直接ダウンロードします。
新機能
新しいRedis関数のサポートを追加
- 新しいRedis関数の計装を追加します。
すべての内部パスを
os.pathからpathlib.Path- Windows パスをサポートするための準備として、文字列ベースのパスと
os.pathのすべての内部使用をpathlib.Pathに変換します。
- Windows パスをサポートするための準備として、文字列ベースのパスと
バグ修正
JSON エンコード PosixPath の問題を修正
- 一部のユーザーで JSON エンコード
PosixPath構成設定に関する問題が発生していました。この問題は修正されました。
- 一部のユーザーで JSON エンコード
サポートステートメント
最新のエージェント バージョンが利用可能になったらすぐに更新することをお勧めします。最新バージョンにアップグレードできない場合は、エージェントを 90 日以内のバージョンに更新してください。エージェントを最新の状態に保つ方法の詳細については、こちらをご覧ください。
エージェントのリリースとサポート日については、New Relic Python エージェントのEOL ポリシーを参照してください。
Notes
This release of the Python agent adds support for oracledb, fixes a bug in Kombu and Kafka where MessageTransaction object has no attribute destination_name, and fixes the disappearance of utilization metadata with AWS.
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 oracledb
- Add instrumentation for oracledb.
Bug fixes
Fix "
MessageTransactionobject has no attributedestination_name" bug- Fix a bug in MessageBroker instrumentations where the serialize methods were looking for the
destination_nameattribute on theMessageTransactionand it did not exist.
- Fix a bug in MessageBroker instrumentations where the serialize methods were looking for the
Fix AWS utilization metadata issue when running AWS and K8s together
- Due to permissions settings in K8s pods running on AWS EC2 instances, the utilization metadata is able to be retrieved the first time. However, if the application is left running continuously, the agent will reconnect and the utilization metadata fails to load. In cases like these, the utilization metadata is cached per agent instance and is able to be retrieved.
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.