getsentry / getsentry/sentry-java

@SentryCheckIn on @Scheduled methods should support monitor upsert via cron expression

未關閉
#5,467 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
Bug Checks Java Platform: Java
主要語言
Kotlin
星號
1.4k
分支
478
平均合併
3 天 4 小時
30 天內合併 PR
72

描述

### Integration

sentry

### Java Version

21

### Other Error Monitoring Solution

No

### Other Error Monitoring Solution Name

_No response_

### Version

8.41.0 (sentry-spring-boot-4, sentry-spring-7)

### Steps to Reproduce

I am using Spring Boot: 4.0.6

1. Annotate a @Scheduled method with @SentryCheckIn("my-monitor-slug") — do not pre-create the monitor in Sentry
2. Deploy and run the application
3. The scheduled method fires and a check-in is sent

### Expected Result

Since the method is already annotated with @Scheduled(cron = "0 0 4 * * *", zone = "Europe/Berlin"), the Spring integration has all the information needed to auto-create (upsert) the monitor on first check-in. The 6-field Spring cron should be converted to the 5-field Sentry cron format and included in the check-in payload as a MonitorConfig.

### Actual Result

Check-ins fail with the following error in Sentry:

> A check-in was sent for a monitor that does not exist.
If you meant to create a new monitor via upsert, please provide
a valid monitor configuration in the check-in payload.

Additionally, even when creating the monitor manually in the Sentry UI, the cron expression cannot be copied directly from @Scheduled — Spring uses a 6-field cron format (prepended seconds field, e.g. 0 0 4 * * *) while Sentry only accepts the standard 5-field Unix cron format (e.g. 0 4 * * *). This is an undocumented mismatch that requires the developer to know about and manually convert the expression.

貢獻指南

開啟貢獻指南

研究方向

找出處理帶有 @Scheduled 和 @SentryCheckIn 方法的 Spring 整合,接著檢查 check-in payload 和 MonitorConfig 的建構方式。重現缺少 monitor 的情況,並驗證像是 "0 0 4 * * *" 的六欄位 Spring cron 會轉換成 Sentry 的五欄位格式,並包含在 monitor upsert 中。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
java, spring-boot
領域
backend
Issue 類型
功能
難度
3/5
預估耗時
1-2 天
活躍度
冷清
描述清晰度
基本清楚
新手友好度
58/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。