- Categories:
Table functions (Snowpark Container Services)
<service_ name>!SPCS_ GET_ METRICS¶
Returns the metrics that Snowflake collected for the specified service. For more information, see Access platform metrics.
- See also:
Syntax¶
Arguments¶
START_TIME => constant_exprStart time (in TIMESTAMP_LTZ format) for the time range from which to retrieve metrics. For available functions to construct data, time, and timestamp data, see Date & time functions.
If the
START_TIMEisn’t specified, it defaults to one day ago.END_TIME => constant_exprEnd time (in TIMESTAMP_LTZ format) for the time range from which to retrieve metrics.
If END_TIME isn’t specified, it defaults to the current timestamp.
Output¶
The function returns the following columns:
| Column | Data Type | Description |
|---|---|---|
TIMESTAMP | TIMESTAMP_NTZ | Universal Coordinated Time (UTC) timestamp when Snowflake collected the metric. |
METRIC_NAME | VARCHAR | Name of the metric. |
VALUE | VARCHAR | Value of the metric. |
UNIT | VARCHAR | Unit of the metric returned. |
INSTANCE_ID | NUMBER | Name of the service instance if the metric is related to the service instance. |
CONTAINER_NAME | VARCHAR | Name of the container if the metric is related to the container. For example, a volume metric won’t have container name. |
RESOURCE | VARCHAR | Hardware — for example, GPU — the metrics is about. This column isn’t populated. |
RECORD | OBJECT | Key-value pairs that provide metric information. |
RECORD_ATTRIBUTES | OBJECT | Key-value pairs that provide additional information about the metric. |
Access control requirements¶
A role used to execute this operation must have the following privileges at a minimum:
| Privilege | Object | Notes |
|---|---|---|
| MONITOR | Service |
Operating on an object in a schema requires at least one privilege on the parent database and at least one privilege on the parent schema.
For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.
For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.
Usage notes¶
- It can take a few minutes before metrics appear in the output.
Examples¶
Retrieve the metrics that Snowflake collected for the my_test_job job over the past day, the default.
Retrieve the metrics that Snowflake collected for the my_test_job job over the past three days.
Retrieve metrics from the past day for the spcs_get_metrics job instance 0 in the container named main.