Python サーバレストレーサ

このページでは、開発時における Python 関数のインストルメンテーション プロセスの要件と概要について説明します。これらのマニュアルで使用されている Amazon Web サービス、AWS ロゴ、AWS、およびその他の AWS マークは、米国およびその他の国における 1, Inc. またはその関連会社の商標です。Splunk AppDynamicsLambda Extension。「Splunk AppDynamicsAppDynamics AWS Lambda Extension を使用して、実行時にサーバーレス APM をインストゥルメントする 」を参照してください。

注: このドキュメントには、Amazon Web Services(AWS)のマニュアルへのリンクが含まれています。Amazon のマニュアルは Amzzon が管理しているため、Splunk AppDynamics では Amazon のマニュアルの精度については一切保証しません。

Before You Begin

Ensure that your setup meets the following requirements:

  • Existing AWS Lambda functions implemented in Python 3.9 to 3.13
  • Python Package Installer (the pip version must match the Python version of your AWS Lambda function)
  • Splunk AppDynamics On-Premises Controller >= 4.5.16

Python サーバレストレーサのインストール

注: Python サーバレストレーサは、Python 3.7 以降で使用できます。PyPi から取得するトレーサのバージョンは、AWS で関数コードを実行するために使用する Python のバージョンと一致する必要があります。

Python サーバレストレーサは、PyPi リポジトリからダウンロードできます。Python サーバレストレーサは、ローカルにインストールすることも、AWS Lambda 関数コードにパッケージ化することもできます。

ローカルへのインストール

pip install コマンドを実行して、トレーサをローカル環境にインストールします。

pip install appdynamics-lambda-tracer

トレーサをローカルにインストールする場合は、実行時にトレーサを AWS Lambda 関数にパッケージ化する必要があります。

AWS Lambda 関数にパッケージ化

次のコマンドを実行して、関数のパッケージにトレーサを含めます。

pip install --target ./package/ appdynamics-lambda-tracer

関数のパッケージ化の依存関係の詳細については、AWS のドキュメントを参照してください。

関数コードのインストゥルメント化

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」を参照してください。

注: このページには、AWS のマニュアルへのリンクが含まれています。Amazon で自身のマニュアルを管理しているため、Splunk AppDynamics では Amazon のマニュアルの精度については一切保証しません。

Python サーバレストレーサ API

このページでは、Python サーバレストレーサ API を使用して、AWS Lambda 関数内のトレーサの動作を変更する方法について説明します。

Integrate the Python Tracer with End User Monitoring

Serverless APM for AWS Lambda is designed to integrate with your existing End User Monitoring (EUM) configurations. EUM integration provides complete end-to-end visibility on the performance of your web and mobile applications, linking calls from an end-user device through your serverless functions to continue your business transactions

AWS Lambda functions can correlate EUM and AWS Lambda-originated business transactions, in conjunction with the following EUM agents:

注: This document assumes you are familiar with Splunk AppDynamicsEnd User Monitoring. See

End User Monitoring

.
1 Amazon.com