github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/production/loki-mixin/dashboards/loki-retention.libsonnet (about) 1 local utils = import 'mixin-utils/utils.libsonnet'; 2 3 (import 'dashboard-utils.libsonnet') { 4 local compactor_pod_matcher = if $._config.ssd.enabled then 'container="loki", pod=~"%s-read.*"' % $._config.ssd.pod_prefix_matcher else 'container="compactor"', 5 local compactor_job_matcher = if $._config.ssd.enabled then '%s-read' % $._config.ssd.pod_prefix_matcher else 'compactor', 6 grafanaDashboards+:: 7 { 8 'loki-retention.json': 9 ($.dashboard('Loki / Retention', uid='retention')) 10 .addCluster() 11 .addNamespace() 12 .addTag() 13 .addLog() 14 .addRow( 15 $.row('Resource Usage') 16 .addPanel( 17 $.CPUUsagePanel('CPU', compactor_pod_matcher), 18 ) 19 .addPanel( 20 $.memoryWorkingSetPanel('Memory (workingset)', compactor_pod_matcher), 21 ) 22 .addPanel( 23 $.goHeapInUsePanel('Memory (go heap inuse)', compactor_job_matcher), 24 ) 25 26 ) 27 .addRow( 28 $.row('Compact and Mark') 29 .addPanel( 30 $.fromNowPanel('Last Compact and Mark Operation Success', 'loki_boltdb_shipper_compact_tables_operation_last_successful_run_timestamp_seconds') 31 ) 32 .addPanel( 33 $.panel('Compact and Mark Operations Duration') + 34 $.queryPanel(['loki_boltdb_shipper_compact_tables_operation_duration_seconds{%s}' % $.namespaceMatcher()], ['duration']) + 35 { yaxes: $.yaxes('s') }, 36 ) 37 .addPanel( 38 $.panel('Compact and Mark Operations Per Status') + 39 $.queryPanel(['sum by (status)(rate(loki_boltdb_shipper_compact_tables_operation_total{%s}[$__rate_interval]))' % $.namespaceMatcher()], ['{{success}}']), 40 ) 41 ) 42 .addRow( 43 $.row('Per Table Marker') 44 .addPanel( 45 $.panel('Processed Tables Per Action') + 46 $.queryPanel(['count by(action)(loki_boltdb_shipper_retention_marker_table_processed_total{%s})' % $.namespaceMatcher()], ['{{action}}']) + $.stack, 47 ) 48 .addPanel( 49 $.panel('Modified Tables') + 50 $.queryPanel(['count by(table,action)(loki_boltdb_shipper_retention_marker_table_processed_total{%s , action=~"modified|deleted"})' % $.namespaceMatcher()], ['{{table}}-{{action}}']) + $.stack, 51 ) 52 .addPanel( 53 $.panel('Marks Creation Rate Per Table') + 54 $.queryPanel(['sum by (table)(rate(loki_boltdb_shipper_retention_marker_count_total{%s}[$__rate_interval])) >0' % $.namespaceMatcher()], ['{{table}}']) + $.stack, 55 ) 56 ) 57 .addRow( 58 $.row('') 59 .addPanel( 60 $.panel('Marked Chunks (24h)') + 61 $.statPanel('sum (increase(loki_boltdb_shipper_retention_marker_count_total{%s}[24h]))' % $.namespaceMatcher(), 'short') 62 ) 63 .addPanel( 64 $.panel('Mark Table Latency') + 65 $.latencyPanel('loki_boltdb_shipper_retention_marker_table_processed_duration_seconds', '{%s}' % $.namespaceMatcher()) 66 ) 67 ) 68 .addRow( 69 $.row('Sweeper') 70 .addPanel( 71 $.panel('Delete Chunks (24h)') + 72 $.statPanel('sum (increase(loki_boltdb_shipper_retention_sweeper_chunk_deleted_duration_seconds_count{%s}[24h]))' % $.namespaceMatcher(), 'short') 73 ) 74 .addPanel( 75 $.panel('Delete Latency') + 76 $.latencyPanel('loki_boltdb_shipper_retention_sweeper_chunk_deleted_duration_seconds', '{%s}' % $.namespaceMatcher()) 77 ) 78 ) 79 .addRow( 80 $.row('') 81 .addPanel( 82 $.panel('Sweeper Lag') + 83 $.queryPanel(['time() - (loki_boltdb_shipper_retention_sweeper_marker_file_processing_current_time{%s} > 0)' % $.namespaceMatcher()], ['lag']) + { 84 yaxes: $.yaxes({ format: 's', min: null }), 85 }, 86 ) 87 .addPanel( 88 $.panel('Marks Files to Process') + 89 $.queryPanel(['sum(loki_boltdb_shipper_retention_sweeper_marker_files_current{%s})' % $.namespaceMatcher()], ['count']), 90 ) 91 .addPanel( 92 $.panel('Delete Rate Per Status') + 93 $.queryPanel(['sum by (status)(rate(loki_boltdb_shipper_retention_sweeper_chunk_deleted_duration_seconds_count{%s}[$__rate_interval]))' % $.namespaceMatcher()], ['{{status}}']), 94 ) 95 ) 96 .addRow( 97 $.row('Logs') 98 .addPanel( 99 $.logPanel('Compactor Logs', '{%s}' % $.jobMatcher(compactor_job_matcher)), 100 ) 101 ), 102 }, 103 }