Skip to content

Commit

Permalink
Update deprecated angular graph panel in dashboards mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
salvacorts committed Apr 2, 2024
1 parent 71602eb commit bdf6e83
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 82 deletions.
8 changes: 4 additions & 4 deletions production/loki-mixin/dashboards/dashboard-utils.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
datasource: '$datasource',
},
CPUUsagePanel(title, matcher)::
$.panel(title) +
$.timeseriesPanel(title) +
$.queryPanel([
'sum by(pod) (rate(container_cpu_usage_seconds_total{%s, %s}[$__rate_interval]))' % [$.namespaceMatcher(), matcher],
'min(kube_pod_container_resource_requests{%s, %s, resource="cpu"} > 0)' % [$.namespaceMatcher(), matcher],
Expand All @@ -176,7 +176,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
self.CPUUsagePanel(title, 'container=~"%s"' % containerName),

memoryWorkingSetPanel(title, matcher)::
$.panel(title) +
$.timeseriesPanel(title) +
$.queryPanel([
// We use "max" instead of "sum" otherwise during a rolling update of a statefulset we will end up
// summing the memory of the old pod (whose metric will be stale for 5m) to the new pod.
Expand Down Expand Up @@ -204,7 +204,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
self.memoryWorkingSetPanel(title, 'container=~"%s"' % containerName),

goHeapInUsePanel(title, jobName)::
$.panel(title) +
$.timeseriesPanel(title) +
$.queryPanel(
'sum by(%s) (go_memstats_heap_inuse_bytes{%s})' % [$._config.per_instance_label, $.jobMatcher(jobName)],
'{{%s}}' % $._config.per_instance_label
Expand Down Expand Up @@ -247,7 +247,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
},

containerDiskSpaceUtilizationPanel(title, containerName)::
$.panel(title) +
$.timeseriesPanel(title) +
$.queryPanel('max by(persistentvolumeclaim) (kubelet_volume_stats_used_bytes{%s} / kubelet_volume_stats_capacity_bytes{%s}) and count by(persistentvolumeclaim) (kube_persistentvolumeclaim_labels{%s,%s})' % [$.namespaceMatcher(), $.namespaceMatcher(), $.namespaceMatcher(), $.containerLabelMatcher(containerName)], '{{persistentvolumeclaim}}') +
{ yaxes: $.yaxes('percentunit') },
}
24 changes: 12 additions & 12 deletions production/loki-mixin/dashboards/loki-chunks.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ local utils = import 'mixin-utils/utils.libsonnet';
.addRow(
$.row('Active Series / Chunks')
.addPanel(
$.panel('Series') +
$.timeseriesPanel('Series') +
$.queryPanel('sum(loki_ingester_memory_chunks{%s})' % dashboards['loki-chunks.json'].labelsSelector, 'series'),
)
.addPanel(
$.panel('Chunks per series') +
$.timeseriesPanel('Chunks per series') +
$.queryPanel(
'sum(loki_ingester_memory_chunks{%s}) / sum(loki_ingester_memory_streams{%s})' % [
dashboards['loki-chunks.json'].labelsSelector,
Expand All @@ -32,24 +32,24 @@ local utils = import 'mixin-utils/utils.libsonnet';
.addRow(
$.row('Flush Stats')
.addPanel(
$.panel('Utilization') +
$.timeseriesPanel('Utilization') +
$.latencyPanel('loki_ingester_chunk_utilization', '{%s}' % dashboards['loki-chunks.json'].labelsSelector, multiplier='1') +
{ yaxes: $.yaxes('percentunit') },
)
.addPanel(
$.panel('Age') +
$.timeseriesPanel('Age') +
$.latencyPanel('loki_ingester_chunk_age_seconds', '{%s}' % dashboards['loki-chunks.json'].labelsSelector),
),
)
.addRow(
$.row('Flush Stats')
.addPanel(
$.panel('Log Entries Per Chunk') +
$.timeseriesPanel('Log Entries Per Chunk') +
$.latencyPanel('loki_ingester_chunk_entries', '{%s}' % dashboards['loki-chunks.json'].labelsSelector, multiplier='1') +
{ yaxes: $.yaxes('short') },
)
.addPanel(
$.panel('Index Entries Per Chunk') +
$.timeseriesPanel('Index Entries Per Chunk') +
$.queryPanel(
'sum(rate(loki_chunk_store_index_entries_per_chunk_sum{%s}[5m])) / sum(rate(loki_chunk_store_index_entries_per_chunk_count{%s}[5m]))' % [
dashboards['loki-chunks.json'].labelsSelector,
Expand All @@ -62,22 +62,22 @@ local utils = import 'mixin-utils/utils.libsonnet';
.addRow(
$.row('Flush Stats')
.addPanel(
$.panel('Queue Length') +
$.timeseriesPanel('Queue Length') +
$.queryPanel('loki_ingester_flush_queue_length{%(label)s} or cortex_ingester_flush_queue_length{%(label)s}' % { label: dashboards['loki-chunks.json'].labelsSelector }, '{{pod}}'),
)
.addPanel(
$.panel('Flush Rate') +
$.timeseriesPanel('Flush Rate') +
$.qpsPanel('loki_ingester_chunk_age_seconds_count{%s}' % dashboards['loki-chunks.json'].labelsSelector,),
),
)
.addRow(
$.row('Flush Stats')
.addPanel(
$.panel('Chunks Flushed/Second') +
$.timeseriesPanel('Chunks Flushed/Second') +
$.queryPanel('sum(rate(loki_ingester_chunks_flushed_total{%s}[$__rate_interval]))' % dashboards['loki-chunks.json'].labelsSelector, '{{pod}}'),
)
.addPanel(
$.panel('Chunk Flush Reason') +
$.timeseriesPanel('Chunk Flush Reason') +
$.queryPanel('sum by (reason) (rate(loki_ingester_chunks_flushed_total{%s}[$__rate_interval])) / ignoring(reason) group_left sum(rate(loki_ingester_chunks_flushed_total{%s}[$__rate_interval]))' % [dashboards['loki-chunks.json'].labelsSelector, dashboards['loki-chunks.json'].labelsSelector], '{{reason}}') + {
stack: true,
yaxes: [
Expand Down Expand Up @@ -138,7 +138,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
.addRow(
$.row('Utilization')
.addPanel(
$.panel('Chunk Size Quantiles') +
$.timeseriesPanel('Chunk Size Quantiles') +
$.queryPanel(
[
'histogram_quantile(0.99, sum(rate(loki_ingester_chunk_size_bytes_bucket{%s}[1m])) by (le))' % dashboards['loki-chunks.json'].labelsSelector,
Expand All @@ -158,7 +158,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
.addRow(
$.row('Duration')
.addPanel(
$.panel('Chunk Duration hours (end-start)') +
$.timeseriesPanel('Chunk Duration hours (end-start)') +
$.queryPanel(
[
'histogram_quantile(0.5, sum(rate(loki_ingester_chunk_bounds_hours_bucket{%s}[5m])) by (le))' % dashboards['loki-chunks.json'].labelsSelector,
Expand Down
16 changes: 8 additions & 8 deletions production/loki-mixin/dashboards/loki-deletion.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -28,39 +28,39 @@ local utils = import 'mixin-utils/utils.libsonnet';
.addRow(
g.row('Churn')
.addPanel(
g.panel('# of Delete Requests (received - processed) ') +
g.timeseriesPanel('# of Delete Requests (received - processed) ') +
g.queryPanel('(loki_compactor_delete_requests_received_total{%s} or on() vector(0)) - on () (loki_compactor_delete_requests_processed_total{%s} or on () vector(0))' % [$.namespaceMatcher(), $.namespaceMatcher()], 'in progress'),
)
.addPanel(
g.panel('Delete Requests Received / Day') +
g.timeseriesPanel('Delete Requests Received / Day') +
g.queryPanel('sum(increase(loki_compactor_delete_requests_received_total{%s}[1d]))' % $.namespaceMatcher(), 'received'),
)
.addPanel(
g.panel('Delete Requests Processed / Day') +
g.timeseriesPanel('Delete Requests Processed / Day') +
g.queryPanel('sum(increase(loki_compactor_delete_requests_processed_total{%s}[1d]))' % $.namespaceMatcher(), 'processed'),
)
).addRow(
g.row('Compactor')
.addPanel(
g.panel('Compactor CPU usage') +
g.timeseriesPanel('Compactor CPU usage') +
g.queryPanel('node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate{%s, container="compactor"}' % $.namespaceMatcher(), '{{pod}}'),
)
.addPanel(
g.panel('Compactor memory usage (MiB)') +
g.timeseriesPanel('Compactor memory usage (MiB)') +
g.queryPanel('go_memstats_heap_inuse_bytes{%s, container="compactor"} / 1024 / 1024 ' % $.namespaceMatcher(), ' {{pod}} '),
)
.addPanel(
g.panel('Compaction run duration (seconds)') +
g.timeseriesPanel('Compaction run duration (seconds)') +
g.queryPanel('loki_boltdb_shipper_compact_tables_operation_duration_seconds{%s}' % $.namespaceMatcher(), '{{pod}}'),
)
).addRow(
g.row('Deletion metrics')
.addPanel(
g.panel('Failures in Loading Delete Requests / Hour') +
g.timeseriesPanel('Failures in Loading Delete Requests / Hour') +
g.queryPanel('sum(increase(loki_compactor_load_pending_requests_attempts_total{status="fail", %s}[1h]))' % $.namespaceMatcher(), 'failures'),
)
.addPanel(
g.panel('Lines Deleted / Sec') +
g.timeseriesPanel('Lines Deleted / Sec') +
g.queryPanel('sum(rate(loki_compactor_deleted_lines{' + $._config.per_cluster_label + '=~"$cluster",job=~"$namespace/%s"}[$__rate_interval])) by (user)' % compactor_matcher, '{{user}}'),
)
).addRow(
Expand Down
10 changes: 5 additions & 5 deletions production/loki-mixin/dashboards/loki-reads-resources.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
$.goHeapInUsePanel('Memory (go heap inuse)', 'querier'),
)
.addPanel(
$.panel('Disk Writes') +
$.timeseriesPanel('Disk Writes') +
$.queryPanel(
'sum by(%s, %s, device) (rate(node_disk_written_bytes_total[$__rate_interval])) + %s' % [$._config.per_node_label, $._config.per_instance_label, $.filterNodeDiskContainer('querier')],
'{{%s}} - {{device}}' % $._config.per_instance_label
Expand All @@ -76,7 +76,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
{ yaxes: $.yaxes('Bps') },
)
.addPanel(
$.panel('Disk Reads') +
$.timeseriesPanel('Disk Reads') +
$.queryPanel(
'sum by(%s, %s, device) (rate(node_disk_read_bytes_total[$__rate_interval])) + %s' % [$._config.per_node_label, $._config.per_instance_label, $.filterNodeDiskContainer('querier')],
'{{%s}} - {{device}}' % $._config.per_instance_label
Expand All @@ -100,7 +100,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
$.goHeapInUsePanel('Memory (go heap inuse)', index_gateway_job_matcher),
)
.addPanel(
$.panel('Disk Writes') +
$.timeseriesPanel('Disk Writes') +
$.queryPanel(
'sum by(%s, %s, device) (rate(node_disk_written_bytes_total[$__rate_interval])) + %s' % [$._config.per_node_label, $._config.per_instance_label, $.filterNodeDisk(index_gateway_pod_matcher)],
'{{%s}} - {{device}}' % $._config.per_instance_label
Expand All @@ -109,7 +109,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
{ yaxes: $.yaxes('Bps') },
)
.addPanel(
$.panel('Disk Reads') +
$.timeseriesPanel('Disk Reads') +
$.queryPanel(
'sum by(%s, %s, device) (rate(node_disk_read_bytes_total[$__rate_interval])) + %s' % [$._config.per_node_label, $._config.per_instance_label, $.filterNodeDisk(index_gateway_pod_matcher)],
'{{%s}} - {{device}}' % $._config.per_instance_label
Expand Down Expand Up @@ -137,7 +137,7 @@ local utils = import 'mixin-utils/utils.libsonnet';
!$._config.ssd.enabled,
grafana.row.new('Ruler')
.addPanel(
$.panel('Rules') +
$.timeseriesPanel('Rules') +
$.queryPanel(
'sum by(%(label)s) (loki_prometheus_rule_group_rules{%(matcher)s}) or sum by(%(label)s) (cortex_prometheus_rule_group_rules{%(matcher)s})' % { label: $._config.per_instance_label, matcher: $.jobMatcher('ruler') },
'{{%s}}' % $._config.per_instance_label
Expand Down
Loading

0 comments on commit bdf6e83

Please sign in to comment.