2022-06-17 21:48:20 +03:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
2022-06-18 21:21:13 +03:00
|
|
|
inherit (config) links;
|
2022-06-17 21:48:20 +03:00
|
|
|
dataDir = "/srv/storage/private/tempo";
|
|
|
|
tempoConfig = {
|
2022-06-18 22:03:04 +03:00
|
|
|
search_enabled = true;
|
2022-06-17 21:48:20 +03:00
|
|
|
server = {
|
2022-06-18 21:21:13 +03:00
|
|
|
http_listen_address = links.tempo.ipv4;
|
|
|
|
http_listen_port = links.tempo.port;
|
|
|
|
grpc_listen_address = links.tempo-grpc.ipv4;
|
|
|
|
grpc_listen_port = links.tempo-grpc.port;
|
2022-06-17 21:48:20 +03:00
|
|
|
};
|
|
|
|
distributor.receivers.otlp = {
|
|
|
|
protocols = {
|
2022-06-18 21:21:13 +03:00
|
|
|
http.endpoint = links.tempo-otlp-http.tuple;
|
|
|
|
grpc.endpoint = links.tempo-otlp-grpc.tuple;
|
2022-06-17 21:48:20 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
ingester = {
|
|
|
|
trace_idle_period = "30s";
|
|
|
|
max_block_bytes = 1000000;
|
|
|
|
max_block_duration = "5m";
|
|
|
|
};
|
|
|
|
compactor = {
|
|
|
|
compaction = {
|
|
|
|
compaction_window = "1h";
|
|
|
|
max_block_bytes = 100000000;
|
|
|
|
compacted_block_retention = "10m";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
storage.trace = {
|
|
|
|
backend = "local";
|
|
|
|
block = {
|
|
|
|
bloom_filter_false_positive = 0.05;
|
|
|
|
index_downsample_bytes = 1000;
|
|
|
|
encoding = "zstd";
|
|
|
|
};
|
|
|
|
wal.path = "${dataDir}/wal";
|
|
|
|
wal.encoding = "snappy";
|
|
|
|
local.path = "${dataDir}/blocks";
|
|
|
|
pool = {
|
|
|
|
max_workers = 16;
|
|
|
|
queue_depth = 1000;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in {
|
2022-06-18 21:21:13 +03:00
|
|
|
links = {
|
|
|
|
tempo.protocol = "http";
|
|
|
|
tempo-grpc.protocol = "http";
|
|
|
|
tempo-otlp-http.protocol = "http";
|
|
|
|
tempo-otlp-grpc.protocol = "http";
|
|
|
|
};
|
2022-06-17 21:48:20 +03:00
|
|
|
|
|
|
|
users.users.tempo = {
|
|
|
|
isSystemUser = true;
|
|
|
|
group = "tempo";
|
|
|
|
home = dataDir;
|
|
|
|
createHome = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
users.groups.tempo = {};
|
|
|
|
|
|
|
|
systemd.services.tempo = {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
2022-06-18 21:53:08 +03:00
|
|
|
User = "tempo";
|
|
|
|
Group = "tempo";
|
2022-06-17 21:48:20 +03:00
|
|
|
ExecStart = "${pkgs.tempo}/bin/tempo -config.file=${pkgs.writeText "tempo.yaml" (builtins.toJSON tempoConfig)}";
|
|
|
|
PrivateTmp = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
services.grafana.provision.datasources = [
|
|
|
|
{
|
|
|
|
name = "Tempo";
|
2022-06-18 21:21:13 +03:00
|
|
|
inherit (links.tempo) url;
|
2022-06-17 21:48:20 +03:00
|
|
|
type = "tempo";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|