2024-09-02 18:17:03 +07:00
|
|
|
{ config, lib, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.profile.services.telemetry.tempo;
|
|
|
|
inherit (lib) mkIf;
|
|
|
|
domain = "tempo.tigor.web.id";
|
|
|
|
server = config.services.tempo.settings.server;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
services.caddy.virtualHosts.${domain}.extraConfig = ''
|
2024-09-07 09:55:03 +07:00
|
|
|
@require_auth not remote_ip private_ranges
|
|
|
|
|
2024-10-28 21:38:34 +07:00
|
|
|
basic_auth @require_auth {
|
|
|
|
{$AUTH_USERNAME} {$AUTH_PASSWORD}
|
2024-09-02 18:17:03 +07:00
|
|
|
}
|
|
|
|
|
2024-09-07 09:55:03 +07:00
|
|
|
reverse_proxy ${server.http_listen_address}:3200
|
2024-09-02 18:17:03 +07:00
|
|
|
'';
|
|
|
|
|
2024-10-29 21:45:05 +07:00
|
|
|
services.tempo = rec {
|
2024-09-02 18:17:03 +07:00
|
|
|
enable = true;
|
|
|
|
settings = {
|
|
|
|
server = {
|
2024-10-29 21:45:05 +07:00
|
|
|
http_listen_address = "192.168.100.3";
|
2024-09-02 18:17:03 +07:00
|
|
|
http_listen_port = 3200;
|
|
|
|
grpc_listen_port = 9096;
|
|
|
|
};
|
|
|
|
distributor = {
|
|
|
|
receivers = {
|
|
|
|
otlp = {
|
|
|
|
protocols = {
|
2024-10-29 21:45:05 +07:00
|
|
|
http = {
|
|
|
|
endpoint = "${settings.server.http_listen_address}:4318";
|
|
|
|
};
|
|
|
|
grpc = {
|
|
|
|
endpoint = "${settings.server.http_listen_address}:4317";
|
|
|
|
};
|
2024-09-02 18:17:03 +07:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
storage.trace = {
|
|
|
|
backend = "local";
|
|
|
|
local.path = "/var/lib/tempo/traces";
|
|
|
|
wal.path = "/var/lib/tempo/wal";
|
|
|
|
};
|
|
|
|
ingester = {
|
|
|
|
lifecycler.ring.replication_factor = 1;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
services.grafana.provision.datasources.settings.datasources = [
|
|
|
|
{
|
|
|
|
name = "Tempo";
|
|
|
|
type = "tempo";
|
|
|
|
access = "proxy";
|
|
|
|
url = "http://${server.http_listen_address}:${toString server.http_listen_port}";
|
|
|
|
basicAuth = false;
|
|
|
|
jsonData = {
|
|
|
|
nodeGraph.enabled = true;
|
|
|
|
search.hide = false;
|
|
|
|
traceQuery = {
|
|
|
|
timeShiftEnabled = true;
|
|
|
|
spanStartTimeShift = "1h";
|
|
|
|
spanEndTimeShift = "1h";
|
|
|
|
};
|
|
|
|
spanBar = {
|
|
|
|
type = "Tag";
|
|
|
|
tag = "http.path";
|
|
|
|
};
|
|
|
|
tracesToLogsV2 = mkIf config.profile.services.telemetry.loki.enable {
|
|
|
|
datasourceUid = "loki";
|
|
|
|
spanStartTimeShift = "-1h";
|
|
|
|
spanEndTimeShift = "1h";
|
2024-10-21 12:31:30 +07:00
|
|
|
tags = [
|
|
|
|
"job"
|
|
|
|
"instance"
|
|
|
|
"pod"
|
|
|
|
"namespace"
|
|
|
|
];
|
2024-09-02 18:17:03 +07:00
|
|
|
filterByTraceID = false;
|
|
|
|
filterBySpanID = false;
|
|
|
|
customQuery = true;
|
|
|
|
query = ''method="$''${__span.tags.method}"'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|