feat/trace-fields-for-dashboards #2

Merged
hutao merged 2 commits from feat/trace-fields-for-dashboards into main 2026-09-17 13:20:01 +00:00
Owner

Summary

Short description of what this changes and why.

Closes #

Changes

Testing

How this was verified (e.g. cargo test, cargo clippy --all-targets, manual
run with the relevant features).

Checklist

  • cargo fmt --check passes
  • cargo clippy passes
  • Docs/CHANGELOG updated where relevant
  • .sqlx/ regenerated if queries changed (cargo sqlx prepare)
  • Conventional-commit PR title (type(scope): ...)
<!-- See CONTRIBUTORS.md and AGENTS.md before opening: KISS, YAGNI, surgical changes, conventional-commit titles. --> ## Summary Short description of what this changes and why. ## Related issue Closes # ## Changes - ## Testing How this was verified (e.g. `cargo test`, `cargo clippy --all-targets`, manual run with the relevant features). ## Checklist - [ ] `cargo fmt --check` passes - [ ] `cargo clippy` passes - [ ] Docs/CHANGELOG updated where relevant - [ ] `.sqlx/` regenerated if queries changed (`cargo sqlx prepare`) - [ ] Conventional-commit PR title (`type(scope): ...`)
`guild_id` was written two ways. The message path used `?message.guild_id`,
which renders the `Debug` of `Option<GuildId>` — `Some(GuildId(123))` — while
the command spans and the levelling queries recorded the bare snowflake. The
backend sees two unrelated values for one guild, so every per-guild aggregate
was split between them. The message path now follows the command convention:
the snowflake, with `0` for DMs. That also makes DM traffic queryable, since a
missing attribute is indistinguishable from a span that never records one.

The same spans were exporting whole serenity structs. `#[instrument]` records
every argument it is not told to skip, so `skip(ctx)` left `new_message`,
`data`, `pool` and the available-command list to be Debug-formatted into the
trace on every message — the full `Message`, author object and content
included, and then again through an explicit `message = ?new_message`. They
now use `skip_all` with named fields. `handle_replies` keeps `message_text`:
that span exists because the content matched, so the text is the reason it
fired.

Adds `channel_id` and `attachments` to `handle_message` and `guild_id` to the
AI auto-reply span, which is what per-guild, per-channel and attachment
breakdowns need.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
fix(commands): stop pasted links warning about unknown commands
All checks were successful
Rust, Docker, Code Coverage / fmt (pull_request) Successful in 15s
Rust, Docker, Code Coverage / clippy (--all-features) (pull_request) Successful in 41s
Rust, Docker, Code Coverage / clippy () (pull_request) Successful in 1m11s
Rust, Docker, Code Coverage / clippy (--features "opentelemetry ai-openrouter util-download") (pull_request) Successful in 40s
Rust, Docker, Code Coverage / build (--all-features) (pull_request) Successful in 55s
Rust, Docker, Code Coverage / build () (pull_request) Successful in 1m34s
Rust, Docker, Code Coverage / build (--features "opentelemetry ai-openrouter util-download") (pull_request) Successful in 52s
Rust, Docker, Code Coverage / test (pull_request) Successful in 2m24s
fffc7bec91
`ht` is a bot prefix, so poise recognizes a prefix in every message that opens
with a link: `https://klipy.com/gifs/x` is the prefix `ht` followed by the
"command" `tps://klipy.com/gifs/x`. Nothing was ever executed — the message
falls through to `UnknownCommand` — but the builtin error handler warns for
each one, and pasted links are the bulk of the warn log.

`UnknownCommand` is now skipped when the prefix and the remaining content
reassemble into an `http://` or `https://` link. Genuine unrecognized commands
still warn, and `ht` still works without a separating space.

The check is case-insensitive because the prefixes are matched
case-insensitively: `HTTPS://X` arrives as the prefix `HT` and `TPS://X`.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
hutao merged commit 21a77ce911 into main 2026-09-17 13:20:01 +00:00
hutao deleted branch feat/trace-fields-for-dashboards 2026-09-17 13:20:02 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
hutao/serenity-discord-bot!2
No description provided.