Skip to content

fix: log per-event traffic and webhook notices at debug - #377

Merged
asternic merged 2 commits into
asternic:mainfrom
eliasmeireles:feat/webhook-notice-debug
Oct 8, 2026
Merged

asternic merged 2 commits into
asternic:mainfrom
eliasmeireles:feat/webhook-notice-debug

Conversation

@eliasmeireles

@eliasmeireles eliasmeireles commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Two kinds of log lines scale with traffic rather than with anything an operator can act on.

1. Webhook notices logged at Warn, once per discarded event:

  • Skipping webhook. Not subscribed for this type — the session subscribed to a subset of the events, so every other event it receives logs a warning.
  • No webhook set for user — the session has no webhook at all (RabbitMQ-only or polling setups).

2. Per-event traffic logged at Info: Message Received, Message delivered, Message was read, Chat Presence received, Facebook message received, plus the delete/edit detections.

Measured on a 150-session instance over one minute:

Level Lines/min
INFO 9,704
DEBUG 9,229
WARN 8,713
ERROR 0

28,123 lines/min in total. The container log file rotated every couple of minutes, so by the time an incident was investigated the relevant lines were already gone — that cost us real debugging time after a Client outdated outage, where the surviving window was shorter than the time it took to notice the problem.

Setting LOG_LEVEL=warn cut it to 1,862 lines/min, and ~90% of what remained was the two webhook notices — they are the only ones in this set that survive a severity filter, which is what makes them worth fixing in code rather than in configuration.

With both changes the same instance logs ~6 lines/min at warn, and the log file now holds hours of history instead of minutes.

Change

  • The webhook notices and the per-event traffic move to Debug. LOG_LEVEL=debug brings them back for anyone who relies on them, and the README documents that.
  • Actions the API performs on request stay at Info — Message sent, Message deleted, Message pinned and friends. There is one per API call, and they are the audit trail of what the caller asked for.

No behaviour change beyond the log level; the branches themselves are untouched.

Testing

go build ./..., go vet ./... and go test ./... pass.

'Skipping webhook. Not subscribed for this type' fires whenever a session
receives an event it did not subscribe to, and 'No webhook set for user'
whenever one without a webhook does — both describe supported setups, not
problems, and both are emitted once per discarded event.

On a 150-session instance they were ~90% of every line left at
LOG_LEVEL=warn: the log file rotated every couple of minutes, taking the
real warnings with it. LOG_LEVEL=debug brings them back when needed.
'Message Received', 'Message delivered', 'Message was read', 'Chat Presence
received', 'Facebook message received' and the delete/edit detections fire
once per event the server receives, so their volume tracks inbound traffic
rather than anything an operator acts on. On a 150-session instance they
were ~9.7k lines/min on their own.

Actions the API performs on request ('Message sent', 'Message deleted',
'Message pinned', ...) stay at info: those are the audit trail of what the
caller asked for, and there is one per API call.
@eliasmeireles eliasmeireles changed the title fix: log the webhook 'nothing to deliver' notices at debug fix: log per-event traffic and webhook notices at debug Oct 6, 2026
@asternic
asternic merged commit 67f894f into asternic:main Oct 8, 2026
1 check passed
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