Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better logging and error handling for pollers #124

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

bryophyta
Copy link
Contributor

@bryophyta bryophyta commented Jan 30, 2025

What does this change?

Add structured logging to poller lambdas:

  • Change loggingFormat to 'text' instead of JSON, for compatibility with our lambda log shipping stack.
  • Add logger abstraction inspired by: https://github.com/guardian/service-catalogue/pull/1131/files
    • Extended by allowing us to set 'default' fields in the logging, akin logmarkers.
    • Adjust the poller function definition to allow passing in a logger from the poller wrapper
  • Add invocation and error logging to poller lambda wrapper, and error logging to the Reuters poller

By adding metadata like sqsMessageId to logging, it should be easier to track issues in the logs. Currently plain console.log etc. are still used in the body of the poller functions, but if we like this pattern then we could convert these, and possibly add an eslint rule to enforce using logger. rather than console..

How to test

  • Deploy to CODE, check that logs come in as expected
image

How can we measure success?

Have we considered potential risks?

Images

Accessibility

@bryophyta bryophyta force-pushed the pf/better-error-handling-reuters branch from c69df3a to b56ac77 Compare January 30, 2025 14:55
@bryophyta bryophyta force-pushed the pf/better-error-handling-reuters branch from b56ac77 to 783883e Compare January 30, 2025 16:20
@bryophyta bryophyta changed the title Pf/better error handling reuters Better logging and error handling for pollers Jan 30, 2025
@bryophyta bryophyta marked this pull request as ready for review January 30, 2025 16:33
@bryophyta bryophyta requested a review from a team as a code owner January 30, 2025 16:33
- Add logger abstraction from: https://github.com/guardian/service-catalogue/pull/1131/files
- Add invocation and error logging to poller lambda wrapper, and error
  logging to the Reuters poller
@bryophyta bryophyta force-pushed the pf/better-error-handling-reuters branch from 783883e to f8f4a93 Compare January 31, 2025 17:00
@bryophyta bryophyta merged commit 89a1955 into main Feb 4, 2025
3 checks passed
@bryophyta bryophyta deleted the pf/better-error-handling-reuters branch February 4, 2025 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants