Skip to content

Commit

Permalink
Merge pull request #3 from observIQ/fix-load-metric-units
Browse files Browse the repository at this point in the history
Fix warehouse load metric unit descriptions
  • Loading branch information
Dasomeone authored Jan 11, 2023
2 parents 8993dd7 + 8aa49dc commit a8e2831
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 25 deletions.
40 changes: 20 additions & 20 deletions collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ type Collector struct {
logins *prometheus.Desc
successfulLogins *prometheus.Desc
failedLogins *prometheus.Desc
warehouseExecutedQueries *prometheus.Desc
warehouseOverloadedQueueSize *prometheus.Desc
warehouseProvisioningQueueSize *prometheus.Desc
warehouseBlockedQueries *prometheus.Desc
warehouseExecutedQueryLoad *prometheus.Desc
warehouseOverloadedQueueLoad *prometheus.Desc
warehouseProvisioningQueueLoad *prometheus.Desc
warehouseBlockedQueryLoad *prometheus.Desc
autoClusteringCredits *prometheus.Desc
autoClusteringBytes *prometheus.Desc
autoClusteringRows *prometheus.Desc
Expand Down Expand Up @@ -161,27 +161,27 @@ func NewCollector(logger log.Logger, c *Config) *Collector {
[]string{labelClientType, labelClientVersion},
nil,
),
warehouseExecutedQueries: prometheus.NewDesc(
warehouseExecutedQueryLoad: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "warehouse", "executed_queries"),
"Average number of queries executed.",
"Average query load for queries executed over the last 24 hours.",
[]string{labelName, labelID},
nil,
),
warehouseOverloadedQueueSize: prometheus.NewDesc(
warehouseOverloadedQueueLoad: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "warehouse", "overloaded_queue_size"),
"Average number of queries queued because the warehouse was overloaded.",
"Average load value for queries queued because the warehouse was being overloaded over the last 24 hours.",
[]string{labelName, labelID},
nil,
),
warehouseProvisioningQueueSize: prometheus.NewDesc(
warehouseProvisioningQueueLoad: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "warehouse", "provisioning_queue_size"),
"Average number of queries queued because the warehouse was being provisioned.",
"Average load value for queries queued because the warehouse was being provisioned over the last 24 hours.",
[]string{labelName, labelID},
nil,
),
warehouseBlockedQueries: prometheus.NewDesc(
warehouseBlockedQueryLoad: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "warehouse", "blocked_queries"),
"Average number of queries blocked by a transaction lock.",
"Average load value for queries blocked by a transaction lock over the last 24 hours.",
[]string{labelName, labelID},
nil,
),
Expand Down Expand Up @@ -264,10 +264,10 @@ func (c *Collector) Describe(descs chan<- *prometheus.Desc) {
descs <- c.logins
descs <- c.successfulLogins
descs <- c.failedLogins
descs <- c.warehouseExecutedQueries
descs <- c.warehouseOverloadedQueueSize
descs <- c.warehouseProvisioningQueueSize
descs <- c.warehouseBlockedQueries
descs <- c.warehouseExecutedQueryLoad
descs <- c.warehouseOverloadedQueueLoad
descs <- c.warehouseProvisioningQueueLoad
descs <- c.warehouseBlockedQueryLoad
descs <- c.autoClusteringCredits
descs <- c.autoClusteringBytes
descs <- c.autoClusteringRows
Expand Down Expand Up @@ -470,10 +470,10 @@ func (c *Collector) collectWarehouseLoadMetrics(db *sql.DB, metrics chan<- prome
return fmt.Errorf("failed to scan row: %w", err)
}

metrics <- prometheus.MustNewConstMetric(c.warehouseExecutedQueries, prometheus.GaugeValue, avgRunning, warehouseName, warehouseID)
metrics <- prometheus.MustNewConstMetric(c.warehouseOverloadedQueueSize, prometheus.GaugeValue, avgQueued, warehouseName, warehouseID)
metrics <- prometheus.MustNewConstMetric(c.warehouseProvisioningQueueSize, prometheus.GaugeValue, avgQueuedProvisioning, warehouseName, warehouseID)
metrics <- prometheus.MustNewConstMetric(c.warehouseBlockedQueries, prometheus.GaugeValue, avgBlocked, warehouseName, warehouseID)
metrics <- prometheus.MustNewConstMetric(c.warehouseExecutedQueryLoad, prometheus.GaugeValue, avgRunning, warehouseName, warehouseID)
metrics <- prometheus.MustNewConstMetric(c.warehouseOverloadedQueueLoad, prometheus.GaugeValue, avgQueued, warehouseName, warehouseID)
metrics <- prometheus.MustNewConstMetric(c.warehouseProvisioningQueueLoad, prometheus.GaugeValue, avgQueuedProvisioning, warehouseName, warehouseID)
metrics <- prometheus.MustNewConstMetric(c.warehouseBlockedQueryLoad, prometheus.GaugeValue, avgBlocked, warehouseName, warehouseID)
}

return rows.Err()
Expand Down
11 changes: 11 additions & 0 deletions mixin/.lint
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,14 @@ exclusions:
reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'"
template-instance-rule:
reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'"
panel-units-rule:
reason: "Custom units are used for better user experience in some panels"
entries:
- panel: "Login attempts"
- panel: "Autoclustering credits used"
- panel: "Top 5 service compute credits used"
- panel: "Top 5 service cloud service credits used"
- panel: "Top 5 warehouse compute credits used"
- panel: "Top 5 warehouse cloud services credits used"
- panel: "Top 5 database autoclustering credits used"
- panel: "Top 5 table autoclustering credits used"
10 changes: 5 additions & 5 deletions mixin/dashboards/snowflake-overview.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ local warehouseActivityPanel = {
prometheus.target(
'snowflake_warehouse_executed_queries{instance=~"$instance", job=~"$job", name=~"$warehouse"}',
datasource=promDatasource,
legendFormat='{{instance}} - {{name}} - Executed queries'
legendFormat='{{instance}} - {{name}} - Executed query load'
),
prometheus.target(
'snowflake_warehouse_overloaded_queue_size{instance=~"$instance", job=~"$job", name=~"$warehouse"}',
datasource=promDatasource,
legendFormat='{{instance}} - {{name}} - Overloaded queue size'
legendFormat='{{instance}} - {{name}} - Overloaded queue load'
),
prometheus.target(
'snowflake_warehouse_provisioning_queue_size{instance=~"$instance", job=~"$job", name=~"$warehouse"}',
datasource=promDatasource,
legendFormat='{{instance}} - {{name}} - Provisioning queue size'
legendFormat='{{instance}} - {{name}} - Provisioning queue load'
),
prometheus.target(
'snowflake_warehouse_blocked_queries{instance=~"$instance", job=~"$job", name=~"$warehouse"}',
datasource=promDatasource,
legendFormat='{{instance}} - {{name}} - Blocked queries'
legendFormat='{{instance}} - {{name}} - Blocked query load'
),
],
type: 'timeseries',
Expand Down Expand Up @@ -78,7 +78,7 @@ local warehouseActivityPanel = {
},
},
mappings: [],
unit: 'queries / hr',
unit: 'percentunit',
},
overrides: [],
},
Expand Down

0 comments on commit a8e2831

Please sign in to comment.