Pilih preferensi cookie Anda

Kami menggunakan cookie penting serta alat serupa yang diperlukan untuk menyediakan situs dan layanan. Kami menggunakan cookie performa untuk mengumpulkan statistik anonim sehingga kami dapat memahami cara pelanggan menggunakan situs dan melakukan perbaikan. Cookie penting tidak dapat dinonaktifkan, tetapi Anda dapat mengklik “Kustom” atau “Tolak” untuk menolak cookie performa.

Jika Anda setuju, AWS dan pihak ketiga yang disetujui juga akan menggunakan cookie untuk menyediakan fitur situs yang berguna, mengingat preferensi Anda, dan menampilkan konten yang relevan, termasuk iklan yang relevan. Untuk menerima atau menolak semua cookie yang tidak penting, klik “Terima” atau “Tolak”. Untuk membuat pilihan yang lebih detail, klik “Kustomisasi”.

Enabling the agent with code - Amazon CodeGuru Profiler
Halaman ini belum diterjemahkan ke dalam bahasa Anda. Minta terjemahan

Enabling the agent with code

If your application runs on a platform other than Lambda, install codeguru_profiler_agent through pip.

pip install codeguru_profiler_agent

You can configure the agent by passing different parameters to the Profiler object.

Option Constructor argument Details

Profiling group name (required)

profiling_group_name="MyProfilingGroup"

The name of the profiling group to send the data into. The Profiling group must exist.

Region

region_name="eu-west-2"

Use this if your application is not running in the same region as the one where the profiling group was created.

AWS session

aws_session=boto3.session.Session()

The session object that should be used to target the CodeGuru Profiler backends. Use this if you want to use different credentials or region than the default one. See boto3 session for more information.

Start the agent from one place in your application. We recommend you start the agent in your startup code. Only one Profiler object can be started at the time. The following is a runtime example.

from codeguru_profiler_agent import Profiler from boto3.session import Session ... custom_session = Session(profile_name='dev', region_name='us-east-1') Profiler(profiling_group_name='MyProfilingGroup', aws_session=custom_session).start() start_application() ...

You can find the sample code for the following examples in Amazon CodeGuru Profiler Python Demo Applications.

The following is an example of a simple application that sets your profiling group name to MyProfilingGroup.

from codeguru_profiler_agent import Profiler if __name__ == '__main__': Profiler(profiling_group_name='MyProfilingGroup').start() start_application()

Supported web components

The following topics provide code that you can add to your application to enable the Amazon CodeGuru Profiler agent.

Topics
    PrivasiSyarat situsPreferensi cookie
    © 2025, Amazon Web Services, Inc. atau afiliasinya. Semua hak dilindungi undang-undang.