Skip to content

Create a WARNING activity log if an observation is filtered#13

Draft
vgarcia13 wants to merge 1 commit intomainfrom
activity-log-if-obs-is-filtered
Draft

Create a WARNING activity log if an observation is filtered#13
vgarcia13 wants to merge 1 commit intomainfrom
activity-log-if-obs-is-filtered

Conversation

@vgarcia13
Copy link
Copy Markdown

Relevant Link

https://allenai.atlassian.net/browse/GUNDI-4351


This pull request introduces changes to enhance logging in the webhook_handler function by adding a new activity logging mechanism and improving log granularity. It also includes an update to the imported modules to support these enhancements.

Logging enhancements:

  • app/webhooks/handlers.py: Changed the log level for filtered data from info to warning to better reflect the significance of the event.
  • app/webhooks/handlers.py: Added a call to log_webhook_activity to log detailed information about filtered observations, including integration and webhook IDs, log level, title, and relevant data.

Module updates:

  • app/webhooks/handlers.py: Added an import for LogLevel from gundi_core.schemas.v2 and extended the import of webhook_activity_logger to include log_webhook_activity from app.services.activity_logger.

Comment thread app/webhooks/handlers.py
for data in transformed_data:
if data.get("status", "OK") != 'OK':
logger.info(f"'{data}' point received was filtered")
logger.warning(f"'{data}' point received was filtered")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vgarcia13 how many of these do you think we'll see?

Copy link
Copy Markdown
Author

@vgarcia13 vgarcia13 Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have 8 generic webhook configs and today we have filtered 5 invalid observations (all from the Namibia Waldeck Rhino Project webhook). At least for that webhook, I'd say from 3 to 5 per day

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are logging these cases and it is easy to filter them in GCP, so we can leave this as a nice to have and evaluate if we really need this now. I am guessing your question is regarding the number of activity logs we may have and if that can turn into a problem if there are too many of them

@vgarcia13 vgarcia13 requested a review from chrisdoehring June 25, 2025 00:26
@vgarcia13 vgarcia13 marked this pull request as draft June 25, 2025 16:30
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