aws / aws/aws-xray-sdk-python

changing lambda segment immutability

Offen
#308 2 Kommentare 4 Reaktionen 1 zugewiesene Person Beansprucht von @bhautikpip Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Python
Sterne
338
Forks
147
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

It would be a nice feature if you had the ability to mutate segments in lambda handlers.

With the immutability limitation, it renders the service map error visibility useless if we're catching all exceptions in our lambda handler but still want to display the exception on the corresponding node in the graph.

For example, lets say you have the following design pattern:

Lambda handler that catches all exceptions and returns a response no matter what, this way, the client is always expecting a response value from the handler, regardless if an exception is raised.

If the segments in lambdas weren't immutable, we could get the current segment from the **xray_recorder** and call the **add_exception** method to attach the exception to the segment, thus, reflecting the error on the segment node in the graph.

Right now, all we can do is add the exception to the current subsegment, which still helps when inspecting the trace, but from a visual perspective, the map won't show any errors.

I'm aware of using API gateway with the handler, and returning a **4xx** http response when we catch our exception. This improves visibility somewhat, because the client and api gateway nodes flag the errors, but still the lambda node will be healthy.

Also, this forces us to use API gateway to handle this design pattern, which we might not want to use.

We'd really like this change at my place of work for our current use case.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.