/custom metrics example folder in the quick-start project.
Use custom metrics
Use the following library functions from the custom metrics Python SDK to build and deploy your own monitoring metrics.-
Instantiate the client. Enter your
DMM model ID: -
Log the custom metrics:
-
modelMonitoringId: ID of the monitored model to send metric alerts for -
metric: Name of the metric to send alert for -
value: Value of the metric -
timestamp: Timezone is in UTC in ISO 8601 format. -
tags: Custom metadata for metric represented as key-value string pairs
-
-
Send a custom metrics alert:
-
modelMonitoringId: ID of the monitored model for which to send metric alerts. -
metric: Name of the metric for which to send the alert. -
value: Value of the metric. -
condition: Target range for the metric defined by lower and upper limit bounds.
The following are potential values for theconditionargument:-
metrics_client.LESS_THAN = "lessThan" -
metrics_client.LESS_THAN_EQUAL = "lessThanEqual" -
metrics_client.GREATER_THAN = "greaterThan" -
metrics_client.GREATER_THAN_EQUAL = "greaterThanEqual" -
metrics_client.BETWEEN = "between"
-
-
lower_limit: The lower limit for thecondition. -
upper_limit: The upper limit for thecondition. -
description: Optional message included in the alert.
-
-
Retrieve the custom metrics:
-
modelMonitoringId: ID of the monitored model for which to retrieve the metric values. -
metric: Name of the metric for which to retrieve the metric values. -
start_timestamp: The start timestamp of the range when the metrics were logged. The timezone is in UTC in ISO 8601 format. -
end_timestamp: The end timestamp of the range when the metrics were logged. The timezone is in UTC in ISO 8601 format.
-
Sample output
-
timestamp: The time this metric was logged. -
value: The value of the metric. -
tags: Custom metadata for metric represented as key-value string pairs.