Nullify-Platform / Logger

Nullify logging library for backend services
https://github.com/Nullify-Platform
0 stars 0 forks source link

feat: add tracing and error collection #52

Closed lhjt closed 7 months ago

lhjt commented 7 months ago

Description

This PR adds error collection and monitoring for all services that use this logger service.

When calling the ConfigureProductionLogger function, it will also initialise sentry, which will check for the existence of the SENTRY_DSN environment variable. This works with sentry or glitchtip, so it should be quite easy to change out if we choose to use another exception handler.

Currently, it is hooked into the zap.Error function such that whenever an error is wrapped, it will be captured by this ingester.

Checklist

lhjt commented 7 months ago

Will have to go through and begin adding the SENTRY_DSN env vars to the other projects once this is added, but it should work fine without them as well.

lhjt commented 7 months ago

There's currently an issue that prevents events from being delivered reliably - I have determined that the defer calls to flush logs are just not executed as lambda freezes the container after the request has been processed, meaning that the function isn't actually exiting. This behaviour has been documented in this thread: https://github.com/aws/aws-lambda-go/issues/318

There's currently an engineering proposal to introduce a dedicated method to ensure that all flushers can be called in this engineering document from opentelemetry.

The current remedy will be to change to the synchronous events reporter -> will ask the team what they think