https://dagster.io/ logo
#ask-community
Title
# ask-community
j

Jose Estudillo

12/28/2022, 5:37 PM
Hi Team, I’m trying to get a solution to monitor sensors that fail (for example when they run the checks to decide which jobs to run). I haven’t found things like
hooks
or
run_failure_sensor
there are for jobs/ops. What is the best Approach for this?
I’m trying to do a grahql query, not having much luck either:
Copy code
query RunsQuery {
  sensorsOrError(repositorySelector: {
    repositoryName: "*", 
    repositoryLocationName: "*"}
  ) {
    __typename
    ... on Sensors {
      results {
        name
      }
    }
  }
}
d

daniel

12/28/2022, 5:47 PM
Hey Jose - the query that powers the tick history in Dagit for a particular sensor looks something like this (the naming is a bit odd - "instigation/instigator" includes both schedules and sensors and refers to things that can instigate runs)
Copy code
instigationStateOrError(instigationSelector: $instigationSelector) {
  __typename
  ... on InstigationState {
    id
    instigationType
    nextTick {
      timestamp
    }
    ticks(dayRange: $dayRange, limit: $limit, cursor: $cursor, statuses: $statuses) {
      id
      status
      timestamp
      cursor
      skipReason
      runIds
      error {
        message
      }
    }
  }
}
the instigation selector has these fields (name is the name of the sensor): https://github.com/dagster-io/dagster/blob/1c5733d4091d56d71ee1fd94f0ce66a42a13b1a[…]python_modules/dagster-graphql/dagster_graphql/schema/inputs.py
j

Jose Estudillo

12/28/2022, 5:49 PM
Thanks Daniel, so there is no better solution than just having a sensor running that query and checking for errors?
d

daniel

12/28/2022, 5:50 PM
That's what we currently expose, yeah - and because of the nature of what you're monitoring, you may want to use something other than a sensor to run the query?
Kind of a 'who watches the watchmen' situation
j

Jose Estudillo

12/28/2022, 5:51 PM
yeah I get you, was thinking the same, just didn’t want to introduce anything new if I could avoid it
but in this case you kind of have to
thanks again for your help!
condagster 1
@daniel I’m struggling to get anything to match
can I use wildcards in these expressions?
Copy code
instigationStateOrError(instigationSelector: {
  repositoryName: "default",
  repositoryLocationName: "default",
  name:""
})
to match anything,
*
doesn’t seem to work
d

daniel

12/28/2022, 6:15 PM
That query can only refer to a specific individual sensor
If supporting hooks for sensor/schedule failures in a more built-in way would be helpful then you could also file a feature request issue
3 Views