2023-05-26 17:26:24 +03:00
|
|
|
{ cluster, config, pkgs, ... }:
|
2022-06-17 21:48:20 +03:00
|
|
|
|
|
|
|
let
|
2024-08-23 03:50:18 +03:00
|
|
|
inherit (cluster.config.links) prometheus-ingest;
|
|
|
|
inherit (config.links) tempo-grpc;
|
|
|
|
links = cluster.config.hostLinks.${config.networking.hostName};
|
2022-06-17 21:48:20 +03:00
|
|
|
dataDir = "/srv/storage/private/tempo";
|
|
|
|
tempoConfig = {
|
|
|
|
server = {
|
2022-06-18 21:21:13 +03:00
|
|
|
http_listen_address = links.tempo.ipv4;
|
|
|
|
http_listen_port = links.tempo.port;
|
2024-08-23 03:50:18 +03:00
|
|
|
grpc_listen_address = tempo-grpc.ipv4;
|
|
|
|
grpc_listen_port = tempo-grpc.port;
|
2022-06-17 21:48:20 +03:00
|
|
|
};
|
2023-11-04 04:59:17 +02:00
|
|
|
distributor.receivers = {
|
|
|
|
otlp = {
|
|
|
|
protocols = {
|
|
|
|
http.endpoint = links.tempo-otlp-http.tuple;
|
|
|
|
grpc.endpoint = links.tempo-otlp-grpc.tuple;
|
|
|
|
};
|
2022-06-17 21:48:20 +03:00
|
|
|
};
|
2023-11-04 04:59:17 +02:00
|
|
|
zipkin.endpoint = links.tempo-zipkin-http.tuple;
|
2022-06-17 21:48:20 +03:00
|
|
|
};
|
2024-08-23 03:50:18 +03:00
|
|
|
querier.frontend_worker.frontend_address = tempo-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 = {
|
2023-11-09 00:10:10 +02:00
|
|
|
backend = "s3";
|
2023-02-25 12:49:12 +02:00
|
|
|
block.bloom_filter_false_positive = 0.05;
|
2022-06-17 21:48:20 +03:00
|
|
|
wal.path = "${dataDir}/wal";
|
2023-11-09 00:10:10 +02:00
|
|
|
s3 = {
|
|
|
|
bucket = "tempo-chunks";
|
|
|
|
endpoint = cluster.config.links.garageS3.hostname;
|
|
|
|
region = "us-east-1";
|
|
|
|
forcepathstyle = true;
|
|
|
|
};
|
2022-06-17 21:48:20 +03:00
|
|
|
pool = {
|
|
|
|
max_workers = 16;
|
|
|
|
queue_depth = 1000;
|
|
|
|
};
|
|
|
|
};
|
2022-06-19 00:24:12 +03:00
|
|
|
metrics_generator = {
|
|
|
|
registry.external_labels = {
|
|
|
|
source = "tempo";
|
|
|
|
host = config.networking.hostName;
|
|
|
|
};
|
|
|
|
storage = {
|
|
|
|
path = "${dataDir}/generator/wal";
|
|
|
|
remote_write = [
|
|
|
|
{
|
2024-08-23 03:50:18 +03:00
|
|
|
url = "${prometheus-ingest.url}/api/v1/write";
|
2022-06-19 00:24:12 +03:00
|
|
|
send_exemplars = true;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
overrides.metrics_generator_processors = [
|
|
|
|
"service-graphs"
|
|
|
|
"span-metrics"
|
|
|
|
];
|
2022-06-17 21:48:20 +03:00
|
|
|
};
|
|
|
|
in {
|
2024-08-23 03:50:18 +03:00
|
|
|
links.tempo-grpc.protocol = "http";
|
|
|
|
|
|
|
|
services.locksmith.waitForSecrets.tempo = [
|
|
|
|
"garage-tempo-ingest"
|
|
|
|
];
|
2023-11-09 00:10:10 +02:00
|
|
|
|
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" ];
|
2024-08-23 03:50:18 +03:00
|
|
|
distributed = {
|
|
|
|
enable = true;
|
|
|
|
registerServices = [
|
|
|
|
"tempo"
|
|
|
|
"tempo-ingest-otlp-grpc"
|
|
|
|
];
|
|
|
|
};
|
2022-06-17 21:48:20 +03:00
|
|
|
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;
|
2024-08-23 03:50:18 +03:00
|
|
|
EnvironmentFile = "/run/locksmith/garage-tempo-ingest";
|
2022-06-17 21:48:20 +03:00
|
|
|
};
|
|
|
|
};
|
2024-08-23 03:50:18 +03:00
|
|
|
|
|
|
|
consul.services = {
|
|
|
|
tempo = {
|
|
|
|
mode = "manual";
|
|
|
|
definition = {
|
|
|
|
name = "tempo";
|
|
|
|
address = links.tempo.ipv4;
|
|
|
|
inherit (links.tempo) port;
|
|
|
|
checks = [
|
|
|
|
{
|
|
|
|
name = "Tempo";
|
|
|
|
id = "service:tempo:backend";
|
|
|
|
interval = "5s";
|
|
|
|
http = "${links.tempo.url}/ready";
|
|
|
|
}
|
|
|
|
];
|
2022-06-19 00:24:12 +03:00
|
|
|
};
|
2024-08-23 03:50:18 +03:00
|
|
|
};
|
|
|
|
tempo-ingest-otlp-grpc = {
|
|
|
|
mode = "manual";
|
|
|
|
definition = {
|
|
|
|
name = "tempo-ingest-otlp-grpc";
|
|
|
|
address = links.tempo-otlp-grpc.ipv4;
|
|
|
|
inherit (links.tempo-otlp-grpc) port;
|
|
|
|
checks = [
|
|
|
|
{
|
|
|
|
name = "Tempo Service Status";
|
|
|
|
id = "service:tempo-ingest-otlp-grpc:tempo";
|
|
|
|
alias_service = "tempo";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2022-06-17 21:48:20 +03:00
|
|
|
}
|