loki: added derivedFields for tempo

This commit is contained in:
Tigor Hutasuhut 2024-10-30 16:23:03 +07:00
parent aab201ab9e
commit 67873179ce
2 changed files with 18 additions and 0 deletions

View file

@ -2,6 +2,7 @@
let let
cfg = config.profile.services.telemetry.loki; cfg = config.profile.services.telemetry.loki;
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (lib.lists) optional;
lokiDomain = "loki.tigor.web.id"; lokiDomain = "loki.tigor.web.id";
server = config.services.loki.configuration.server; server = config.services.loki.configuration.server;
in in
@ -96,6 +97,22 @@ in
jsonData = { jsonData = {
timeout = 60; timeout = 60;
maxLines = 1000; maxLines = 1000;
derivedFields =
[ ]
++ (optional config.services.tempo.enable {
datasourceUid = "tempo";
matcherRegex = ''traceID=(\\w+)'';
name = "TraceID";
url = "$\${__value.raw}";
urlDisplayLabel = "Trace";
})
++ (optional config.services.tempo.enable {
datasourceUid = "tempo";
matcherRegex = ''"trace_id":"(\\w+)"'';
name = "TraceID";
url = "$\${__value.raw}";
urlDisplayLabel = "Trace";
});
}; };
} }
]; ];

View file

@ -53,6 +53,7 @@ in
{ {
name = "Tempo"; name = "Tempo";
type = "tempo"; type = "tempo";
uid = "tempo";
access = "proxy"; access = "proxy";
url = "http://${server.http_listen_address}:${toString server.http_listen_port}"; url = "http://${server.http_listen_address}:${toString server.http_listen_port}";
basicAuth = false; basicAuth = false;