Skip to content

changing lambda segment immutability #308

Open
@myke2424

Description

@myke2424

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions