Python サーバレストレーサ
このページでは、開発時における Python 関数のインストルメンテーション プロセスの要件と概要について説明します。これらのマニュアルで使用されている Amazon Web サービス、AWS ロゴ、AWS、およびその他の AWS マークは、米国およびその他の国における 1, Inc. またはその関連会社の商標です。Splunk AppDynamicsLambda Extension。「Splunk AppDynamicsAppDynamics AWS Lambda Extension を使用して、実行時にサーバーレス APM をインストゥルメントする 」を参照してください。
Before You Begin
Ensure that your setup meets the following requirements:
- Existing AWS Lambda functions implemented in Python 3.7, 3.8, and 3.9
- Python Package Installer (the
pipversion must match the Python version of your AWS Lambda function) - Controller >= 4.5.16
Install the Python Serverless Tracer
The Python Serverless Tracer is available for download in PyPi repository. You can install the Python Serverless Tracer locally or package it with your AWS Lambda function code.
Install Locally
Run a pip install command to install the tracer in your local environment:
pip install appdynamics-lambda-tracerIf you install the tracer locally, you need to package the tracer with your AWS Lambda function at runtime.
Package with AWS Lambda Functions
Run the following command to include the tracer in your function's package:
pip install --target ./package/ appdynamics-lambda-tracerSee AWS documentation to learn more about packaging dependencies in your functions.
関数コードのインストゥルメント化
AWS Lambda 関数をインストゥルメント化するには、次のコード行を追加します。
import appdynamics # Add Splunk AppDynamics libraries. Must be the first line of code
@appdynamics.tracer # Must come before the handler function
def my_handler(event, context):
print("Hello world!")
exit コールのインストルメンテーション
デフォルトでは、Python サーーバレストレーサは、HTTP、Amazon DynamoDB、および AWS Lambda 間の exit コールを自動的に検出します。関数によって行われた他のタイプの外部コールを可視化する場合は、Python Tracer API を使用して exit コールを作成します。「Python サーバーレストレーサ API」を参照してください。
Python サーバレストレーサ API
このページでは、Python サーバレストレーサ API を使用して、AWS Lambda 関数内のトレーサの動作を変更する方法について説明します。
エンドユーザモニタリングと Python トレーサの統合
AWS Lambda 向けサーバレス APM は、既存のエンドユーザーモニタリング(EUM)設定と統合できるように設計されています。EUM 統合は、web およびモバイルアプリケーションのパフォーマンスに対する完全なエンドツーエンドの可視性を確保し、エンドユーザデバイスからサーバレス機能を介してエンドユーザデバイスのコールを関連付け、ビジネストランザクションを続行します。
AWS Lambda 関数は、EUM と AWS Lambda によって発信されたビジネストランザクションを、次の EUM エージェントとともに関連付けることができます。
- ブラウザ リアル ユーザー モニタリング(RUM)
- モバイル リアル ユーザー モニタリング(モバイル RUM)の利点 エンドユーザモニタリングと Python トレーサの統合
- IoT モニタリング