zhammer / morning-cd

What was the first piece of music you listened to this morning?
MIT License
4 stars 0 forks source link

Check out AWS x ray #128

Closed zhammer closed 5 years ago

zhammer commented 5 years ago

https://aws.amazon.com/xray/

zhammer commented 5 years ago

Maybe could set correlation id in header on delivery Then all communication methods (requests, queues, sns) could — if they find correlation id — add to their headers / metadata

zhammer commented 5 years ago

Wow this is so cool. Lambda handles the xray logging of incoming requests & responses.. then you patch out (in delivery) all of your io libraries.

All of the io libraries i use (sqlalchemy, requests, boto3) already have built in support from the xray sdk!!

https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-python.html

https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-python-patching.html

zhammer commented 5 years ago

The other difference between instrumenting Lambda functions and web applications is that the segment that Lambda creates and sends to X-Ray cannot be modified by your function code. You can create subsegments and record annotations and metadata on them, but you can't add annotations and metadata to the parent segment.

zhammer commented 5 years ago

So all i have to do is “patch_all” in delivery, then use the xray sdk sqlalchemy client (not sure why i cant patch this out too)

from aws_xray_sdk.ext.sqlalchemy.query import XRaySessionMaker

Session = XRaySessionMaker(bind=engine)
session = Session()
zhammer commented 5 years ago

https://github.com/alex-murashkin/serverless-plugin-tracing

zhammer commented 5 years ago

setup basic x ray tracing. following up on the sns -> sqs following in #130