Skip to content

Commit

Permalink
Add cockroachdb dashboard (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
heydbut authored Apr 26, 2023
1 parent a6638fe commit 0e5b90e
Show file tree
Hide file tree
Showing 3 changed files with 253 additions and 0 deletions.
245 changes: 245 additions & 0 deletions collector-dashboards/otel-collector-cockroachdb-dashboard/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
terraform {
required_providers {
lightstep = {
source = "lightstep/lightstep"
version = "~> 1.70.10"
}
}
required_version = ">= v1.0.11"
}

resource "lightstep_dashboard" "otel_collector_cockroachdb_dashboard" {
project_name = var.lightstep_project
dashboard_name = "CockroachDB - Overview"
dashboard_description = "This dashboard provides a high-level overview of key CockroachDB metrics so you can ensure that your cluster is available, serving queries, and has sufficient resources to maintain high levels of performance."

chart {
name = "KV Pairs"
rank = "0"
type = "timeseries"

query {
query_name = "a"
display = "big_number"
hidden = false
query_string = "metric syscount | reduce mean | group_by [], mean"
}

}

chart {
name = "Memory Usage Per SQL Statement"
rank = "0"
type = "timeseries"

query {
query_name = "a"
display = "line"
hidden = false
query_string = "metric sql_stats_mem_max | delta | group_by [], sum | point percentile(value, 50.0), percentile(value, 95.0), percentile(value, 99.0), percentile(value, 99.9)"
}

}

chart {
name = "Capacity Used"
rank = "0"
type = "timeseries"

query {
query_name = "a"
display = "big_number"
hidden = false
query_string = "metric capacity_used | reduce mean | group_by [], mean"
}

}

chart {
name = "Total Capacity"
rank = "0"
type = "timeseries"

query {
query_name = "a"
display = "big_number"
hidden = false
query_string = "metric capacity | reduce mean | group_by [], mean"
}

}

chart {
name = "SQL UPDATE Count"
rank = "0"
type = "timeseries"

query {
query_name = "a"
display = "bar"
hidden = false
query_string = "metric sql_update_count | rate | group_by [], sum"
}

}

chart {
name = "SQL INSERT Count"
rank = "0"
type = "timeseries"

query {
query_name = "a"
display = "bar"
hidden = false
query_string = "metric sql_insert_count | rate | group_by [], sum"
}

}

chart {
name = "SQL DELETE Count"
rank = "0"
type = "timeseries"

query {
query_name = "a"
display = "bar"
hidden = false
query_string = "metric sql_delete_count | rate | group_by [], sum"
}

}

chart {
name = "SQL SELECT Count"
rank = "0"
type = "timeseries"

query {
query_name = "a"
display = "bar"
hidden = false
query_string = "metric sql_select_count | rate | group_by [], sum"
}

}

chart {
name = "Batch Request Latency"
rank = "0"
type = "timeseries"

query {
query_name = "a"
display = "line"
hidden = false
query_string = "metric exec_latency | delta | group_by [], sum | point percentile(value, 50.0), percentile(value, 95.0), percentile(value, 99.0), percentile(value, 99.9)"
}

}

chart {
name = "SQL Connections"
rank = "0"
type = "timeseries"

query {
query_name = "a"
display = "big_number"
hidden = false
query_string = "metric sql_conns | reduce mean | group_by [], mean"
}

}

chart {
name = "SQL Service Latency"
rank = "0"
type = "timeseries"

query {
query_name = "a"
display = "line"
hidden = false
query_string = "metric sql_service_latency | delta | group_by [], sum | point percentile(value, 50.0), percentile(value, 95.0), percentile(value, 99.0), percentile(value, 99.9)"
}

}

chart {
name = "Capacity Available (%)"
rank = "0"
type = "timeseries"

query {
query_name = "((a/b)*100)"
display = "big_number"
hidden = false
query_string = <<EOT
with
a = metric capacity_available | latest | group_by [], mean;
b = metric capacity | reduce mean | group_by [], mean;
join (((a / b)*100)), a=0, b=0
EOT
}

}

chart {
name = "Current User CPU (%)"
rank = "0"
type = "timeseries"

query {
query_name = "a"
display = "line"
hidden = false
query_string = "metric sys_cpu_user_percent | latest | group_by [], mean"
}

}

chart {
name = "System CPU (%)"
rank = "0"
type = "timeseries"

query {
query_name = "a"
display = "line"
hidden = false
query_string = "metric sys_cpu_sys_percent | latest | group_by [], mean"
}

}

chart {
name = "Live Nodes"
rank = "0"
type = "timeseries"

query {
query_name = "a"
display = "big_number"
hidden = false
query_string = "metric liveness_livenodes | reduce mean | group_by [], mean"
}

}

chart {
name = "Memory Usage Per SQL Session"
rank = "0"
type = "timeseries"

query {
query_name = "a"
display = "line"
hidden = false
query_string = "metric sql_mem_sql_session_max | delta | group_by [], sum | point percentile(value, 50.0), percentile(value, 95.0), percentile(value, 99.0), percentile(value, 99.9)"
}

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "dashboard_url" {
value = "https://app.lightstep.com/${var.lightstep_project}/dashboard/${lightstep_dashboard.otel_collector_cockroachdb_dashboard.id}"
description = "OpenTelemetry Collector CockroachDB Metrics Dashboard URL"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
variable "lightstep_project" {
description = "Name of Lightstep project"
type = string
}

0 comments on commit 0e5b90e

Please sign in to comment.