services/{monitoring,ipfs}: tracing: use port-magic v2

This commit is contained in:
Max Headroom 2022-06-18 20:21:13 +02:00
parent 4a00c891af
commit cefabc1e93
2 changed files with 15 additions and 9 deletions

View file

@ -13,7 +13,7 @@ in
systemd.services.ipfs.environment = { systemd.services.ipfs.environment = {
OTEL_TRACES_EXPORTER = "otlp"; OTEL_TRACES_EXPORTER = "otlp";
OTEL_EXPORTER_OTLP_PROTOCOL = "grpc"; OTEL_EXPORTER_OTLP_PROTOCOL = "grpc";
OTEL_EXPORTER_OTLP_ENDPOINT = "http://127.0.0.1:${config.portsStr.tempo-otlp-grpc}"; OTEL_EXPORTER_OTLP_ENDPOINT = config.links.tempo-otlp-grpc.url;
OTEL_TRACES_SAMPLER = "parentbased_traceidratio"; OTEL_TRACES_SAMPLER = "parentbased_traceidratio";
OTEL_TRACES_SAMPLER_ARG = "0.01"; OTEL_TRACES_SAMPLER_ARG = "0.01";
}; };

View file

@ -1,18 +1,19 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let let
inherit (config) links;
dataDir = "/srv/storage/private/tempo"; dataDir = "/srv/storage/private/tempo";
tempoConfig = { tempoConfig = {
server = { server = {
http_listen_address = "127.0.0.1"; http_listen_address = links.tempo.ipv4;
http_listen_port = config.ports.tempo; http_listen_port = links.tempo.port;
grpc_listen_address = "127.0.0.1"; grpc_listen_address = links.tempo-grpc.ipv4;
grpc_listen_port = config.ports.tempo-grpc; grpc_listen_port = links.tempo-grpc.port;
}; };
distributor.receivers.otlp = { distributor.receivers.otlp = {
protocols = { protocols = {
http.endpoint = "127.0.0.1:${config.portsStr.tempo-otlp-http}"; http.endpoint = links.tempo-otlp-http.tuple;
grpc.endpoint = "127.0.0.1:${config.portsStr.tempo-otlp-grpc}"; grpc.endpoint = links.tempo-otlp-grpc.tuple;
}; };
}; };
ingester = { ingester = {
@ -44,7 +45,12 @@ let
}; };
}; };
in { in {
reservePortsFor = [ "tempo" "tempo-grpc" "tempo-otlp-http" "tempo-otlp-grpc" ]; links = {
tempo.protocol = "http";
tempo-grpc.protocol = "http";
tempo-otlp-http.protocol = "http";
tempo-otlp-grpc.protocol = "http";
};
users.users.tempo = { users.users.tempo = {
isSystemUser = true; isSystemUser = true;
@ -65,7 +71,7 @@ in {
services.grafana.provision.datasources = [ services.grafana.provision.datasources = [
{ {
name = "Tempo"; name = "Tempo";
url = "http://127.0.0.1:${config.portsStr.tempo}"; inherit (links.tempo) url;
type = "tempo"; type = "tempo";
} }
]; ];