Skip to content

observability: allow on-cancel observation finalizing and async error gathering

Created by: Strum355

Previously, the observation package allowed only for observing a function from start to end. In the case of the GraphQL API, an entrypoint can return types that can be further resolved in an iterative yielding pattern, as opposed to recursively. As such, observing the entrypoint would not capture anything from the yielded sub-resolvers unless they too were observed independently. Our original approach did just that, passing down the named *observation.Operation for the entrypoint and starting a new observation off of that every time.

This PR allows for an observation to last beyond the return of the source function, and to be finished when a context is cancelled. To gather later sub-errors and args, and ErrorTracer type is introduced that can be passed around and defer collection of potential errors into a multierr.

Merge request reports

Loading