Skip to content

Sentry split type and value#50

Open
fogelito wants to merge 1 commit into
mainfrom
verbose-type
Open

Sentry split type and value#50
fogelito wants to merge 1 commit into
mainfrom
verbose-type

Conversation

@fogelito

@fogelito fogelito commented Jul 6, 2026

Copy link
Copy Markdown

No description provided.

@greptile-apps

greptile-apps Bot commented Jul 6, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes the Sentry exception payload by correctly splitting the exception class name (type) and the human-readable message (value) into separate fields, aligning with the Sentry exception interface spec.

  • The type field now reads from $log->getTags()['verboseType'] (falling back to 'Exception'), while value carries $log->getMessage() — previously both were conflated into type alone.
  • The verboseType tag key is an implicit convention with no in-repo documentation or constant; callers unaware of it will silently send every exception as type "Exception" in Sentry.
  • verboseType will also remain in the top-level tags payload since $log->getTags() is forwarded as-is, causing the value to appear twice in each Sentry event.

Confidence Score: 4/5

The core fix is correct and improves Sentry event quality; the two observations are about discoverability and minor payload duplication that don't break anything.

The change does the right thing structurally — Sentry events will now correctly distinguish exception class from message. The only rough edges are that the verboseType convention is invisible to callers (no constant, no doc, no Log helper), so they will silently get a generic type unless they happen to know the magic key, and the tag also leaks into the raw tags map in the same payload.

src/Logger/Adapter/Sentry.php — worth a second look at how callers are expected to supply verboseType and whether it should be filtered from the tags map.

Important Files Changed

Filename Overview
src/Logger/Adapter/Sentry.php Corrects the Sentry exception payload by splitting message into the proper type/value fields; the verboseType tag is undocumented and also leaks into the top-level tags payload

Comments Outside Diff (1)

  1. src/Logger/Adapter/Sentry.php, line 138-146 (link)

    P2 verboseType appears twice in the Sentry event

    $log->getTags()['verboseType'] is consumed on line 138 to set the exception type, but $log->getTags() is also sent verbatim as the top-level tags field on line 146. This means verboseType ends up duplicated in the event — once as the exception type and again as a raw tag. Consider unsetting or filtering verboseType from the tags payload to keep the event clean.

Reviews (1): Last reviewed commit: "Update exeption" | Re-trigger Greptile

'values' => [
[
'type' => $log->getMessage(),
'type' => $log->getTags()['verboseType'] ?? 'Exception',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Undocumented verboseType tag convention

The verboseType key is only referenced here — it is never set anywhere else in this repository. Callers who do not explicitly add a verboseType tag will silently fall back to the generic 'Exception' type for every exception in Sentry, losing all class-name granularity. There is no doc-comment, constant, or Log method that signals this expectation to callers.

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.

1 participant