Filter out global deadman alerts


#1

Hi

I have a deadman alert where I group the alerts by a “serial” code.

var data = stream
    |from()
        .database('mydb')
        .retentionPolicy('autogen')
        .measurement('measurement')
        .groupBy(['serial'])
        .where(lambda: TRUE)

var trigger = data
    |deadman(0.0, 10m)
        .stateChangesOnly()
        .message('DEADMAN')
        .details('')
        .id('{{ index .Tags "sensorId" }}')
        .idTag('alertID')
        .levelTag('level')
        .post('https://some.url')

trigger
    |httpOut('output')

This works fine, however…I would like to not have it alert when I stop receiving measurements as a whole. Currently, if no measurements come through, it will send the alert but with “nil” values. I would like it to only send when the group itself doesn’t have any measurements coming through (usually when I just create the alert and it doesn’t have any memory yet). Is there a way to modify the query to filter out the “global” use case?