Skip to content

Metric issue output missing alert rule details (query, aggregate, condition) #1087

Description

@Dhrumil-Sentry

Metric issue tool output omits alert rule details (query, aggregate, condition, evaluated value), leaving the agent without the context it needs to help root-cause an alert.

The Sentry UI surfaces this clearly (see example: dataset, aggregate count(), query process_shard OR OutboxFlushError, interval, threshold, evaluated value), but none of it is included in the MCP tool response for metric_issue type issues.

  • Issue type: metric_issue / category: metric
  • Missing fields: alert rule query, dataset, aggregate function, interval, threshold condition, evaluated value
  • Impact: agent responses are effectively useless for metric alerts — no query context means no ability to investigate signal vs. noise, trend, or root cause
  • The event output currently includes only generic tags (level, interface_type) and trace info, with no alert rule payload

Activity

  1. linear-code commented on Jun 12, 2026

    @linear-code
  2. added a commit that references this issue on Jun 26, 2026
    8d10c88
  3. Dhrumil-Sentry commented on Oct 29, 2026

    @Dhrumil-Sentry
    Author

    Reopened: #1129 only partly fixed this. Real metric issue output still shows only the evaluated value and threshold. Dataset, aggregate, query, interval and monitor ID are missing.

    Likely cause: formatMetricAlertDetails reads snake_case keys (data_sources, query_obj, snuba_query), but the event API returns camelCase (dataSources, queryObj, snubaQuery). The tests used snake_case fixtures, and detectorId isn't shown.

    Fix: read the camelCase keys, show detectorId so agents can call get_metric_monitor_details, and add a test using a real event.

    Also: in Response Notes, give the agent a ready-to-run call for the alert's dataset (search_logs, search_traces, search_errors or search_metrics). Pre-fill it with the alert's query, environment and the time of the breach, and drop the stacktrace and trace hints.

  4. added a commit that references this issue on Nov 2, 2026
    3a29f04
  5. added a commit that references this issue on Nov 3, 2026
    1325e71
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions