9.0の新機能
ディストリビューティッド(分散)トレーシングを有効にした場合、詳細なトランザクショントレースが利用可能になりました。
このリリースには、エージェントがディストリビューティッド(分散)トレーシングの代わりにトランザクショントレースに使用されるセグメントをソートし、異なる優先順位を適用できるようにするためのセグメントストレージのリファクタリングが含まれています。PHPエージェント8.4のリリースには、ディストリビューティッド(分散)トレーシングの限定的なサポートが含まれていましたが、これにより、ディストリビューティッド(分散)トレーシングが有効になっている場合、個々のPHPサービスの詳細なトランザクショントレースが失われる結果となりました。
この新しいリリースでのリファクタリングにより、PHPサービスを含むディストリビューティッド(分散)トレーシングについて、表示したいセグメント(スパン)をエージェントが送信できるようになりました。また、個々のPHPサービスのトランザクショントレースを調査する際に、可能な限り詳細なセグメント情報を個別に提供します。
メモ:
- このリリースでは、ディストリビューティッド(分散)トレーシングを有効にする手順に変更はありません。
- ディストリビューティッド(分散)トレーシングがオンの場合、
newrelic.transaction_tracer.detailの動作が変更されました。8.4~8.7のPHPエージェントリリースでは、ディストリビューティッド(分散)トレーシングが有効になっている場合、newrelic.transaction_tracer.detailは無効になっていました。現在はそうではありません。詳細については、ディストリビューティッド(分散)トレーシングを使用する際のトレースレベルの詳細の設定のドキュメントをご覧ください。 - ディストリビューティッド(分散)トレーシングのサポート向上を有効にするため、9.0ではPHPエージェントのメモリ割り当て戦略が変更されました。トランザクションの開始時にPHPエージェントはより積極的にメモリを割り当てます。また、OSカーネルおよびCライブラリの設定によっては、システムアロケータがそのメモリをすぐにOSに解放しない場合があります。その結果、PHPプロセスのメモリ使用量が、以前のバージョンのPHPエージェントよりも高くなる場合があります。
9.0のアップグレードに関する注意事項
これらのディストリビューティッド(分散)トレーシングの強化に伴い、閾値を確認してください。
- 8.4~8.7のPHPエージェントのリリースでは、軽量なPHPサービスがトレースの一部である場合でも、エージェントが完全なディストリビューティッド(分散)トレーシングを報告するように、顧客に
newrelic.transaction_tracer.threshold = 0を設定することを推奨していました。これは不要になりました。 - 9.0リリースにアップグレードする際は、
newrelic.transaction_tracer.thresholdの設定を確認し、この値をデフォルト値、またはアプリケーションにとって適切なより高い値に戻すことをお勧めします。
起動時にルート証明書バンドルが見つからない場合、デーモンは警告を出すようになりました。
- デーモンには独自の証明書が含まれており、引き続き動作しますが、PHPエージェントの将来のバージョンでは組み込みの証明書が削除されます。その時点で、PHPエージェントはNew Relicのサーバーと通信できなくなります。
- 推奨:PHPエージェントを使用する前に、ホストまたはコンテナにルート証明書バンドルがインストールされていることを確認してください。これは通常、ほとんどのLinuxディストリビューションで
ca-certificatesパッケージとして利用できます。FreeBSDでは、portsのsecurity/ca_root_nssパッケージを介してバンドルを利用できます。
デーモンは、--tlsフラグを使用して呼び出すことができなくなりました。
- PHPエージェントバージョン8.0.0の時点で、セキュリティ向上のためnewrelic.daemon.ssl ini設定は削除されていましたが、引き続きコマンドラインから
--tls trueを使用してデーモンを呼び出すことができました。--tlsフラグを使用したコマンドラインからのデーモンの呼び出しは失敗します。 - 8.0.0以降のすべてのPHPエージェントバージョンと同様に、New Relicサーバーとの通信には常にTLSが使用されます。
バグ修正
- PHP 7.3で
drupal_http_requestを使用した場合の潜在的なセグメンテーションフォールトが修正されました。 - 場合によっては、リクエスト中に(
newrelic_start_transactionまたはnewrelic_set_appnameを介して)新しいトランザクションを開始すると、フレームワークおよびユーザー関数の計装が不完全な状態になる可能性があります。 - SQLを難読化する際、SQL自体を損なうことなくコメントが削除されます。
- クラスター化された接続で同期
executeCommand()コードパス(たとえば、HSET)を使用するPredis 0.8コマンドは、メトリクスを生成しませんでした。これは修正されました。
既知の問題と回避策
長時間実行されるトランザクションによる潜在的なメモリ枯渇
PHPエージェント9.xは、トランザクション中の関数呼び出しやセグメントの追跡に使用されるメモリの解放に消極的であるため、以前のバージョンよりも多くのメモリを使用します:通常の場合、メモリは各トランザクションの終了時にのみ解放されます。
これは主に、メッセージキューを処理するバックグラウンドジョブ、データの変換やレポート作成、電子メールの送信など、実行時間の長いトランザクションを持つユーザーに現れる傾向があります。
この問題によりご不便をおかけして申し訳ありません。現在、修正に向けて積極的に取り組んでいます。短期的には、この問題を軽減するための4つの可能な回避策があります。
回避策:
- 1. トランザクションを手動で開始/停止します。影響を受けるトランザクションが、メッセージキューの消費者など、一連の反復プロセスを実行するものである場合、各反復を個別のトランザクションとして手動で計装できます。これにより、プロセスがどのように動作しているかについて、よりきめ細かいデータが得られます。これを行うことで、使用されたメモリは各トランザクションの後に解放されます。これを実装するには、
newrelic_end_transaction(true)による最初の自動トランザクションを無視し、newrelic_start_transaction()とnewrelic_end_transaction()を使用して各トランザクションを順番に計装します。 - 2. トランザクショントレースの詳細を減らす。PHP 7.4、またはPHPエージェント9.xリリースで追加された機能がすぐに必要であり、データストアと外部呼び出しに関する情報のみを含むトレースで十分な場合は、次の設定を変更することで、PHPエージェントがキャプチャする詳細レベルを下げることができます:
newrelic.transaction_tracer.detail = 0。この設定により、トレースにはPHP関数呼び出しが含まれなくなります。注:数十万回のデータストアまたは外部呼び出しを行うトランザクションは、依然としてメモリの問題の影響を受ける可能性があります。 - 3. PHPエージェント8.7にダウングレードします。すぐにPHP 7.4を使用する予定がない場合、これが最も簡単で最速の解決策になる可能性があります。ダウングレードするには、https://download.newrelic.com/php_agent/archive/8.7.0.242/のtarボールからインストールするか、パッケージマネージャでバージョン8.7.0.242にダウングレードしてそのバージョンを固定します。PHPエージェント8.7でディストリビューティッド(分散)トレーシングが有効になっている場合、トランザクショントレーサーの詳細は(次のオプションに従って)自動的に削減されることにご注意ください。
- 4. 作成される関数セグメントの数を制限します(PHPエージェント9.xを維持します)。これは「トランザクショントレースの詳細を減らす」オプションに似ていますが、キャプチャされる関数の数に見合ったメモリ使用量の増加を犠牲にして、限られた数のPHP関数呼び出しをトレースすることもできます。(大まかな経験則として、各セグメントには約320~400バイトのヒープが必要です。)最初の5,000回の関数呼び出しをキャプチャするには、この設定を追加します:
newrelic.transaction_tracer.max_segments = 5000。この設定により、設定された関数呼び出し回数以降のPHP関数は無視されます。注:数十万回のデータストアまたは外部呼び出しを行うトランザクションは、依然としてメモリの問題の影響を受ける可能性があります。
**注:これらのオプションの詳細な説明については、Explorer's Hubの投稿をご覧ください。
Bug Fixes
- Transaction globals are now cleanly separated from request globals. This fixes crashes related to the initialization of multiple transactions during one request (mostly triggered by
newrelic_set_appname()).
New Features
- Support Laravel's handling of CORS HTTP OPTIONS.
Requests for Laravel's built-in automatic handling of CORS HTTP OPTIONS requests will now be given the transaction name_CORS_OPTIONS.
Bug Fixes
- A potential segfault when using PHP 7.3, opcache and multiple PHP workers has been fixed.
- Uncaught exceptions within a job being executed by a Laravel Queue worker are now reported correctly.
- Invoking
function_exists()on a function disabled with thedisable_functionsconfiguration directive will now correctly returnfalse.
New Features
- Added support for PHP 7.3.
Keeping up with the latest and greatest from the PHP Core team, the New Relic PHP Agent now supports PHP 7.3. - Distributed Tracing Improvements!
The PHP Agent's Distributed Tracing support (introduced in version 8.4 of the PHP Agent) now includes the `http.method` attributes for External spans. - Up to date PHPUnit support.
The PHP Agent now supports automatic creation of custom events for PHPUnit 6, PHPUnit 7, and PHPUnit 8.
New Features
Support for Distributed tracing
Distributed tracing lets you see the path that a request takes as it travels through your distributed system. By showing the distributed activity through a unified view, you can troubleshoot and understand a complex system better than ever before.
Distributed tracing is available with an APM Pro or equivalent subscription. To see a complete distributed trace, you need to enable the feature on a set of neighboring services. Enabling distributed tracing changes the behavior of some New Relic features, so carefully consult the transition guide before you enable this feature.
To enable distributed tracing, two parameters should be changed in the newrelic.ini file:
newrelic.distributed_tracing_enabled = trueand
newrelic.transaction_tracer.threshold = 0
Bug Fixes
- A bug in the PHP agent resulted in databaseCallCount attributes no longer being attached to Transaction events. The 8.4 release restores these attributes.
- Predis 2 cluster connections could not be instrumented due to internal changes in Predis. The 8.4 release fixes this.
Bug Fixes
- In rare cases, during a reset of the apache web server, the agent and mod_php would hang with 100% CPU utilization. This has been fixed.
Bug Fixes
- Fixed an entire category of bugs where a Drupal hook whose hook name matched its module name resulted in the generation of empty metric names.
Operating Systems Support
- This release of the PHP Agent removes support for the Solaris operating system. For Solaris support, please install agent version 8.1 or prior.
Upgrade Notices
- The PHP Agent API call
newrelic_set_appnamehas been updated with security improvements in anticipation of future releases.
Upgrade Notices
- The
newrelic.daemon.sslini setting has been removed to increase security. Transport Layer Security (TLS) will now always be used in communication with the New Relic collector. - Laravel Queue support has now been enabled for all users. If
newrelic.feature_flag=laravel_queueis set, it will now be ignored.
Bug Fixes
- On FreeBSD and Solaris, when
newrelic.daemon.portis configured to use TCP to connect the agent to the daemon, the agent would have difficulty receiving application configuration data from the daemon due to the default timeout of 100 milliseconds matching the delay enforced by the FreeBSD kernel as part of its implementation of Nagle's algorithm. The PHP agent will now set theTCP_NODELAYflag when connecting to the daemon via TCP, which increases the reliability of the agent:daemon connection.
New Features
- Support for PHP 7.2 has been added.
Bug Fixes
- Datastore metrics would not be generated for Predis users who stopped and started the transaction after instantiating a
Predis\Clientobject. This included users using thenewrelic_set_appname()API. This has been fixed.