-
Notifications
You must be signed in to change notification settings - Fork 132
OneBusAway Watchdog
OneBusAway Watchdog is a simple framework for retrieving metrics about schedule and realtime data. When hosting OneBusAway, it is convenient to know information about the realtime data, and perhaps to even set alarms should the data fall outside what is expected.
The idea is simple, for each metric of concern a webservice is created that exposes that data in a readily queryable format. Take for example a common issue with realtime feeds, counting the number of tripIds that were received but not matched to the current transit data bundle. By making a GET request on the webservice below:
onebusaway-watchdog-webapp/api/metric/realtime/trip/{agencyId}/unmatched
Returns:
{
"currentTimestamp":1402402125238,
"metricName":"unmatched-trips",
"metricValue":1,
"response":"SUCCESS",
"errorMessage":null
}
Here, the agencyId is what is configured in the transit data bundle (e.g., 1). The metricValue property contains the response, indicating that for the last update from the realtime feed, we received one tripId that did not match to the bundle. The metricValue property should only be considered when the response property is populated with SUCCESS. Should the response not be a SUCCESS, the errorMessage property may be populated with a descriptive reason of the failure.
Below is a table of webservices that have been implemented. Adding another metric is trivial, it simply requires extending MetricResource.
URL | Result (metricValue) | Notes |
---|---|---|
http://developer.onebusaway.org/onebusaway-watchdog-webapp/api/metric/ping | 1 if the service is up and the bundle loaded properly | Sanity check on configuration |
Agency - Schedule | ||
http://developer.onebusaway.org/onebusaway-watchdog-webapp/api/metric/schedule/agency/total | Count of agencies loaded in current bundle | See agency-id-list for more details |
http://developer.onebusaway.org/onebusaway-watchdog-webapp/api/metric/schedule/agency/id-list | Array of agencyIds loaded from current bundle | Exposes currently configured agencies. |
Trip - Schedule | ||
http://developer.onebusaway.org/onebusaway-watchdog-webapp/api/metric/schedule/trip/1/total | Count of scheduled trips Per agency . | |
Agency - Realtime | ||
http://developer.onebusaway.org/onebusaway-watchdog-webapp/api/metric/realtime/agency/1/last-update-delta | Seconds elapsed since last successful update | An update may require non-zero update records to be considered successful |
Trip - Realtime | ||
http://developer.onebusaway.org/onebusaway-watchdog-webapp/api/metric/realtime/trip/1/total | Count of records included in the last realtime update | Updates may contain multiple vehicles, do not associate this with trip or vehicle counts |
http://developer.onebusaway.org/onebusaway-watchdog-webapp/api/metric/realtime/trip/1/matched | Count of realtime trips that were matched to scheduled trips (found in bundle) | Counterpart to unmatched-trips |
http://developer.onebusaway.org/onebusaway-watchdog-webapp/api/metric/realtime/trip/1/unmatched | Count of trip Ids not found in current bundle | See unmatched-trip-ids for offending trips |
http://developer.onebusaway.org/onebusaway-watchdog-webapp/api/metric/realtime/trip/1/unmatched-ids | Array of tripIds not found in bundle | Search for these tripIds in agency provided bundle and report to agency. |
http://developer.onebusaway.org/onebusaway-watchdog-webapp/api/metric/realtime/trip/1/schedule-realtime-delta | (Count of scheduled trips ) - (Count of realtime trips from last update) | See buses-in-service-percent for percentage version of this metric |
http://developer.onebusaway.org/onebusaway-watchdog-webapp/api/metric/realtime/trip/1/buses-in-service-percent | (count of realtime trips / count of scheduled trips) * 100 | Reports percentages of realtime buses matched to schedule |
Stop - Realtime | ||
http://developer.onebusaway.org/onebusaway-watchdog-webapp/api/metric/realtime/stop/1/unmatched | Count of stop Ids not found in current bundle | See unmatched-stop-ids for offending stopIds |
http://developer.onebusaway.org/onebusaway-watchdog-webapp/api/metric/realtime/stop/1/unmatched-ids | Array of stopIds not found in bundle | Search for these stopIds in agency provided bundle and report to agency |
http://developer.onebusaway.org/onebusaway-watchdog-webapp/api/metric/realtime/stop/1/matched | Count of stop Ids matched to the current bundle | |
Location - Realtime | ||
http://developer.onebusaway.org/onebusaway-watchdog-webapp/api/metric/realtime/location/1/total | Count of coordinates reported for Id | |
http://developer.onebusaway.org/onebusaway-watchdog-webapp/api/metric/realtime/location/1/invalid | Count of coordinates not inside agency bounding box | Bounding box is defined from bundle |
http://developer.onebusaway.org/onebusaway-watchdog-webapp/api/metric/realtime/location/1/invalid-lat-lons | Array of invalid lat/lons |