feat: add Loki log query support to lab-monitoring
Add 3 opt-in Loki tools (query_logs, list_labels, list_label_values) that are registered when LOKI_URL is configured. Includes Loki HTTP client, CLI commands (logs, labels), NixOS module option, formatting, and tests. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,12 @@ in
|
||||
description = "Alertmanager base URL.";
|
||||
};
|
||||
|
||||
lokiUrl = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = "Loki base URL. When set, enables log query tools (query_logs, list_labels, list_label_values).";
|
||||
};
|
||||
|
||||
enableSilences = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
@@ -104,6 +110,8 @@ in
|
||||
environment = {
|
||||
PROMETHEUS_URL = cfg.prometheusUrl;
|
||||
ALERTMANAGER_URL = cfg.alertmanagerUrl;
|
||||
} // lib.optionalAttrs (cfg.lokiUrl != null) {
|
||||
LOKI_URL = cfg.lokiUrl;
|
||||
};
|
||||
|
||||
script = let
|
||||
|
||||
Reference in New Issue
Block a user