Categorygithub.com/chriskuchin/snowflake-exporter
modulepackage
0.0.0-20240305020851-be4bd19bc4ba
Repository: https://github.com/chriskuchin/snowflake-exporter.git
Documentation: pkg.go.dev

# README

Snowflake-Exporter

Prometheus exporter for snowflake.

Permissions

It is possible to create a read only role that has access to all necessary queries. Documentation on snowflake privileges can be found here.

PrivilegeObjectRequired Metrics
MONITOR EXECUTIONACCOUNT
MONITOR USAGEACCOUNT
MONITORDATABASE
USAGEDATABASE
MONITORSCHEMA
USAGESCHEMA
MONITORWAREHOUSE
USAGEWAREHOUSEUsage required for using warehouse to run queries with

Cost

I currently run this on X-SMALL warehouse and all queries finish in less 10s total. Because the minimum charge for a warehouse is 60s and we have a 60s auto suspend on the warehouse, We also run this at a 10m interval. This means every hour we pay for about 70s of execution time 6 times. or roughly ~.02 credits per execution. If query execution for metric collection continues to grow I plan on adding an Alter Warehouse permission to skip the auto_suspend and pin the cost to the initial 60s charge.

Metrics

Task Metrics

Task Metrics are collected by querying the Task History (Table Function).

Future Work:

[] Handle more than 100 results in collect window

Query Metrics

Query metrics are collected by query the Query History (Table Function).

Future Work:

[] Handle more than the 100 result default limit

Warehouse Metrics

Currently only warehouse billing metrics are collected by querying the Warehouse Metering History (Table Function)

Future Work:

[] Add warehouse load metrics using Warehouse Load History (Table Function)

Copy Statement Metrics

Collected using the Copy History (Table Function). Collection of these metrics requires tables to be manually specified at exporter start.

Future Work

[] Investigate using the LOAD HISTORY (View) to possibly remove table list requirements

# Functions

GatherCopyMetrics collects metrics about copy statements that have run the last interval.
GatherQueryMetrics collects metrics about queries that have run.
GatherTaskMetrics collects metrics about executed tasks.
GatherWarehouseUsageMetrics collects various warehouse metering metrics.