Skip to content

Metric Alerts do not trigger #3838

@mzglinski

Description

@mzglinski

Self-Hosted Version

25.7.0

CPU Architecture

x86_64

Docker Version

28.3.2

Docker Compose Version

2.38.2

Machine Specification

  • My system meets the minimum system requirements of Sentry

Steps to Reproduce

  1. Install fresh 25.7.0 release
  2. Set up a project, start sending events, for example, using this script
~ cat ./events.sh
#!/bin/bash

DSN_PUBLIC="<FIRST PART OF DSN, BEFORE @>"
SENTRY_HOST="http://<SENTRY HOST>"
PROJECT_ID="<NUMBER AT THE END OF DSN>"

curl -X POST --data '{ "exception": [{ "type": "Sentry curl test request", "value": "This is a test request to sentry sent by curl" }] }' \
        -H "Content-Type: application/json" \
        -H "X-Sentry-Auth: Sentry sentry_version=7, sentry_key=$DSN_PUBLIC, sentry_client=raven-bash/0.1" \
        $SENTRY_HOST/api/$PROJECT_ID/store/

# Timestamps 2 s apart
START=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
END=$(date -u -d "+2 seconds" +"%Y-%m-%dT%H:%M:%SZ")

# IDs
EVENT_ID=$(cat /proc/sys/kernel/random/uuid | tr -d '-')
TRACE_ID=$(cat /proc/sys/kernel/random/uuid | tr -d '-')
SPAN_ID=$(openssl rand -hex 8)

# Build JSON payload
PAYLOAD=$(printf '{
  "event_id":"%s",
  "type":"transaction",
  "transaction":"curl-test-transaction",
  "start_timestamp":"%s",
  "timestamp":"%s",
  "contexts":{
    "trace":{
      "trace_id":"%s",
      "span_id":"%s",
      "op":"http",
      "status":"ok"
    }
  },
  "spans":[],
  "platform":"other"
}' "$EVENT_ID" "$START" "$END" "$TRACE_ID" "$SPAN_ID")

# Calculate byte length **without** trailing newline
LENGTH=$(printf %s "$PAYLOAD" | wc -c)

# Assemble envelope
ENVELOPE=$(printf '%s\n%s\n%s' \
  "{\"dsn\":\"http://$DSN_PUBLIC@$SENTRY_HOST/$PROJECT_ID\",\"sent_at\":\"$START\"}" \
  "{\"type\":\"transaction\",\"length\":$LENGTH,\"content_type\":\"application/json\"}" \
  "$PAYLOAD")

# Ship to Sentry
curl -X POST "$SENTRY_HOST/api/$PROJECT_ID/envelope/" \
     -H "Content-Type: application/x-sentry-envelope" \
     -H "X-Sentry-Auth: Sentry sentry_version=7, sentry_client=curl/7.0, sentry_key=$DSN_PUBLIC" \
     --data-binary "$ENVELOPE"
~ watch -n.3 ./events.sh
  1. Configure sample alerts
  • Number of errors
Image

This will trigger as long as it is not edited when it is firing.

  • Transaction Duration
Image

This one will never fire, even when the condition is met.

Image Image

Expected Result

Metric alerts should trigger.

Actual Result

I do not see anything useful in the logs, but I can provide them if requested. Pasting logs from all containers does not seem helpful.

On my deployed instance, I experience similar issues with other types of metric alerts, none of them are firing.

Event ID

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Self-hosted: Next ReleaseUsed to track issues and pull requests (PRs) that should be fixed in the next release schedule.

    Projects

    Status

    No status

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions