@@ -373,6 +373,179 @@ local prometheus = grafana.prometheus;
373
373
level='critical' ,
374
374
),
375
375
376
+ local tarantool3_config_description_note(description) = std.join('\n', [description, |||
377
+ Panel minimal requirements: metrics 1.2.0, Tarantool 3.
378
+ ||| ]),
379
+
380
+ tarantool3_config_status(
381
+ cfg,
382
+ title='Tarantool configuration status' ,
383
+ description=tarantool3_config_description_note(|||
384
+ Current Tarantool 3 configuration apply status for a cluster instance.
385
+ `uninitialized` decribes uninitialized instance,
386
+ `check_errors` decribes instance with at least one apply error,
387
+ `check_warnings` decribes instance with at least one apply warning,
388
+ `startup_in_progress` decribes instance doing initial configuration apply,
389
+ `reload_in_progress` decribes instance doing configuration apply over existing configuration,
390
+ `ready` describes a healthy instance.
391
+
392
+ Panel minimal requirements: Grafana 8.
393
+ ||| ),
394
+ ):: timeseries.new(
395
+ title=title,
396
+ description=description,
397
+ datasource=cfg.datasource,
398
+ panel_width=12 ,
399
+ max=6 ,
400
+ min=1 ,
401
+ ).addValueMapping(
402
+ 1 , 'dark-red' , 'uninitialized'
403
+ ).addRangeMapping(
404
+ 1.001 , 1.999 , '-'
405
+ ).addValueMapping(
406
+ 2 , 'red' , 'check_errors'
407
+ ).addRangeMapping(
408
+ 2.001 , 2.999 , '-'
409
+ ).addValueMapping(
410
+ 3 , 'yellow' , 'startup_in_progress'
411
+ ).addRangeMapping(
412
+ 3.001 , 3.999 , '-'
413
+ ).addValueMapping(
414
+ 4 , 'dark-yellow' , 'reload_in_progress'
415
+ ).addRangeMapping(
416
+ 4.001 , 4.999 , '-'
417
+ ).addValueMapping(
418
+ 5 , 'dark-orange' , 'check_warnings'
419
+ ).addRangeMapping(
420
+ 5.001 , 5.999 , '-'
421
+ ).addValueMapping(
422
+ 6 , 'green' , 'ready'
423
+ ).addTarget(
424
+ if cfg.type == variable.datasource_type.prometheus then
425
+ local expr = std.format (
426
+ |||
427
+ 1 * %(metric_full_name)s{%(uninitialized_filters)s} + on(alias)
428
+ 2 * %(metric_full_name)s{%(check_errors_filters)s} + on(alias)
429
+ 3 * %(metric_full_name)s{%(startup_in_progress_filters)s} + on(alias)
430
+ 4 * %(metric_full_name)s{%(reload_in_progress_filters)s} + on(alias)
431
+ 5 * %(metric_full_name)s{%(check_warnings_filters)s} + on(alias)
432
+ 6 * %(metric_full_name)s{%(ready_filters)s}
433
+ ||| , {
434
+ metric_full_name: cfg.metrics_prefix + 'tnt_config_status' ,
435
+ uninitialized_filters: common.prometheus_query_filters(cfg.filters { status: ['=' , 'uninitialized' ] }),
436
+ check_errors_filters: common.prometheus_query_filters(cfg.filters { status: ['=' , 'check_errors' ] }),
437
+ startup_in_progress_filters: common.prometheus_query_filters(cfg.filters { status: ['=' , 'startup_in_progress' ] }),
438
+ reload_in_progress_filters: common.prometheus_query_filters(cfg.filters { status: ['=' , 'reload_in_progress' ] }),
439
+ check_warnings_filters: common.prometheus_query_filters(cfg.filters { status: ['=' , 'check_warnings' ] }),
440
+ ready_filters: common.prometheus_query_filters(cfg.filters { status: ['=' , 'ready' ] }),
441
+ }
442
+ );
443
+ prometheus.target(expr=expr, legendFormat='{{alias}}' )
444
+ else if cfg.type == variable.datasource_type.influxdb then
445
+ local query = std.format(|||
446
+ SELECT (1 * last("uninitialized") + 2 * last("check_errors") + 3 * last("startup_in_progress") +
447
+ 4 * last("reload_in_progress") + 5 * last("check_warnings") + 6 * last("ready")) as "status" FROM
448
+ (
449
+ SELECT "value" as "uninitialized" FROM %(measurement_with_policy)s
450
+ WHERE ("metric_name" = '%(metric_full_name)s' AND %(uninitialized_filters)s) AND $timeFilter
451
+ ),
452
+ (
453
+ SELECT "value" as "check_errors" FROM %(measurement_with_policy)s
454
+ WHERE ("metric_name" = '%(metric_full_name)s' AND %(check_errors_filters)s) AND $timeFilter
455
+ ),
456
+ (
457
+ SELECT "value" as "startup_in_progress" FROM %(measurement_with_policy)s
458
+ WHERE ("metric_name" = '%(metric_full_name)s' AND %(startup_in_progress_filters)s) AND $timeFilter
459
+ ),
460
+ (
461
+ SELECT "value" as "reload_in_progress" FROM %(measurement_with_policy)s
462
+ WHERE ("metric_name" = '%(metric_full_name)s' AND %(reload_in_progress_filters)s) AND $timeFilter
463
+ ),
464
+ (
465
+ SELECT "value" as "check_warnings" FROM %(measurement_with_policy)s
466
+ WHERE ("metric_name" = '%(metric_full_name)s' AND %(check_warnings_filters)s) AND $timeFilter
467
+ ),
468
+ (
469
+ SELECT "value" as "ready" FROM %(measurement_with_policy)s
470
+ WHERE ("metric_name" = '%(metric_full_name)s' AND %(ready_filters)s) AND $timeFilter
471
+ )
472
+ GROUP BY time($__interval), "label_pairs_alias" fill(0)
473
+ ||| , {
474
+ metric_full_name: cfg.metrics_prefix + 'tnt_config_status' ,
475
+ measurement_with_policy: std.format ('%(policy_prefix)s"%(measurement)s"' , {
476
+ policy_prefix: if cfg.policy == 'default' then '' else std.format ('"%(policy)s".' , cfg.policy),
477
+ measurement: cfg.measurement,
478
+ }),
479
+ uninitialized_filters: common.influxdb_query_filters(cfg.filters { label_pairs_status: ['=' , 'uninitialized' ] }),
480
+ check_errors_filters: common.influxdb_query_filters(cfg.filters { label_pairs_status: ['=' , 'check_errors' ] }),
481
+ startup_in_progress_filters: common.influxdb_query_filters(cfg.filters { label_pairs_status: ['=' , 'startup_in_progress' ] }),
482
+ reload_in_progress_filters: common.influxdb_query_filters(cfg.filters { label_pairs_status: ['=' , 'reload_in_progress' ] }),
483
+ check_warnings_filters: common.influxdb_query_filters(cfg.filters { label_pairs_status: ['=' , 'check_warnings' ] }),
484
+ ready_filters: common.influxdb_query_filters(cfg.filters { label_pairs_status: ['=' , 'ready' ] }),
485
+ });
486
+ influxdb.target(
487
+ rawQuery=true ,
488
+ query=query,
489
+ alias='$tag_label_pairs_alias' ,
490
+ )
491
+ ),
492
+
493
+ local tarantool3_config_alerts(
494
+ cfg,
495
+ title,
496
+ description,
497
+ level,
498
+ ) = common.default_graph(
499
+ cfg,
500
+ title=title,
501
+ description=tarantool3_config_description_note(description),
502
+ min=0 ,
503
+ legend_avg=false ,
504
+ legend_max=false ,
505
+ panel_height=8 ,
506
+ panel_width=6 ,
507
+ ).addTarget(
508
+ common.target(
509
+ cfg,
510
+ 'tnt_config_alerts' ,
511
+ additional_filters={
512
+ [variable.datasource_type.prometheus]: { level: ['=' , level] },
513
+ [variable.datasource_type.influxdb]: { label_pairs_level: ['=' , level] },
514
+ },
515
+ converter='last' ,
516
+ ),
517
+ ),
518
+
519
+ tarantool3_config_warning_alerts(
520
+ cfg,
521
+ title='Tarantool configuration warnings' ,
522
+ description=|||
523
+ Number of "warn" alerts on Tarantool 3 configuration apply on a cluster instance.
524
+ "warn" alerts cover non-critical issues which do not result in apply failure,
525
+ like missing a role to grant for a user.
526
+ ||| ,
527
+ ):: tarantool3_config_alerts(
528
+ cfg,
529
+ title=title,
530
+ description=description,
531
+ level='warn' ,
532
+ ),
533
+
534
+ tarantool3_config_error_alerts(
535
+ cfg,
536
+ title='Tarantool configuration errors' ,
537
+ description=|||
538
+ Number of "error" alerts on Tarantool 3 configuration apply on a cluster instance.
539
+ "error" alerts cover critical issues which results in apply failure,
540
+ like instance missing itself in configuration.
541
+ ||| ,
542
+ ):: tarantool3_config_alerts(
543
+ cfg,
544
+ title=title,
545
+ description=description,
546
+ level='error' ,
547
+ ),
548
+
376
549
failovers_per_second(
377
550
cfg,
378
551
title='Failovers triggered' ,
0 commit comments