Method
createDeploymentAlert POST
Copy POST

Create a deployment alert for the given conditions.

Arguments:

REQUIRED KEY TYPE DESCRIPTION
Yes deploymentId str Unique string identifier for the deployment.
Yes alertName str Name of the alert.
Yes conditionConfig AlertConditionConfig Condition to run the actions for the alert.
KEY TYPE Description
alertType None None
Yes actionConfig AlertActionConfig Configuration for the action of the alert.
KEY TYPE Description
actionType None None
Note: The arguments for the API methods follow camelCase but for Python SDK underscore_case is followed.

Response:

KEY TYPE DESCRIPTION
success Boolean true if the call succeeded, false if there was an error
result MonitorAlert
KEY TYPE Description
name str The user-friendly name for the alert.
monitorAlertId str The unique identifier of the monitor alert.
createdAt str Date and time at which the monitor alert was created.
projectId str The project this alert belongs to.
modelMonitorId str The monitor id that this alert is associated with
realtimeMonitorId str The realtime monitor id that this alert is associated with
conditionConfig dict The condition configuration for this alert.
actionConfig dict The action configuration for this alert.
conditionDescription str User friendly description of the condition
actionDescription str User friendly description of the action
alertType str The type of the alert
deploymentId str The deployment ID this alert is associated with
latestMonitorAlertVersion MonitorAlertVersion The latest monitor alert version.

Exceptions:

TYPE WHEN
DataNotFoundError

deploymentId is not found.

Language:

python

Request
client.create_deployment_alert(deployment_id='<id>', alert_name='my_alert',
                         condition_config={"threshold": 0.3, "alert_type": "PredictionCount", "aggregation_type": "avg", "aggregation_window": "12h"},
                         action_config={"action_type": "Email", "email_recipients": ["<email_address>"]})

Response
MonitorAlert(
    name='my_alert',
    monitor_alert_id='de1679e08',
    created_at='2024-07-17T06:49:28+00:00',
    project_id='c9eb15741',
    condition_config={'threshold': 0.3, 'alert_type': 'PredictionCount', 'aggregation_type': 'avg', 'aggregation_window': '12h'},
    action_config={'action_type': 'Email', 'email_recipients': ['<email_address>']},
    condition_description='Deployment predition count has changed too much.',
    action_description="Email: ['<email_address>']",
    alert_type='PredictionCount',
    deployment_id='83404f41'
)