commit 90fee6ab427371bd39fca4a2042903668cfa6905
parent 7ae78c5f5f4876269453eaf597a3208af6d5139c
Author: mtmn <miro@haravara.org>
Date: Sat, 18 Apr 2026 03:43:42 +0200
feat: enable tempo tracing
Diffstat:
4 files changed, 83 insertions(+), 8 deletions(-)
diff --git a/flake.lock b/flake.lock
@@ -30,11 +30,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
- "lastModified": 1776475625,
- "narHash": "sha256-OSY6HXTq16xZ2wMLibMwsGRqcIW/XXbvruUGvTs3/PM=",
+ "lastModified": 1776511703,
+ "narHash": "sha256-N7t1Ee5QaZ+yKXjFzPwca8fErpHTdPAuxSE9IBsLxSw=",
"ref": "refs/heads/master",
- "rev": "7778b2f51bb2535961430c68e07976a618574f98",
- "revCount": 81,
+ "rev": "5cb6c43180d6db5d8a5c67d26691c3f6898b7aa7",
+ "revCount": 86,
"type": "git",
"url": "ssh://git@codeberg.org/mtmn/corpus"
},
@@ -255,11 +255,11 @@
},
"nixpkgs_2": {
"locked": {
- "lastModified": 1776255774,
- "narHash": "sha256-psVTpH6PK3q1htMJpmdz1hLF5pQgEshu7gQWgKO6t6Y=",
+ "lastModified": 1776329215,
+ "narHash": "sha256-a8BYi3mzoJ/AcJP8UldOx8emoPRLeWqALZWu4ZvjPXw=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "566acc07c54dc807f91625bb286cb9b321b5f42a",
+ "rev": "b86751bc4085f48661017fa226dee99fab6c651b",
"type": "github"
},
"original": {
diff --git a/modules/services/corpus-dashboard.json b/modules/mixins/corpus/grafana-dashboard.json
diff --git a/modules/services/corpus.nix b/modules/services/corpus.nix
@@ -52,6 +52,8 @@ in {
PORT = toString cfg.port;
CORPUS_USERS_FILE = "${users}";
DATABASE_PATH = cfg.dataDir;
+ OTEL_SERVICE_NAME = "corpus";
+ OTEL_EXPORTER_OTLP_ENDPOINT = "http://127.0.0.1:4318";
};
serviceConfig = {
diff --git a/modules/services/monitoring.nix b/modules/services/monitoring.nix
@@ -54,7 +54,7 @@
]
++ lib.optional config.services.haravara.corpus.enable {
name = "corpus.json";
- path = ./corpus-dashboard.json;
+ path = ../mixins/corpus/grafana-dashboard.json;
});
in {
options.services.haravara.monitoring = {
@@ -225,9 +225,52 @@ in {
};
};
+ tempo = {
+ enable = true;
+ settings = {
+ server = {
+ http_listen_address = "127.0.0.1";
+ http_listen_port = 3200;
+ grpc_listen_address = "127.0.0.1";
+ grpc_listen_port = 9096;
+ };
+ distributor.receivers.otlp.protocols.grpc.endpoint = "127.0.0.1:4317";
+ ingester = {
+ trace_idle_period = "10s";
+ max_block_duration = "5m";
+ };
+ compactor.compaction.block_retention = "48h";
+ metrics_generator = {
+ ring.kvstore.store = "inmemory";
+ storage = {
+ path = "/var/lib/tempo/generator/wal";
+ remote_write = [
+ {
+ url = "http://127.0.0.1:8428/api/v1/write";
+ send_exemplars = true;
+ }
+ ];
+ };
+ processor = {
+ service_graphs = {};
+ span_metrics = {};
+ local_blocks = {};
+ };
+ };
+ overrides.defaults.metrics_generator.processors = ["service-graphs" "span-metrics" "local-blocks"];
+ storage.trace = {
+ backend = "local";
+ local.path = "/var/lib/tempo/traces";
+ wal.path = "/var/lib/tempo/wal";
+ };
+ };
+ };
+
alloy = {
enable = true;
configPath = pkgs.writeText "alloy-config.river" ''
+ // ── Logs ────────────────────────────────────────────────────────────
+
loki.write "default" {
endpoint {
url = "http://127.0.0.1:3100/loki/api/v1/push"
@@ -266,6 +309,26 @@ in {
host = "${config.networking.hostName}",
}
}
+
+ // ── Traces ──────────────────────────────────────────────────────────
+
+ otelcol.receiver.otlp "default" {
+ http {
+ endpoint = "127.0.0.1:4318"
+ }
+ output {
+ traces = [otelcol.exporter.otlp.tempo.input]
+ }
+ }
+
+ otelcol.exporter.otlp "tempo" {
+ client {
+ endpoint = "127.0.0.1:4317"
+ tls {
+ insecure = true
+ }
+ }
+ }
'';
};
@@ -293,6 +356,10 @@ in {
name = "Loki";
orgId = 1;
}
+ {
+ name = "Tempo";
+ orgId = 1;
+ }
];
datasources = [
{
@@ -307,6 +374,12 @@ in {
type = "loki";
url = "http://127.0.0.1:3100";
}
+ {
+ name = "Tempo";
+ type = "tempo";
+ url = "http://127.0.0.1:3200";
+ uid = "DS_TEMPO";
+ }
];
};
dashboards.settings.providers = [