Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Use typed detector schemas from @sentry/api for metric monitors

Đang mở
#1,595 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@MathurAditya724 đang làm issue này rồi.

Từ ngày 22/10/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

@sentry/api leaves the detector (monitor) payloads mostly untyped. Because of that, toolkit has to keep its own copy of the metric monitor data source and condition values.

Checked against @sentry/api 0.381.0, the latest release. The CLI pins ^0.356.0 and mcp-core pins 0.337.0.

Gaps in types.gen.d.ts

  • Create/UpdateOrganizationDetectorData: data_sources?: Array<unknown> and condition_group.conditions?: Array<unknown>. config is { [key: string]: unknown }.
  • GetOrganizationDetectorResponses[200]: dataSources, conditionGroup, and config are all { [key: string]: unknown }.
  • The accepted values appear only in doc comments: dataset, queryType, eventTypes, timeWindow, condition type/comparison/conditionResult, and detectionType/comparisonDelta. The generated zod and valibot schemas have the same gaps.

Workaround today
#1591 adds @sentry/toolkit-core/metric-monitor. It hand-copies these values from Sentry's SnubaQueryValidator (QUERY_TYPE_VALID_DATASETS / QUERY_TYPE_VALID_EVENT_TYPES) and MetricIssueComparisonConditionValidator. The CLI (packages/cli/src/types/metric-alert.ts, packages/cli/src/lib/api/alerts.ts) and MCP (packages/mcp-core/src/tools/support/metric-monitor-config.ts) both consume that module and cast detector bodies through unknown.

Ask

  • Get typed detector schemas into @sentry/api, likely by adding typed serializers or validators for the detector endpoints in getsentry/sentry so the generated OpenAPI spec carries them:
    • a snuba-query data source (dataset / queryType / eventTypes enums)
    • metric comparison and anomaly conditions
    • detection config
  • Once those land, swap @sentry/toolkit-core/metric-monitor and the CLI/MCP casts for the generated types and schemas, and bump @sentry/api in both packages.

Raised by @BYK in review on #1591.

via BYK.

--

View Junior Session [Sentry]

Ngôn ngữ chính
TypeScript
Star
938
Fork
166
Merge trung bình
1 ngày 7 giờ
Pull request đã merge (30 ngày)
156

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của getsentry/toolkit

Tất cả issue của getsentry/toolkit

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.