Monitors API
Learn how to query, patch, and create monitors using our programmatic API
Monitors keep track of the various facets of your models. They track key metrics over time and let you analyze incidents that may be causing your model to degrade. The Arize platform provides workflows to troubleshoot incidents whenever a monitor is triggered.
However, it's also useful to export existing monitors programmatically and make configuration changes outside of the Arize platform. The Arize GraphQL API is designed to do just that - to allow you to build tooling that lets you manage monitors using your own custom workflows.
For a brief overview of GraphQL itself, please consult our introduction.
Querying for Monitors
Monitors belong to a Model
and thus also belong to a Space
. Because of this, you can either query for monitors off of a Model
node or a Space
node.
The model or space id is in the url when you visit the corresponding page. The format looks like this: spaces/:
space
_id/models/:
model_id
.
You can also query for a list of models given the space id. More details here.
The MonitorsConnection
off of Model
and Space
provide a convenient way for you to pull monitors that match the given criteria. If you have a large number of monitors, you will have to use pagination to pull the complete list. This data can then be structured to your liking and be exported to the platform of your choosing.
For a full working example, consult one of our example use case Colabs.
Updating / Patching Monitors
If you are managing a large number of monitors with Arize, you may want to periodically update certain parts of the configuration of a group of monitors. The Arize API provides patch
mutations (partial modification) for each type of monitor. Here are a few examples:
Each patch
mutation takes a monitor's node_id
an a set
input that contains the properties of the monitor. Each mutation returns the monitor that has been modified - there is no need to re-query for the data! View an example Colab below.
Notice that the mutations above make use of naming a query and using variables to make the mutations re-usable.
This is a very powerful abstraction and will help you construct maintainable queries and mutations. See GraphQL docs
Deleting Monitors
Deleting monitors using a mutation simply requires you to know the ID
of the monitor you want to delete.
Muting Monitors
You can mute a monitor by using the generic patchMonitor
or a specific mutation like patchDriftMonitor
, patchPerformanceMonitor
, or patchDataQualityMonitor
.
Creating Monitors
In most cases, the Arize platform will provide you with the best experience for creating monitors as the UI gives you a live preview of your monitor as you fill out its configuration. Additionally, Arize's managed monitors, auto-thresholding capabilities, and model baselines can often provide great monitoring coverage for your models. However, there may be cases where you would like to create a known set of custom monitors that track a specific cohort (filtered dataset) of features or a set of monitors that track a specific tag. Programmatically creating monitors can provide you the flexibility you need so you can ensure sufficient monitoring coverage. Let's suppose you have a lending model and you would like to exhaustively monitor the performance of the model for all 50 states. You may want to create a re-usable mutation that looks something like
Notice that we have used a variable to pass in a state to the createPerformanceMonitor
mutation. We now can loop over all 50 states, invoke this mutation and get 100% coverage for all 50 states. The end result will be 50 monitors that will alert you when the performance dips below the specified threshold.
Thresholding
Two different variants of thresholds are supported: fixed thresholds and dynamic auto thresholds. Fixed thresholds are a great fit when you explicitly know when you would like the monitor to fire. However, if you would like the monitor to automatically calculate a threshold for you, you can supply an auto-threshold configuration. Note that by default, auto thresholds are enabled with a standard deviation multiplier of 2.
This configuration will set your threshold to mean +/- (stdDevMultiplier * stdDev)
of a historical sample. The +/-
part of the threshold calculation is determined by the operator
.
Having trouble? Reach out to us via email support@arize.com or Slack us in the #arize-support channel for more support.
Monitor Filters
The filters
list lets you filter down the metric you are monitoring down to a cohort of inferences. It lets you filter down the data you are monitoring by features, tags, and actuals. Here are some examples:
Note that numeric filter values are passed in as strings but they must be parsable as numbers.
Drift Monitor Baselines
Drift is monitored by comparing your model's current distribution to a baseline distribution. For more information on baselines and how to choose a baseline, refer to our documentation here. There are a few ways to set a baseline using our API:
A model baseline refers to the baseline used for all monitors in a model. Your model is preset with a baseline defined by a moving time range of your model's production data for 17 days.
Querying for Monitor Audit Log
The monitor audit log details all changes made to a monitor, including who made the change, the timestamp of the change, and specifics of what was altered. Use this query to track modifications and maintain oversight of monitor configurations.
Querying for Integrations
Integrations belong to a Model
and thus also belong to a Space
. Because of this, you can either query for monitors off of a Model
node or a Space
node.
The model or space id is in the url when you visit the corresponding page. The format looks like this: spaces/:
space
_id/models/:
model_id
.
You can also query for a list of models given the space id. More details here.
Monitoring Alerts
Monitors surface potential issues with performance and data, sending real-time alerts so you can take immediate action. Learn how to programmatically update email alerts and integrate with other altering systems.
Setting Monitor Alerting Contacts
You can update either an email or paging service your monitor alerts by using the generic patchMonitor
or a specific mutation such as: patchDriftMonitor
, patchPerformanceMonitor
, or patchDataQualityMonitor
.
To view and set up external integrations see below.
variables
Alerting Integrations
Natively integrate with an alerting service to identify and resolve issues faster. Learn more about our alerting integrations here.
Querying Current Integrations
Integrations belong to an AccountOrganization
, thus belonging to an Account
. Because of this, you must query for integrations off of an AccountOrganization
node.
You can find the account organization in the url organizations/
:account_organization_id
/
Examples
Last updated