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
cfg = config.profile.services.telemetry.loki;
inherit (lib) mkIf;
inherit (lib.lists) optional;
lokiDomain = "loki.tigor.web.id";
server = config.services.loki.configuration.server;
in
@ -96,6 +97,22 @@ in
jsonData = {
timeout = 60;
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";
type = "tempo";
uid = "tempo";
access = "proxy";
url = "http://${server.http_listen_address}:${toString server.http_listen_port}";
basicAuth = false;