Skip to content

Commit

Permalink
change to new example
Browse files Browse the repository at this point in the history
  • Loading branch information
roger-zhangg committed Apr 10, 2024
1 parent 844d85b commit cedb2af
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions examples/tracer/src/sdk_escape_hatch copy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from aws_lambda_powertools import Tracer
from aws_lambda_powertools.utilities.typing import LambdaContext

tracer = Tracer()


def collect_payment(charge_id: str) -> str:
return f"dummy payment collected for charge: {charge_id}"


@tracer.capture_lambda_handler
def lambda_handler(event: dict, context: LambdaContext) -> str:
charge_id = event.get("charge_id", "")
with tracer.provider.in_subsegment("## collect_payment") as subsegment: # type: ignore
subsegment.put_annotation(key="PaymentId", value=charge_id)
ret = collect_payment(charge_id=charge_id)
subsegment.put_metadata(key="payment_response", value=ret)

return ret
File renamed without changes.

0 comments on commit cedb2af

Please sign in to comment.