Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve botocore instrumentation examples #3348

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
.. code:: python

from opentelemetry.instrumentation.botocore import BotocoreInstrumentor
import botocore
import botocore.session


# Instrument Botocore
Expand All @@ -39,7 +39,7 @@
session.set_credentials(
access_key="access-key", secret_key="secret-key"
)
ec2 = self.session.create_client("ec2", region_name="us-west-2")
ec2 = session.create_client("ec2", region_name="us-west-2")
ec2.describe_instances()

API
Expand All @@ -58,13 +58,15 @@
.. code: python

from opentelemetry.instrumentation.botocore import BotocoreInstrumentor
import botocore
import botocore.session

def request_hook(span, service_name, operation_name, api_params):
# request hook logic
pass

def response_hook(span, service_name, operation_name, result):
# response hook logic
pass

# Instrument Botocore with hooks
BotocoreInstrumentor().instrument(request_hook=request_hook, response_hook=response_hook)
Expand All @@ -74,7 +76,7 @@ def response_hook(span, service_name, operation_name, result):
session.set_credentials(
access_key="access-key", secret_key="secret-key"
)
ec2 = self.session.create_client("ec2", region_name="us-west-2")
ec2 = session.create_client("ec2", region_name="us-west-2")
ec2.describe_instances()

Extensions
Expand Down
Loading