From cefabc1e933757a5df862d75910d0fc77096e6fd Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 18 Jun 2022 20:21:13 +0200 Subject: [PATCH] services/{monitoring,ipfs}: tracing: use port-magic v2 --- hosts/VEGAS/services/ipfs/default.nix | 2 +- hosts/VEGAS/services/monitoring/tracing.nix | 22 +++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/hosts/VEGAS/services/ipfs/default.nix b/hosts/VEGAS/services/ipfs/default.nix index 19d8477..f9aff9a 100644 --- a/hosts/VEGAS/services/ipfs/default.nix +++ b/hosts/VEGAS/services/ipfs/default.nix @@ -13,7 +13,7 @@ in systemd.services.ipfs.environment = { OTEL_TRACES_EXPORTER = "otlp"; 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_ARG = "0.01"; }; diff --git a/hosts/VEGAS/services/monitoring/tracing.nix b/hosts/VEGAS/services/monitoring/tracing.nix index 131d63a..3302cd1 100644 --- a/hosts/VEGAS/services/monitoring/tracing.nix +++ b/hosts/VEGAS/services/monitoring/tracing.nix @@ -1,18 +1,19 @@ { config, pkgs, ... }: let + inherit (config) links; dataDir = "/srv/storage/private/tempo"; tempoConfig = { server = { - http_listen_address = "127.0.0.1"; - http_listen_port = config.ports.tempo; - grpc_listen_address = "127.0.0.1"; - grpc_listen_port = config.ports.tempo-grpc; + 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; }; distributor.receivers.otlp = { protocols = { - http.endpoint = "127.0.0.1:${config.portsStr.tempo-otlp-http}"; - grpc.endpoint = "127.0.0.1:${config.portsStr.tempo-otlp-grpc}"; + http.endpoint = links.tempo-otlp-http.tuple; + grpc.endpoint = links.tempo-otlp-grpc.tuple; }; }; ingester = { @@ -44,7 +45,12 @@ let }; }; 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 = { isSystemUser = true; @@ -65,7 +71,7 @@ in { services.grafana.provision.datasources = [ { name = "Tempo"; - url = "http://127.0.0.1:${config.portsStr.tempo}"; + inherit (links.tempo) url; type = "tempo"; } ];