alloy: integrated with tempo

This commit is contained in:
Tigor Hutasuhut 2024-09-07 08:59:44 +07:00
parent 227e610024
commit e8fc018fb4

View file

@ -3,6 +3,7 @@ let
cfg = config.profile.services.telemetry.alloy; cfg = config.profile.services.telemetry.alloy;
webguiListenAddress = "0.0.0.0:5319"; webguiListenAddress = "0.0.0.0:5319";
domain = "alloy.tigor.web.id"; domain = "alloy.tigor.web.id";
inherit (lib.strings) optionalString;
in in
{ {
imports = [ imports = [
@ -55,6 +56,7 @@ in
environment.etc."alloy/config.alloy".text = environment.etc."alloy/config.alloy".text =
let let
lokiConfig = config.services.loki.configuration; lokiConfig = config.services.loki.configuration;
tempoServer = config.services.tempo.settings.server;
in in
/*hcl*/ '' /*hcl*/ ''
otelcol.receiver.otlp "homeserver" { otelcol.receiver.otlp "homeserver" {
@ -69,7 +71,7 @@ in
output { output {
// metrics = [otelcol.processor.batch.default.input] // metrics = [otelcol.processor.batch.default.input]
logs = [otelcol.processor.batch.default.input] logs = [otelcol.processor.batch.default.input]
// traces = [otelcol.processor.batch.default.input] traces = [otelcol.processor.batch.default.input]
} }
} }
@ -77,7 +79,7 @@ in
output { output {
// metrics = [otelcol.exporter.loki.default.input] // metrics = [otelcol.exporter.loki.default.input]
logs = [otelcol.exporter.loki.default.input] logs = [otelcol.exporter.loki.default.input]
// traces = [otelcol.exporter.otlp.default.input] traces = [otelcol.exporter.otlp.tempo.input]
} }
} }
@ -90,6 +92,12 @@ in
url = "http://${lokiConfig.server.http_listen_address}:${toString lokiConfig.server.http_listen_port}" url = "http://${lokiConfig.server.http_listen_address}:${toString lokiConfig.server.http_listen_port}"
} }
} }
otelcol.exporter.otlp "tempo" {
client {
endpoint = "${tempoServer.http_listen_address}:${toString tempoServer.http_listen_port}"
}
}
''; '';
}; };
} }