Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.25.0

require (
github.com/coreos/go-systemd/v22 v22.6.0
github.com/getsentry/sentry-go v0.36.2
github.com/getsentry/sentry-go v0.40.0
Copy link

Choose a reason for hiding this comment

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

Bug: Sentry events are lost on graceful shutdown because sentry.Flush() is not called due to the new async transport in sentry-go v0.40.0.
Severity: HIGH | Confidence: High

🔍 Detailed Analysis

The shutdownSentry() function in cmd/poseidon/main.go only calls sentry.Flush() when recovering from a panic. With the upgrade to sentry-go v0.40.0 (which includes v0.38.0+ changes), Sentry now uses an async envelope transport and telemetry buffer. This queues events for batch transmission. Consequently, during a normal graceful shutdown, sentry.Flush() is never explicitly called, leading to buffered Sentry events being lost as the application terminates. This results in data loss for any Sentry events captured during normal operation.

💡 Suggested Fix

Modify the shutdownSentry() function or the graceful shutdown path to explicitly call sentry.Flush(logging.GracefulSentryShutdown) during normal application termination, ensuring all buffered Sentry events are sent before exit.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: go.mod#L7

Potential issue: The `shutdownSentry()` function in `cmd/poseidon/main.go` only calls
`sentry.Flush()` when recovering from a panic. With the upgrade to `sentry-go` v0.40.0
(which includes v0.38.0+ changes), Sentry now uses an async envelope transport and
telemetry buffer. This queues events for batch transmission. Consequently, during a
normal graceful shutdown, `sentry.Flush()` is never explicitly called, leading to
buffered Sentry events being lost as the application terminates. This results in data
loss for any Sentry events captured during normal operation.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 4158823

github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.1
github.com/gorilla/websocket v1.5.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/getsentry/sentry-go v0.36.2 h1:uhuxRPTrUy0dnSzTd0LrYXlBYygLkKY0hhlG5LXarzM=
github.com/getsentry/sentry-go v0.36.2/go.mod h1:p5Im24mJBeruET8Q4bbcMfCQ+F+Iadc4L48tB1apo2c=
github.com/getsentry/sentry-go v0.40.0 h1:VTJMN9zbTvqDqPwheRVLcp0qcUcM+8eFivvGocAaSbo=
github.com/getsentry/sentry-go v0.40.0/go.mod h1:eRXCoh3uvmjQLY6qu63BjUZnaBu5L5WhMV1RwYO8W5s=
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
github.com/go-jose/go-jose/v3 v3.0.4 h1:Wp5HA7bLQcKnf6YYao/4kpRpVMp/yf6+pJKV8WFSaNY=
Expand Down
Loading