Use monitoring for an app¶
This topic describes how providers can monitor consumer app health for a Snowflake Native App.
Monitor consumer application health¶
Your application can report its health status to Snowflake, which allows you to monitor the health of consumer instances of your app.
To report health status, your app uses the system-defined
SYSTEM$REPORT_HEALTH_STATUS(VARCHAR) function, passing in the health status
as an enum value:
OK: The consumer instance is healthy.FAILED: The consumer instance is in an error state.PAUSED: The consumer manually paused the app.
You can use the LAST_HEALTH_STATUS and LAST_HEALTH_STATUS_UPDATED_ON fields
of the APPLICATION_STATE view
to monitor the health of consumer instances of your app. The LAST_HEALTH_STATUS
field has the most recent value passed in by the app running in the consumer account.
The following code sample demonstrates using the APPLICATION_STATE view to retrieve the health status of all consumer instances of your app:
SELECT
CONSUMER_ORGANIZATION_NAME,
CONSUMER_ACCOUNT_NAME,
LAST_HEALTH_STATUS,
LAST_HEALTH_STATUS_UPDATE_TIME
FROM
SNOWFLAKE.ACCOUNT_USAGE.APPLICATION_STATE
WHERE
PROVIDER_ORG_NAME = '<your_provider_org_name>'
AND APPLICATION_NAME = '<your_app_name>'
ORDER BY
LAST_HEALTH_STATUS_UPDATE_TIME DESC;
The preceding query may return results similar to the following:
CONSUMER_ORG_NAME CONSUMER_ACCOUNT_NAME LAST_HEALTH_STATUS LAST_HEALTH_STATUS_UPDATE_TIME
------------------ --------------------- ------------------ -------------------------------
consumer_org_1 consumer_account_1 OK 2024-01-15 10:30:00.000
consumer_org_2 consumer_account_2 FAILED 2024-01-15 09:45:00.000
consumer_org_3 consumer_account_3 PAUSED 2024-01-14 16:20:00.000