feat: send structured logs to GlitchTip via Sentry Logs API #10
No reviewers
Labels
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
brooktrails/forgejo-runner-operator!10
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/sentry-logs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Enable Sentry Logs (EnableLogs: true) in both admin-registrar and
controller. Add sentryLog helper and emit info-level logs at each
handler lifecycle step (user created, collaborator added, token
created, credentials stored, etc.) alongside existing stdout logging.
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com
Automated review by pr-reviewer v0.15.0 | Full Review | anthropic | tracking id
r-c49102-502434This is an AI-generated review and may contain mistakes.
Status: ✅ Completed
✅ Verdict: Approve — The changes are well-implemented with proper error handling and consistent logging patterns.
Complexity: moderate
Code Review: Enable Sentry Logs API Integration
This PR successfully adds structured logging to GlitchTip via the Sentry Logs API. The implementation is clean, consistent, and follows good practices.
Positive Aspects
Clean Implementation
EnableLogs: truein their client initializationsentryLoghelper provides a clean abstraction for sending structured logs with proper level handling and no-op behavior when Sentry isn't configuredError Handling & Safety
sentryLoghandles all Sentry log levels correctly with a sensible defaultCode Quality
internal/registrar/sentry.goArchitecture & Design
The approach of adding structured logs at each handler step is sound:
captureErrorfunctionMinor Observations
No Major Issues
TracesSampleRate: 1.0in controller/main.go is acceptable for this use caseTest Coverage
While there are no tests for the new functionality, this is consistent with the existing codebase pattern. The Sentry logging is primarily observability infrastructure that's difficult to unit test meaningfully.
Summary
This is a solid implementation that adds valuable operational visibility without introducing complexity or risk. The structured logs will provide good insights into the admin-registrar workflow execution, which should help with debugging and monitoring.
The changes are backwards compatible and degrade gracefully when Sentry is not configured, making this a safe addition to the system.
Automated review by pr-reviewer v0.15.0 | Full Review | anthropic | tracking id
r-c4913b-a17697This is an AI-genrated review and may contain mistakes.
Status: ✅ Completed
✅ Verdict: Approve — Clean implementation that adds structured logging to Sentry with proper safeguards and no breaking changes.
Complexity: trivial
Code Review: feat: send structured logs to GlitchTip via Sentry Logs API
This PR adds structured logging to GlitchTip/Sentry by enabling the Logs feature and adding info-level log events at key handler lifecycle steps. The implementation is clean and well-thought-out.
✅ Positive Aspects
sentryLoghelper function is well-designed with proper level handling and attribute attachmentCurrentHub().Client() == nil) to prevent crashes when Sentry is disabledsentryTagsmap across all log calls within each handler method📝 Code Quality
internal/registrar/sentry.go
sentryLogfunction properly handles all Sentry log levels with a sensible default fallbackHandler Integration (internal/registrar/handler.go)
sentryTagsfor consistencyConfiguration Changes (main.go files)
EnableLogs: true) to existing Sentry configuration🔍 Technical Considerations
📊 Missing Test Coverage
While the diff shows no tests were added, this is acceptable for this change because:
🎯 Recommendations
Consider adding a simple test to verify the
sentryLogfunction handles the nil client case gracefully, but this is not blocking for merge.Summary
This is a well-implemented feature that adds valuable observability without introducing risk. The structured logs will provide better visibility into the admin-registrar workflow in production environments while maintaining all existing safeguards.