Skip to main content
Version: v0.67.0

Enable or disable monitor proxy

This page describes how you can enable or disable the transmission of monitoring data (for example, scoring data like model input and output and inference metrics like scoring latency) for a deployment at creation using the monitor_disable flag. This can be helpful if you don’t want H2O to store your deployment data. (Note: By default, the monitor_disable flag is set to False.)

Note that while the monitoring proxy is disabled, model monitoring is not available for any data sent to the deployment.

The following sections describe each of the possible scenarios for disabling or enabling monitor proxy when creating a new deployment or updating an existing deployment with the deployer API:

Create new deployment with monitor proxy disabled

The following example demonstrates how to create a new deployment where the monitoring proxy is disabled. This means that the deployment will not send or store any monitoring data like model input, output, or inference metrics.

In this example, the DeployDeployment method is used to define the properties of the deployment. Specifically, the monitor_disable flag is set to True. After defining the deployment's properties, the create_deployment method of the client.deployer.deployment is used to start the deployment process.

new_deployment = mlops.DeployDeployment(
project_id=project_id,
deployment_environment_id=env.id,
single_deployment=mlops.DeploySingleDeployment(
deployment_composition=composition,
),
monitor_disable=True,
)
client.deployer.deployment.create_deployment(
mlops.DeployCreateDeploymentRequest(deployment=new_deployment)
)

Create new deployment with monitor proxy enabled (default)

The following example demonstrates how to create a new deployment with the monitoring proxy enabled. By default, if the monitor_disable flag is not provided, the monitoring proxy remains active. This ensures that the deployment will automatically collect and store relevant monitoring data such as model input, output, and inference metrics.

In this example, the DeployDeployment method is used to define the properties of the deployment without setting the monitor_disable flag, indicating the use of the default behavior. After setting up the deployment details, the create_deployment method of the client.deployer.deployment is used to start the deployment process.

new_deployment = mlops.DeployDeployment(
project_id=project_id,
deployment_environment_id=env.id,
single_deployment=mlops.DeploySingleDeployment(
deployment_composition=composition,
),
)
client.deployer.deployment.create_deployment(
mlops.DeployCreateDeploymentRequest(deployment=new_deployment)
)

Update existing deployment with monitor proxy from enabled to disabled

The following example demonstrates how to modify an existing deployment to turn off its monitoring proxy. This can be useful if you initially had monitoring enabled but later decide that you no longer want to collect or store the associated monitoring data.

note

Any monitoring data that has already been collected prior to disabling the monitoring proxy is retained and is not automatically deleted.

In this example, we first call list_project_deployments to find the desired deployment you want to modify. Then setting the monitor_disable flag to True, disables the monitoring proxy for that deployment. The update_model_deployment method of the client.deployer.deployment is then used to update the specified deployment.

# Find target deployment to get updated, take the first one for example.
all_deployments = client.deployer.deployment.list_project_deployments(mlops.DeployListProjectDeploymentsRequest(project_id=project_id))
existing_deployment = all_deployments.deployments[0]

# Update the deployment with monitor_disable flag set to True to disable monitor proxy.
existing_deployment.monitor_disable = True

# Dispatch update request.
client.deployer.deployment.update_model_deployment(
mlops.DeployUpdateModelDeploymentRequest(deployment=existing_deployment)
)

Update existing deployment with monitor proxy from disabled to enabled

The following example demonstrates how to update an existing deployment to enable its monitoring proxy. This can be useful if monitoring was previously turned off, but there's now a need to gather and store monitoring data, such as model input, output, and inference metrics.

In this example, we first call list_project_deployments to find the desired deployment you want to modify. Then setting the monitor_disable flag to False, enables the monitoring proxy for that deployment. The update_model_deployment method of the client.deployer.deployment is used to update the specified deployment.

# Find target deployment to get updated, take the first one for example.
all_deployments = client.deployer.deployment.list_project_deployments(mlops.DeployListProjectDeploymentsRequest(project_id=project_id))
existing_deployment = all_deployments.deployments[0]

# Update the deployment with monitor_disable flag set to False to enable monitor proxy.
existing_deployment.monitor_disable = False

# Dispatch update request.
client.deployer.deployment.update_model_deployment(
mlops.DeployUpdateModelDeploymentRequest(deployment=existing_deployment)
)

Notes

Note: You must use the list methods API to get the most recent deployment you want to update against with. Otherwise, if your updated deployment is not the most recent one, your request will be rejected.


Feedback