Snowflake Metrics

Overview

This integration helps you to monitor key Snowflake metrics, and view them with an out-of-the-box dashboard.

Prerequisites

Before you begin, ensure you have:

  1. A Snowflake account
  2. An OpenTelemetry (OTEL) Collector with access to Snowflake
    • Install the OTEL Collector(v0.88.0 or newer) if not done already
    • Ensure you can provide config files and set environment variables for the collector

Setup

Step 1: Create the Collector Config File

Create a file named snowflake-metrics-collection-config.yaml with the following content:

snowflake-metrics-collection-config.yaml
receivers:
  snowflake:
    account: ${env:SNOWFLAKE_ACCOUNT}
    username: ${env:SNOWFLAKE_USERNAME}
    password: ${env:SNOWFLAKE_PASSWORD}
    warehouse: ${env:SNOWFLAKE_WAREHOUSE}
    collection_interval: 5m
    metrics:
      snowflake.database.bytes_scanned.avg:
        enabled: true
      snowflake.query.bytes_deleted.avg:
        enabled: true

processors:
  # enriches the data with additional host information
  # see https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/resourcedetectionprocessor#resource-detection-processor
  resourcedetection/system:
    # add additional detectors if needed
    detectors: ["system"]

exporters:
  # export to SigNoz cloud
  otlp/snowflake:
    endpoint: "${env:OTLP_DESTINATION_ENDPOINT}"
    tls:
      insecure: false
    headers:
      "signoz-ingestion-key": "${env:SIGNOZ_INGESTION_KEY}"

  # export to local collector
  # otlp/snowflake:
  #   endpoint: "localhost:4317"
  #   tls:
  #     insecure: true

service:
  pipelines:
    metrics/snowflake:
      receivers: [snowflake]
      processors: [resourcedetection/system]
      exporters: [otlp/snowflake]

All the available Snowflake receiver configurations can be found here.

Step 2: Set Environment Variables

Set the following environment variables:


# Snowflake account from where the metrics need to be collected
export SNOWFLAKE_ACCOUNT="<organization>-<account-name>"

# Snowflake username used while logging in into the Snowflake account
export SNOWFLAKE_USERNAME="<snowflake-username>"

# Password for the corresponding Snowflake user used while logging in into the Snowflake account
export SNOWFLAKE_PASSWORD="<snowflake-password>"

# Snowflake warehouse
export SNOWFLAKE_WAREHOUSE="<snowflake-warehouse>"

# region specific SigNoz cloud ingestion endpoint
export OTLP_DESTINATION_ENDPOINT="ingest.<region>.signoz.cloud:443"

# your SigNoz ingestion key
export SIGNOZ_INGESTION_KEY="<your-ingestion-key>"
  • Set the <region> to match your SigNoz Cloud region
  • Replace <your-ingestion-key> with your SigNoz ingestion key

Step 3: Use the Collector Config File

Add the following flag to your collector run command:

--config snowflake-metrics-collection-config.yaml

Snowflake Dashboard

You can import the Snowflake dashboard.

Go to Dashboards => New Dashboard => Import JSON

Download JSON from link.

Here are sample screenshots from the dashboard:

Snowflake Billing and Credit Usage Metrics
Snowflake Billing and Credit Usage Metrics
Snowflake Query Metrics
Snowflake Query Metrics
Snowflake Query Metrics (contd.)
Snowflake Query Metrics (contd.)
Snowflake Storage Metrics
Snowflake Storage Metrics
Other Snowflake Metrics
Other Snowflake Metrics
Complete list of Snowflake metrics
  • Name: The name of the metric.
  • Type: The type of the metric (e.g., Sum, Gauge).
  • Unit: The unit of measurement for the metric.
  • Description: A brief description of what the metric represents.
NameTypeUnitDescription
snowflake_database_bytes_scanned_avgGaugeBytesAverage bytes scanned in a database over the last 24 hour window
snowflake_database_query_countGaugenumberTotal query count for database over the last 24 hour window
snowflake_query_blockedGaugedoubleBlocked query count for warehouse over the last 24 hour window
snowflake_query_bytes_deleted_avgGaugeBytesAverage bytes deleted in database over the last 24 hour window
snowflake_query_bytes_written_avgGaugeBytesAverage bytes written by database over the last 24 hour window
snowflake_query_compilation_time_avgGaugesecondsAverage time taken to compile query over the last 24 hour window
snowflake_query_executedGaugedoubleExecuted query count for warehouse over the last 24 hour window
snowflake_query_execution_time_avgGaugesecondsAverage time spent executing queries in database over the last 24 hour window
snowflake_query_queued_overloadGaugedoubleOverloaded query count for warehouse over the last 24 hour window
snowflake_query_queued_provisionGaugedoubleNumber of compute resources queued for provisioning over the last 24 hour window
snowflake_queued_overload_time_avgGaugesecondsAverage time spent in warehouse queue due to warehouse being overloaded over the last 24 hour window
snowflake_queued_provisioning_time_avgGaugesecondsAverage time spent in warehouse queue waiting for resources to provision over the last 24 hour window
snowflake_queued_repair_time_avgGaugesecondsAverage time spent in warehouse queue waiting for compute resources to be repaired over the last 24 hour window
snowflake_storage_stage_bytes_totalGaugeBytesNumber of bytes of stage storage used by files in all internal stages (named, table, user)
snowflake_storage_storage_bytes_totalGaugeBytesNumber of bytes of table storage used, including bytes for data currently in Time Travel
snowflake_total_elapsed_time_avgGaugesecondsAverage elapsed time over the last 24 hour window
snowflake_billing_cloud_service_totalGuagecreditsReported total credits used in the cloud service over the last 24 hour window
snowflake_billing_total_credit_totalGaugecreditsReported total credits used across account over the last 24 hour window
snowflake_billing_virtual_warehouse_totalGaugecreditsReported total credits used by virtual warehouse service over the last 24 hour window
snowflake_billing_warehouse_cloud_service_totalGaugecreditsCredits used across cloud service for given warehouse over the last 24 hour window
snowflake_billing_warehouse_total_credit_totalGaugecreditsTotal credits used associated with given warehouse over the last 24 hour window
snowflake_billing_warehouse_virtual_warehouse_totalGaugecreditsTotal credits used by virtual warehouse service for given warehouse over the last 24 hour window
snowflake_logins_totalGuagenumberTotal login attempts for account over the last 24 hour window
snowflake_pipe_credits_used_totalGaugecreditsSnow pipe credits contotaled over the last 24 hour window
snowflake_query_bytes_spilled_local_avgGaugeBytesAverage bytes spilled (intermediate results do not fit in memory) by local storage over the last 24 hour window
snowflake_query_bytes_spilled_remote_avgGaugeBytesAverage bytes spilled (intermediate results do not fit in memory) by remote storage over the last 24 hour window
snowflake_query_data_scanned_cache_avgGaugedoubleAverage percentage of data scanned from cache over the last 24 hour window
snowflake_query_partitions_scanned_avgGaugedoubleNumber of partitions scanned during query so far over the last 24 hour window
snowflake_rows_deleted_avgGaugenumberNumber of rows deleted from a table (or tables) over the last 24 hour window
snowflake_rows_inserted_avgGaugenumberNumber of rows inserted into a table (or tables) over the last 24 hour window
snowflake_rows_produced_avgGaugenumberAverage number of rows produced by statement over the last 24 hour window
snowflake_rows_unloaded_avgGaugenumberAverage number of rows unloaded during data export over the last 24 hour window
snowflake_rows_updated_avgGaugenumberAverage number of rows updated in a table over the last 24 hour window
snowflake_session_id_countGaugenumberDistinct session id's associated with snowflake username over the last 24 hour window
snowflake_storage_failsafe_bytes_totalGaugeBytesNumber of bytes of data in Fail-safe

You can refer this page for more details about the Snowflake metrics.

Was this page helpful?