-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcosts-monitoring.yaml
More file actions
1310 lines (1310 loc) · 44.9 KB
/
costs-monitoring.yaml
File metadata and controls
1310 lines (1310 loc) · 44.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# Copyright (c) 2025 Dynatrace Open Source
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the Software), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# DASHBOARD: Costs Monitoring 0.9.2
# DESCRIPTION: Snowflake Cost Monitoring dashboard
# OWNER: sebastian.kruk
# PLUGINS: query_history, resource_monitors, warehouse_usage
# TAGS: costs
#
version: 19
variables:
- version: 2
key: Accounts
type: query
visible: true
editable: true
input: |-
fetch events
| filter db.system == "snowflake"
| filter isNotNull(deployment.environment)
| fields deployment.environment
| dedup deployment.environment
| sort deployment.environment asc
multiple: true
defaultValue:
- 3420b2ac-f1cf-4b24-b62d-61ba1ba8ed05*
- version: 2
key: Prefix
type: query
visible: true
editable: true
input: |-
fetch events
| filter db.system == "snowflake"
| filter isNotNull(snowflake.resource_monitor.name)
| filter in(deployment.environment, array($Accounts))
| parse `snowflake.resource_monitor.name`, """DATA:env "_" LDATA"""
| append [
fetch events
| filter db.system == "snowflake"
| filter isNotNull(snowflake.warehouse.name)
| filter in(deployment.environment, array($Accounts))
| parse `snowflake.warehouse.name`, """DATA:env "_" LDATA"""
]
| fields env
| dedup env
| sort env asc
multiple: true
defaultValue:
- 3420b2ac-f1cf-4b24-b62d-61ba1ba8ed05*
- version: 2
key: Resource_Monitors
type: query
visible: true
editable: true
input: |-
fetch events
| filter db.system == "snowflake"
| filter isNotNull(snowflake.resource_monitor.name)
| filter in(deployment.environment, array($Accounts))
| filter iAny(startsWith(snowflake.resource_monitor.name, concat(array($Prefix)[], "_")))
| fields snowflake.resource_monitor.name
| dedup snowflake.resource_monitor.name
| sort snowflake.resource_monitor.name asc
multiple: true
defaultValue:
- 3420b2ac-f1cf-4b24-b62d-61ba1ba8ed05*
- version: 2
key: Warehouses
type: query
visible: true
editable: true
input: |-
fetch events
| filter db.system == "snowflake"
| filter isNotNull(snowflake.warehouse.name)
| filter in(deployment.environment, array($Accounts))
| filter isNull(snowflake.resource_monitor.name) or in(snowflake.resource_monitor.name, array($Resource_Monitors))
| fields snowflake.warehouse.name
| dedup snowflake.warehouse.name
| sort snowflake.warehouse.name asc
multiple: true
defaultValue:
- 3420b2ac-f1cf-4b24-b62d-61ba1ba8ed05*
- version: 2
key: Slow_Query_Min
type: text
visible: true
editable: true
defaultValue: "60"
tiles:
"0":
title: Credits used
type: data
query: |-
timeseries snowflake.credits.quota.used = max(snowflake.credits.quota.used), by: {
snowflake.resource_monitor.name,
deployment.environment,
service.name
}
| filter in(deployment.environment, array($Accounts))
and iAny(startsWith(snowflake.resource_monitor.name, concat(array($Prefix)[], "_")))
and in(snowflake.resource_monitor.name, array($Resource_Monitors))
// and in(snowflake.warehouse.name, array($Warehouses))
| fieldsAdd snow_account = coalesce(deployment.environment, service.name)
| fieldsRemove deployment.environment, service.name
| summarize {
snowflake.credits.quota.used = max(snowflake.credits.quota.used[])
}, by: {
timeframe,
interval,
snowflake.resource_monitor.name,
snow_account
}
visualization: lineChart
visualizationSettings:
chartSettings:
truncationMode: middle
leftYAxisSettings:
label: Credits Used
isLabelVisible: true
xAxisLabel: timeframe
xAxisScaling: analyzedTimeframe
fieldMapping:
leftAxisValues:
- snowflake.credits.quota.used
timestamp: timeframe
gapPolicy: connect
legend:
position: bottom
legend:
ratio: 18
thresholds: []
dataMapping:
displayedFields:
- snowflake.resource_monitor.name
- snow_account
querySettings:
maxResultRecords: 1000
defaultScanLimitGbytes: 500
maxResultMegaBytes: 100
defaultSamplingRatio: 10
enableSampling: false
davis:
enabled: false
davisVisualization:
isAvailable: true
componentState:
inputData: null
"1":
type: markdown
content: "# Resource Monitors"
davis:
componentState:
inputData: null
"2":
title: Credits quota
type: data
query: |-
timeseries snowflake.credits.quota = max(snowflake.credits.quota), by: {
snowflake.resource_monitor.name,
deployment.environment,
service.name
}
| filter in(deployment.environment, array($Accounts))
and iAny(startsWith(snowflake.resource_monitor.name, concat(array($Prefix)[], "_")))
and in(snowflake.resource_monitor.name, array($Resource_Monitors))
// and in(snowflake.warehouse.name, array($Warehouses))
| fieldsAdd snow_account = coalesce(deployment.environment, service.name)
| fieldsRemove deployment.environment, service.name
| summarize {
snowflake.credits.quota = max(snowflake.credits.quota[])
}, by: {
timeframe,
interval,
snowflake.resource_monitor.name,
snow_account
}
visualization: davis
visualizationSettings:
autoSelectVisualization: false
thresholds: []
chartSettings:
gapPolicy: connect
circleChartSettings:
groupingThresholdType: relative
groupingThresholdValue: 0
valueType: relative
categoryOverrides: {}
categoricalBarChartSettings:
categoryAxis: snowflake.resource_monitor.name
categoryAxisLabel: snowflake.resource_monitor.name
valueAxis: interval
valueAxisLabel: interval
hiddenLegendFields:
- snowflake.resource_monitor
fieldMapping:
timestamp: timeframe
leftAxisValues:
- snowflake.credits.quota
singleValue:
labelMode: custom
label: ""
prefixIcon: ""
recordField: snowflake.resource_monitor.name
autoscale: true
alignment: center
colorThresholdTarget: value
table:
rowDensity: condensed
enableSparklines: false
hiddenColumns: []
lineWrapIds: []
columnWidths: {}
columnTypeOverrides:
- fields:
- snowflake.credits.quota
value: sparkline
id: 1755691686510
honeycomb:
shape: hexagon
legend: auto
dataMappings:
value: interval
displayedFields:
- snowflake.resource_monitor.name
colorMode: color-palette
colorPalette: blue
histogram:
dataMappings:
- valueAxis: interval
rangeAxis: ""
valueBoundaries:
min:
mode: auto
max:
mode: auto
querySettings:
maxResultRecords: 1000
defaultScanLimitGbytes: 500
maxResultMegaBytes: 100
defaultSamplingRatio: 10
enableSampling: false
davis:
enabled: true
componentState:
selectedAnalyzerName: dt.statistics.ui.anomaly_detection.AutoAdaptiveAnomalyDetectionAnalyzer
inputData:
dt.statistics.ui.anomaly_detection.AutoAdaptiveAnomalyDetectionAnalyzer:
generalParameters:
timeframe:
startTime: "2025-09-19T07:19:49.111Z"
endTime: "2025-10-03T07:19:49.111Z"
resolveDimensionalQueryData: true
logVerbosity: INFO
numberOfSignalFluctuations: 1
alertCondition: OUTSIDE
alertOnMissingData: false
violatingSamples: 1
slidingWindow: 10
dealertingSamples: 3
davisVisualization:
isAvailable: true
settings:
visibleSections: VISUALIZATION
"3":
title: Credits quota used
type: data
query: |-
timeseries snowflake.credits.quota.used_pct = max(snowflake.credits.quota.used_pct), by: {
snowflake.resource_monitor.name,
deployment.environment,
service.name
}
| filter in(deployment.environment, array($Accounts))
and iAny(startsWith(snowflake.resource_monitor.name, concat(array($Prefix)[], "_")))
and in(snowflake.resource_monitor.name, array($Resource_Monitors))
// and in(snowflake.warehouse.name, array($Warehouses))
| fieldsAdd snow_account = coalesce(deployment.environment, service.name)
| fieldsRemove deployment.environment, service.name
| summarize {
snowflake.credits.quota.used_pct = max(snowflake.credits.quota.used_pct[])
}, by: {
timeframe,
interval,
snowflake.resource_monitor.name,
snow_account
}
visualization: lineChart
visualizationSettings:
chartSettings:
truncationMode: middle
leftYAxisSettings:
label: Percentage Quota Used
isLabelVisible: true
xAxisLabel: timeframe
xAxisScaling: analyzedTimeframe
fieldMapping:
leftAxisValues:
- snowflake.credits.quota.used_pct
timestamp: timeframe
gapPolicy: connect
legend:
position: bottom
legend:
ratio: 18
thresholds:
- id: 1
field: ""
title: Percentage used
isEnabled: true
rules:
- id: 0
color:
Default: "var(--dt-colors-charts-categorical-color-09-default, #649438)"
comparator: <
label: ""
value: 50
- id: 1
color:
Default: "var(--dt-colors-charts-categorical-color-14-default, #d56b1a)"
comparator: <
label: ""
value: 99
- id: 2
color:
Default: "var(--dt-colors-charts-categorical-color-12-default, #cd3741)"
comparator: ≥
label: ""
value: 100
dataMapping:
displayedFields:
- snowflake.resource_monitor.name
- snow_account
querySettings:
maxResultRecords: 1000
defaultScanLimitGbytes: 500
maxResultMegaBytes: 100
defaultSamplingRatio: 10
enableSampling: false
davis:
enabled: false
davisVisualization:
isAvailable: true
componentState:
inputData: null
"4":
type: markdown
content: "# Warehouses"
davis:
componentState:
inputData: null
"5":
title: Warehouses without resource monitors
type: data
query: |2
fetch logs
| filter db.system == "snowflake"
| filter dsoa.run.context == "resource_monitors"
| filter in(deployment.environment, array($Accounts))
| sort timestamp asc
| summarize {
timestamp = takeLast(timestamp),
loglevel = takeLast(loglevel)
}, by: {
deployment.environment, snowflake.warehouse.name
}
| filterOut loglevel == "INFO"
| sort loglevel asc, timestamp desc
| fields
`Last seen`=timestamp,
`Account`=deployment.environment,
`Warehouse`=coalesce(snowflake.warehouse.name, "-"),
`Level`=loglevel,
`Explanation`=if(loglevel == "WARN",
concat("Warehouse ", snowflake.warehouse.name, " does not have Resource Monitor assigned"),
else: concat("Account ", deployment.environment, " does not have global resource monitor defined"))
visualization: table
visualizationSettings:
table:
columnWidths:
'["snow_account"]': 303.71875
'["Explanation"]': 1161
thresholds:
- id: 1
field: Level
title: ""
isEnabled: true
rules:
- id: 0
color:
Default: "var(--dt-colors-charts-categorical-color-09-default, #649438)"
comparator: =
label: ""
value: INFO
- id: 1
color:
Default: "var(--dt-colors-charts-categorical-color-14-default, #d56b1a)"
comparator: =
label: ""
value: WARN
- id: 2
color:
Default: "var(--dt-colors-charts-categorical-color-12-default, #cd3741)"
comparator: =
label: ""
value: ERROR
querySettings:
maxResultRecords: 1000
defaultScanLimitGbytes: 500
maxResultMegaBytes: 100
defaultSamplingRatio: 10
enableSampling: false
davis:
enabled: false
davisVisualization:
isAvailable: true
componentState:
inputData: null
"6":
title: Query execution time per warehouse
type: data
query: |
timeseries snowflake.time.execution = sum(snowflake.time.execution), by: {
snowflake.warehouse.name,
deployment.environment,
service.name
}
| filter in(deployment.environment, array($Accounts))
and iAny(startsWith(snowflake.warehouse.name, concat(array($Prefix)[], "_")))
// and in(snowflake.resource_monitor.name, array($Resource_Monitors))
and in(snowflake.warehouse.name, array($Warehouses))
| fieldsAdd snow_account = coalesce(deployment.environment, service.name)
| fieldsRemove service.name, deployment.environment
| summarize {
snowflake.time.execution = sum(snowflake.time.execution[])
}, by: {
timeframe,
interval,
// snowflake.warehouse.name,
snow_account
}
visualization: barChart
visualizationSettings:
chartSettings:
truncationMode: middle
leftYAxisSettings:
label: Execution Time
isLabelVisible: true
xAxisLabel: timeframe
xAxisScaling: analyzedTimeframe
fieldMapping:
leftAxisValues:
- snowflake.time.execution
timestamp: timeframe
legend:
ratio: 13
thresholds: []
dataMapping:
displayedFields:
- snow_account
querySettings:
maxResultRecords: 1000
defaultScanLimitGbytes: 500
maxResultMegaBytes: 100
defaultSamplingRatio: 10
enableSampling: false
davis:
enabled: false
davisVisualization:
isAvailable: true
componentState:
inputData: null
"7":
title: Queued overload time per warehouse
type: data
query: |-
timeseries snowflake.time.queued.overload = sum(snowflake.time.queued.overload), by: {
snowflake.warehouse.name,
deployment.environment,
service.name
}
| fieldsAdd key = concat(deployment.environment, "|", snowflake.warehouse.name)
| joinNested rs = [
fetch events
| filter db.system == "snowflake"
| filter isNotNull(snowflake.warehouse.event)
| filter isNotNull(snowflake.resource_monitor.name) and isNotNull(snowflake.warehouse.name)
| summarize {count()}, by: {
snowflake.resource_monitor.name,
snowflake.warehouse.name,
deployment.environment}
| fieldsAdd key = concat(deployment.environment, "|", snowflake.warehouse.name)
], on: {left[key] == right[key]}
, fields: {snowflake.resource_monitor.name}
| expand rs = rs
| fieldsAdd snowflake.resource_monitor.name = rs[snowflake.resource_monitor.name]
| fieldsRemove rs
| filter in(deployment.environment, array($Accounts))
and iAny(startsWith(snowflake.warehouse.name, concat(array($Prefix)[], "_")))
and (isNull(snowflake.resource_monitor.name) or in(snowflake.resource_monitor.name, array($Resource_Monitors)))
and in(snowflake.warehouse.name, array($Warehouses))
| fieldsRemove snowflake.resource_monitor.name
| fieldsAdd snow_account = coalesce(deployment.environment, service.name)
| fieldsRemove deployment.environment, service.name
| summarize {
snowflake.time.queued.overload = sum(snowflake.time.queued.overload[])
}, by: {
timeframe,
interval,
snowflake.warehouse.name,
snow_account
}
visualization: barChart
visualizationSettings:
dataMapping:
displayedFields:
- snowflake.warehouse.name
- snow_account
chartSettings:
leftYAxisSettings:
label: Queued Overload Time
isLabelVisible: true
xAxisLabel: timeframe
xAxisScaling: analyzedTimeframe
tooltip:
seriesDisplayMode: multi-line
fieldMapping:
leftAxisValues:
- snowflake.time.queued.overload
timestamp: timeframe
legend:
ratio: 20
thresholds: []
querySettings:
maxResultRecords: 1000
defaultScanLimitGbytes: 500
maxResultMegaBytes: 100
defaultSamplingRatio: 10
enableSampling: false
davis:
enabled: false
davisVisualization:
isAvailable: true
componentState:
inputData: null
"8":
title: Queued provisioning time per warehouse
type: data
query: |-
timeseries snowflake.time.queued.provisioning = sum(snowflake.time.queued.provisioning), by: {
snowflake.warehouse.name,
deployment.environment,
service.name
}
| fieldsAdd key = concat(deployment.environment, "|", snowflake.warehouse.name)
| joinNested rs = [
fetch events
| filter db.system == "snowflake"
| filter isNotNull(snowflake.warehouse.event)
| filter isNotNull(snowflake.resource_monitor.name) and isNotNull(snowflake.warehouse.name)
| summarize {count()}, by: {
snowflake.resource_monitor.name,
snowflake.warehouse.name,
deployment.environment}
| fieldsAdd key = concat(deployment.environment, "|", snowflake.warehouse.name)
], on: {left[key] == right[key]}
, fields: {snowflake.resource_monitor.name}
| expand rs = rs
| fieldsAdd snowflake.resource_monitor.name = rs[snowflake.resource_monitor.name]
| fieldsRemove rs
| filter in(deployment.environment, array($Accounts))
and iAny(startsWith(snowflake.warehouse.name, concat(array($Prefix)[], "_")))
and (isNull(snowflake.resource_monitor.name) or in(snowflake.resource_monitor.name, array($Resource_Monitors)))
and in(snowflake.warehouse.name, array($Warehouses))
| fieldsRemove snowflake.resource_monitor.name
| fieldsAdd snow_account = coalesce(deployment.environment, service.name)
| fieldsRemove deployment.environment, service.name
| summarize {
ssnowflake.time.queued.provisioning = sum(snowflake.time.queued.provisioning[])
}, by: {
timeframe,
interval,
snowflake.warehouse.name,
snow_account
}
visualization: barChart
visualizationSettings:
dataMapping:
displayedFields:
- snowflake.warehouse.name
- snow_account
chartSettings:
truncationMode: middle
xAxisLabel: timeframe
xAxisScaling: analyzedTimeframe
fieldMapping:
leftAxisValues:
- ssnowflake.time.queued.provisioning
timestamp: timeframe
legend:
ratio: 21
thresholds: []
querySettings:
maxResultRecords: 1000
defaultScanLimitGbytes: 500
maxResultMegaBytes: 100
defaultSamplingRatio: 10
enableSampling: false
davis:
enabled: false
davisVisualization:
isAvailable: true
componentState:
inputData: null
"9":
title: Credits quota usage preditiction
type: data
query: |-
timeseries snowflake.credits.quota.used_pct = max(snowflake.credits.quota.used_pct), by: {
snowflake.resource_monitor.name,
deployment.environment,
service.name
}, interval: 24h
, from: -15d
, to: -1d
| filter in(deployment.environment, array($Accounts))
and iAny(startsWith(snowflake.resource_monitor.name, concat(array($Prefix)[], "_")))
and in(snowflake.resource_monitor.name, array($Resource_Monitors))
// and in(snowflake.warehouse.name, array($Warehouses))
| fieldsAdd snow_account = coalesce(deployment.environment, service.name)
| fieldsRemove deployment.environment, service.name
| sort snowflake.credits.quota.used_pct desc
// | limit 10
visualization: davis
visualizationSettings:
autoSelectVisualization: false
thresholds:
- id: 1
field: ""
title: Percentage used
isEnabled: true
rules:
- id: 0
color:
Default: "var(--dt-colors-charts-categorical-color-09-default, #649438)"
comparator: <
label: ""
value: 50
- id: 1
color:
Default: "var(--dt-colors-charts-categorical-color-14-default, #d56b1a)"
comparator: <
label: ""
value: 99
- id: 2
color:
Default: "var(--dt-colors-charts-categorical-color-12-default, #cd3741)"
comparator: ≥
label: ""
value: 100
chartSettings:
xAxisScaling: analyzedTimeframe
gapPolicy: connect
circleChartSettings:
groupingThresholdType: relative
groupingThresholdValue: 0
valueType: relative
categoryOverrides: {}
categoricalBarChartSettings:
categoryAxis:
- snowflake.resource_monitor.name
- snow_account
categoryAxisLabel: snowflake.resource_monitor.name,snow_account
valueAxis:
- interval
valueAxisLabel: interval
tooltipVariant: single
hiddenLegendFields:
- snowflake.resource_monitor
- interval
fieldMapping:
timestamp: timeframe
leftAxisValues:
- snowflake.credits.quota.used_pct
truncationMode: middle
valueRepresentation: absolute
xAxisLabel: timeframe
xAxisIsLabelVisible: false
leftYAxisSettings:
isLabelVisible: true
label: Percentage Quota Used
singleValue:
trend:
trendType: auto
isVisible: true
labelMode: custom
label: ""
prefixIcon: ""
recordField: snowflake.resource_monitor.name
autoscale: true
alignment: center
colorThresholdTarget: value
table:
rowDensity: condensed
enableSparklines: false
hiddenColumns: []
lineWrapIds: []
columnWidths: {}
columnTypeOverrides:
- fields:
- snowflake.credits.quota.used_pct
value: sparkline
id: 1756104321690
honeycomb:
shape: hexagon
legend: auto
dataMappings:
value: interval
displayedFields:
- snowflake.resource_monitor.name
- snow_account
colorMode: color-palette
colorPalette: blue
histogram:
dataMappings:
- valueAxis: interval
rangeAxis: ""
variant: single
displayedFields:
- snowflake.resource_monitor.name
valueBoundaries:
min:
mode: auto
max:
mode: auto
legend:
showLegend: false
position: auto
ratio: 18
querySettings:
maxResultRecords: 1000
defaultScanLimitGbytes: 500
maxResultMegaBytes: 100
defaultSamplingRatio: 10
enableSampling: false
davis:
enabled: true
componentState:
selectedAnalyzerName: dt.statistics.ui.ForecastAnalyzer
inputData:
dt.statistics.ui.ForecastAnalyzer:
generalParameters:
timeframe:
startTime: now()-14d
endTime: now()
resolveDimensionalQueryData: true
logVerbosity: INFO
forecastHorizon: 7
forecastOffset: 0
davisVisualization:
isAvailable: true
settings:
visibleSections: VISUALIZATION
"10":
type: markdown
content: "# Slow queries"
davis:
componentState:
inputData: null
"11":
title: Count of queries slower then $Slow_Query_Min min by user over time
type: data
query: |
fetch logs
| filter db.system == "snowflake"
| filter dsoa.run.context == "query_history"
| filter isNotNull(snowflake.query.id)
| fieldsAdd snowflake.time.running.in_min = toLong(snowflake.time.total_elapsed)/1000/60
| filter toLong(snowflake.time.running.in_min) > toDouble($Slow_Query_Min)
| fieldsAdd key = concat(deployment.environment, "|", snowflake.warehouse.name)
| joinNested rs = [
fetch events
| filter db.system == "snowflake"
| filter isNotNull(snowflake.warehouse.event)
| filter isNotNull(snowflake.resource_monitor.name) and isNotNull(snowflake.warehouse.name)
| summarize {count()}, by: {
snowflake.resource_monitor.name,
snowflake.warehouse.name,
deployment.environment}
| fieldsAdd key = concat(deployment.environment, "|", snowflake.warehouse.name)
], on: {left[key] == right[key]}
, fields: {snowflake.resource_monitor.name}
| expand rs = rs
| fieldsAdd snowflake.resource_monitor.name = rs[snowflake.resource_monitor.name]
| fieldsRemove rs
| filter in(deployment.environment, array($Accounts))
and iAny(startsWith(snowflake.warehouse.name, concat(array($Prefix)[], "_")))
and in(snowflake.resource_monitor.name, array($Resource_Monitors))
and in(snowflake.warehouse.name, array($Warehouses))
| fieldsRemove snowflake.resource_monitor.name
| makeTimeseries count(), by: { db.user }
//, interval: 1h
visualization: barChart
visualizationSettings:
chartSettings:
legend:
position: bottom
tooltip:
seriesDisplayMode: multi-line
legend:
ratio: 19
autoSelectVisualization: false
querySettings:
maxResultRecords: 1000
defaultScanLimitGbytes: 500
maxResultMegaBytes: 1
defaultSamplingRatio: 10
enableSampling: false
davis:
enabled: false
davisVisualization:
isAvailable: true
componentState:
inputData: null
"12":
title: Top 100 slowest queries running longer than $Slow_Query_Min minutes
type: data
query: |
fetch logs, scanLimitGBytes:-1
| filter db.system == "snowflake"
| filter dsoa.run.context == "query_history"
| filter isNotNull(snowflake.query.id)
| fieldsAdd snowflake.time.running.in_min = toLong(snowflake.time.total_elapsed)/1000/60
| filter toLong(snowflake.time.running.in_min) > toDouble($Slow_Query_Min)
| fieldsAdd key = concat(deployment.environment, "|", snowflake.warehouse.name)
| joinNested rs = [
fetch events
| filter db.system == "snowflake"
| filter isNotNull(snowflake.warehouse.event)
| filter isNotNull(snowflake.resource_monitor.name) and isNotNull(snowflake.warehouse.name)
| summarize {count()}, by: {
snowflake.resource_monitor.name,
snowflake.warehouse.name,
deployment.environment}
| fieldsAdd key = concat(deployment.environment, "|", snowflake.warehouse.name)
], on: {left[key] == right[key]}
, fields: {snowflake.resource_monitor.name}
| expand rs = rs
| fieldsAdd snowflake.resource_monitor.name = rs[snowflake.resource_monitor.name]
| fieldsRemove rs
| filter in(deployment.environment, array($Accounts))
and iAny(startsWith(snowflake.warehouse.name, concat(array($Prefix)[], "_")))
and in(snowflake.resource_monitor.name, array($Resource_Monitors))
and in(snowflake.warehouse.name, array($Warehouses))
| fieldsAdd snowflake.time.duration = toDuration(1000*1000*toLong(snowflake.time.total_elapsed))
| sort snowflake.time.total_elapsed desc
| limit 100
| fields
`Duration`=snowflake.time.duration,
`Start Time`=timestamp-snowflake.time.duration,
`Query ID`=snowflake.query.id,
`User`=db.user,
`Account`=deployment.environment,
`Warehouse`=snowflake.warehouse.name,
`Resource Monitor`=coalesce(snowflake.resource_monitor.name, "-"),
`Query SQL`=substring(db.query.text, to: 15)
visualization: table
visualizationSettings:
table:
columnTypeOverrides:
- fields:
- content
id: 1759145367565
value: log-content
autoSelectVisualization: false
unitsOverrides:
- identifier: snowflake.time.running.in_min
unitCategory: time
baseUnit: minute
displayUnit: null
decimals: 2
suffix: ""
delimiter: false
added: 1759145749114
- identifier: snowflake.time.running
unitCategory: time
baseUnit: millisecond
displayUnit: null
decimals: 2
suffix: ""
delimiter: false
added: 1759145797490
querySettings:
maxResultRecords: 1000
defaultScanLimitGbytes: 500
maxResultMegaBytes: 1
defaultSamplingRatio: 10
enableSampling: false
davis:
enabled: false
davisVisualization:
isAvailable: true
componentState:
inputData: null
"13":
title: Queries currently running longer than $Slow_Query_Min minutes
type: data
query: |
fetch logs, from: -12h
| filter isNotNull(snowflake.query.id)
| filter dsoa.run.context == "active_queries"
| filter isNotNull(snowflake.time.running)
| fieldsAdd snowflake.time.running.in_min = toLong(snowflake.time.running)/1000/60
| filter toLong(snowflake.time.running.in_min) > toDouble($Slow_Query_Min)
| fieldsAdd key = concat(deployment.environment, "|", snowflake.warehouse.name)
| joinNested rs = [
fetch events
| filter db.system == "snowflake"
| filter isNotNull(snowflake.warehouse.event)
| filter isNotNull(snowflake.resource_monitor.name) and isNotNull(snowflake.warehouse.name)
| summarize {count()}, by: {
snowflake.resource_monitor.name,
snowflake.warehouse.name,
deployment.environment}
| fieldsAdd key = concat(deployment.environment, "|", snowflake.warehouse.name)
], on: {left[key] == right[key]}
, fields: {snowflake.resource_monitor.name}
| expand rs = rs
| fieldsAdd snowflake.resource_monitor.name = rs[snowflake.resource_monitor.name]
| fieldsRemove rs
| filter in(deployment.environment, array($Accounts))
and iAny(startsWith(snowflake.warehouse.name, concat(array($Prefix)[], "_")))
and in(snowflake.resource_monitor.name, array($Resource_Monitors))
and in(snowflake.warehouse.name, array($Warehouses))
| sort timestamp asc
| summarize {
timestamp = takeLast(timestamp),
snowflake.time.running = takeLast(snowflake.time.running),
snowflake.time.running.in_min = takeLast(snowflake.time.running.in_min),
dsoa.run.last_id = takeLast(dsoa.run.id)
}, by: {
dsoa.run.id,
snowflake.query.id,
snowflake.warehouse.name,
deployment.environment,
db.query.text,
db.user
}
| filter dsoa.run.last_id == dsoa.run.id
| join [
fetch logs, from: -12h
| filter isNotNull(snowflake.query.id)
| filter dsoa.run.context == "query_history"
| filter in(deployment.environment, array($Accounts))
and iAny(startsWith(snowflake.warehouse.name, concat(array($Prefix)[], "_")))
and in(snowflake.resource_monitor.name, array($Resource_Monitors))
and in(snowflake.warehouse.name, array($Warehouses))
| fields snowflake.query.id, is_finished = true
]
, on: {left[snowflake.query.id] == right[snowflake.query.id]}
, kind:leftOuter
, fields: {is_finished}
| filterOut is_finished
| fieldsRemove is_finished
| fieldsAdd snowflake.time.duration = toDuration(1000*1000*toLong(snowflake.time.running))
| fields
`Start Time`=timestamp - snowflake.time.duration,
`Duration`=snowflake.time.duration,
`Query ID`=snowflake.query.id,
`User`=db.user,
`Warehouse`=snowflake.warehouse.name,
`Account`=deployment.environment,
`Query SQL`=db.query.text
visualization: table
visualizationSettings:
autoSelectVisualization: true
querySettings:
maxResultRecords: 1000
defaultScanLimitGbytes: 500
maxResultMegaBytes: 1
defaultSamplingRatio: 10