Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

Add Swift Lambda Runtime (and XRay) use case #36

Open
slashmo opened this issue Jun 18, 2020 · 7 comments
Open

Add Swift Lambda Runtime (and XRay) use case #36

slashmo opened this issue Jun 18, 2020 · 7 comments
Labels
i:aws-lambda Relates to swift-aws-lambda-runtime use-case Exploring different use cases of the API

Comments

@slashmo
Copy link
Owner

slashmo commented Jun 18, 2020

One interesting use case for us could be the AWS Lambda Runtime. I can imagine an example where some processing happens in a Lambda that adds to a BaggageContext. (Once we get to this use case we can come up with a more specific plan on what to do)

@slashmo slashmo added the i:aws-lambda Relates to swift-aws-lambda-runtime label Jun 18, 2020
@ktoso
Copy link
Collaborator

ktoso commented Jun 18, 2020

Yup!
It should be very simple to adopt it in the Lambda lib.

FYI @fabianfett @tomerd

@fabianfett
Copy link

Just looked up the XRay tracing deamons api. Looks like it is just JSON over UDP.
https://docs.aws.amazon.com/xray/latest/devguide/xray-api-sendingdata.html#xray-api-daemon

To get it into JSON without using Foundation this might be a good starting point:
https://github.com/fabianfett/swift-log-json-to-std/blob/affbe225cbd5bf22c3d4943f48edada5c9cbdbff/Sources/LoggingJSONToSTD/JSONLogHandler.swift#L115

@slashmo @ktoso I sadly haven't followed the two off you to closely... Is there already a protocol to implement for Tracing Backends?

JSON over UDP sounds like a fun challenge for me. I haven't set up a channel pipeline yet, but this sounds like a good first time.

@ktoso
Copy link
Collaborator

ktoso commented Jun 18, 2020

Just looked up the XRay tracing deamons api. Looks like it is just JSON over UDP.
https://docs.aws.amazon.com/xray/latest/devguide/xray-api-sendingdata.html#xray-api-daemon

Cool, very nice that it's so simple.

Is there already a protocol to implement for Tracing Backends?

It's a bit to early to point at specifics, but yes there will be. Today we only have instruments which are about extracting/injecting metadata into a baggage context object (i.e. from headers -> baggage -> outgoing headers when making requests); We don't have the Tracer "shape" yet.

I guess there's a difference between "lambda lib uses baggage context" and "there is an XRay tracing backend" :-) This was more about the prior, but yes the latter will be a goal as well eventually!

No action required from you, just FYI that we're looking at the Lambda lib as one of the use cases :)

@fabianfett
Copy link

For future reference XRay's Segment Design: https://docs.aws.amazon.com/xray/latest/devguide/xray-api-segmentdocuments.html

@ktoso ktoso changed the title Add Swift Lambda runtime use case Add Swift Lambda runtime use case (and XRay) Jun 18, 2020
@ktoso ktoso changed the title Add Swift Lambda runtime use case (and XRay) Add Swift Lambda Runtime (and XRay) use case Jun 18, 2020
@slashmo slashmo added the use-case Exploring different use cases of the API label Jun 18, 2020
@tomerd
Copy link

tomerd commented Jun 18, 2020

JSON over UDP sounds like a fun challenge for me. I haven't set up a channel pipeline yet, but this sounds like a good first time.

@fabianfett we done some similar work in https://github.com/apple/swift-statsd-client maybe some inspiration there

@pokryfka
Copy link
Contributor

pokryfka commented Jun 25, 2020

Hi all,

I implemented XRay Recorder for Swift: https://github.com/pokryfka/aws-xray-sdk-swift

I do use XRay tracing in Lambdas a lot and was lacking that when "Messing with Swift AWS Lambda Runtime".

Following up this project, happy to help with XRay client testing/implementation when protocols for Tracing Backends are defined.

BTW, for my "lambda purposes" I send all the segments via HTTP (using PutTraceSegments API) or UDP, just once at the end of each lambda event processing.

@ktoso
Copy link
Collaborator

ktoso commented Jun 25, 2020

That's awesome, thanks for reaching out!
I expect we'll get some initial shapes of tracer instrument protocols very soon -- will ping here so you can try them out as well, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i:aws-lambda Relates to swift-aws-lambda-runtime use-case Exploring different use cases of the API
Projects
None yet
Development

No branches or pull requests

5 participants