feat(sentry): add uptime section to morning digest via sentry-summary skill (#4070)#4133
feat(sentry): add uptime section to morning digest via sentry-summary skill (#4070)#4133Devesh36 wants to merge 5 commits into
Conversation
Greptile code reviewThis repo uses Greptile for automated review. Before merge, aim for Confidence Score: 5/5 with zero unresolved review threads — see CONTRIBUTING.md. Run a review — add a PR comment with: Give it ~5-10 minutes (sometimes longer) for results, then fix feedback and re-trigger until you reach Confidence Score: 5/5. Optional: automate with the greploop skill. |
Greptile SummaryThis PR delivers slice 1 of #4070 by wiring a new
Confidence Score: 5/5Safe to merge; the new tool reads only the local state file and the skill integration is additive and quiet when no watch history exists. The core transition-persistence logic in uptime.py is well-tested and handles the important edge cases (7-day retention, founding-DOWN pinning, atomic state saves). The two concerns are structural: the early-exit paths of get_sentry_uptime_digest return a narrower dict than the success path, and the availability check couples a local-disk read to Sentry API connectivity. Neither affects correctness under normal operation. integrations/sentry/tools/sentry_uptime_digest_tool/init.py — early-return response shape and is_available check. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Scheduler
participant Runner as morning_digest_runner
participant Harness as HeadlessAgent (gateway)
participant Skill as sentry-summary skill (LLM)
participant SentryAPI as Sentry API
participant Disk as Local state file
Scheduler->>Runner: run_sentry_morning_digest(payload)
Runner->>Harness: dispatch(prompt)
Harness->>Skill: invoke with tools
Skill->>SentryAPI: search_sentry_issues
SentryAPI-->>Skill: issue digest
Skill->>Disk: get_sentry_uptime_digest → load_all_watch_states()
Disk-->>Skill: "{still_down, recovered, ...}"
Skill->>Skill: compose digest (DOWN → Issues → RECOVERED)
Skill-->>Harness: formatted report
Harness-->>Runner: ShellTurnResult
Runner-->>Scheduler: report string (→ Slack/Telegram)
note over Disk: Written by run_uptime_watch_tick on each poll tick (separate schedule)
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Scheduler
participant Runner as morning_digest_runner
participant Harness as HeadlessAgent (gateway)
participant Skill as sentry-summary skill (LLM)
participant SentryAPI as Sentry API
participant Disk as Local state file
Scheduler->>Runner: run_sentry_morning_digest(payload)
Runner->>Harness: dispatch(prompt)
Harness->>Skill: invoke with tools
Skill->>SentryAPI: search_sentry_issues
SentryAPI-->>Skill: issue digest
Skill->>Disk: get_sentry_uptime_digest → load_all_watch_states()
Disk-->>Skill: "{still_down, recovered, ...}"
Skill->>Skill: compose digest (DOWN → Issues → RECOVERED)
Skill-->>Harness: formatted report
Harness-->>Runner: ShellTurnResult
Runner-->>Scheduler: report string (→ Slack/Telegram)
note over Disk: Written by run_uptime_watch_tick on each poll tick (separate schedule)
Reviews (4): Last reviewed commit: "refactor(sentry): update morning digest ..." | Re-trigger Greptile |
|
@greptile review |
…tion for improved readability
|
@greptile review |
| """Deterministic Sentry morning digest: Issues + uptime rollup (#4070).""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from dataclasses import dataclass | ||
| from datetime import UTC, datetime, timedelta | ||
| from pathlib import Path | ||
| from typing import Literal | ||
| from urllib.parse import urlparse | ||
|
|
||
| from integrations.sentry import SentryConfig, list_sentry_issues | ||
| from integrations.sentry.issue_digest import build_sentry_issue_digest | ||
| from integrations.sentry.project_scope import payload_project_slug | ||
| from integrations.sentry.uptime import ( | ||
| UptimeTransitionRecord, | ||
| WatchState, | ||
| load_all_watch_states, | ||
| parse_transition_at, | ||
| resolve_sentry_config, | ||
| ) | ||
| from platform.scheduler.agent_runner import AgentPayload |
There was a problem hiding this comment.
We should consider making this an AI skill that is stored in the memory and runs through the gateway.
There was a problem hiding this comment.
Would reconsider the approach here @Devesh36, sharing more context for skills on discord, refer https://github.com/Tracer-Cloud/opensre/pull/3996/changes#diff-2b8d60c9db133a39ff89cc8ce6dddbd3988650c9449c850543fbcf0628bb2e6c
…try-summary skill and enhance uptime reporting - Replaced the morning digest logic with the sentry-summary skill path for improved issue summarization. - Updated documentation to reflect changes in uptime reporting and digest structure. - Removed the now-obsolete morning_digest.py file and its associated tests. - Added new tests to ensure the sentry-summary skill correctly references all required tools, including uptime digest functionality.
|
@greptile review again |
…d add missing tool reference - Changed the lambda parameter name in mock datetime setup for clarity. - Added 'get_sentry_uptime_digest' to the set of tools without deliberate catch in telemetry tests.
|
dropped the deterministic morning_digest.py module and moved uptime into the sentry-summary skill + gateway path via a new get_sentry_uptime_digest tool. |
Fixes #4070
Describe the changes you have made in this PR -
Adds slice 1 of the Sentry uptime follow-ups: morning digest can now include an Uptime / downtime (last 24h) section, delivered through the existing sentry-summary skill + gateway headless runner — not a new deterministic digest module.
What changed
Uptime watch transition log (
integrations/sentry/uptime.py)DOWN/RECOVEREDevents inWatchState.transitionsload_all_watch_states()to merge history across watch tasksNew agent tool (
get_sentry_uptime_digest)sentry-summary skill (
integrations/sentry/tools/skills/sentry-summary/SKILL.md)get_sentry_uptime_digestto the skill tool listMorning digest runner (
integrations/sentry/morning_digest_runner.py)Docs (
docs/sentry.mdx)Out of scope (remaining #4070 follow-ups)
Demo/Screenshot for feature changes and bug fixes -
Flow:
Example digest shape:
[DOWN] Still downsection (if any) — above Issues[RECOVERED] In windowsection (if any) — after Issues