refactor(users/flokli/nixos-tvix-cache): absorb otlpcollector into alloy
We don't need a separate instance of opentelemetry-collector, alloy can also do this job for us. Change-Id: I1b671ba57d70b080f7db112e1afcfe2e0cbdd13e Reviewed-on: https://cl.tvl.fyi/c/depot/+/12829 Reviewed-by: flokli <flokli@flokli.de> Reviewed-by: Jonas Chevalier <zimbatm@zimbatm.com> Tested-by: BuildkiteCI
This commit is contained in:
parent
09b343864a
commit
cb85e87376
1 changed files with 36 additions and 52 deletions
|
@ -39,72 +39,56 @@ in
|
||||||
services.alloy.enable = true;
|
services.alloy.enable = true;
|
||||||
|
|
||||||
environment.etc."alloy/config.alloy".text = ''
|
environment.etc."alloy/config.alloy".text = ''
|
||||||
prometheus.exporter.unix "main" { }
|
// Accept OTLP. Forward metrics to victoriametrics, and traces to tempo.
|
||||||
|
otelcol.receiver.otlp "main" {
|
||||||
|
grpc {
|
||||||
|
endpoint = "[::1]:4317"
|
||||||
|
}
|
||||||
|
|
||||||
prometheus.scrape "main" {
|
http {
|
||||||
targets = prometheus.exporter.unix.main.targets
|
endpoint = "[::1]:4318"
|
||||||
forward_to = [otelcol.receiver.prometheus.default.receiver]
|
}
|
||||||
}
|
|
||||||
|
|
||||||
otelcol.receiver.prometheus "default" {
|
|
||||||
output {
|
output {
|
||||||
metrics = [otelcol.exporter.otlp.default.input]
|
metrics = [otelcol.exporter.otlphttp.victoriametrics.input]
|
||||||
|
traces = [otelcol.exporter.otlp.tempo.input]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
otelcol.exporter.otlp "default" {
|
// We push to Tempo over otlp-grpc.
|
||||||
|
otelcol.exporter.otlp "tempo" {
|
||||||
client {
|
client {
|
||||||
endpoint = "127.0.0.1:4317"
|
endpoint = "127.0.0.1:4319"
|
||||||
tls {
|
tls {
|
||||||
insecure = true
|
insecure = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We push to VictoriaMetrics over otlp-http.
|
||||||
|
otelcol.exporter.otlphttp "victoriametrics" {
|
||||||
|
client {
|
||||||
|
endpoint = "http://localhost:8428/opentelemetry"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run a bundled node-exporter.
|
||||||
|
prometheus.exporter.unix "main" { }
|
||||||
|
|
||||||
|
// Scrape it.
|
||||||
|
prometheus.scrape "main" {
|
||||||
|
targets = prometheus.exporter.unix.main.targets
|
||||||
|
forward_to = [otelcol.receiver.prometheus.default.receiver]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert Prometheus metrics to OTLP and export them.
|
||||||
|
otelcol.receiver.prometheus "default" {
|
||||||
|
output {
|
||||||
|
metrics = [otelcol.exporter.otlphttp.victoriametrics.input]
|
||||||
|
}
|
||||||
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
services.opentelemetry-collector = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
receivers = {
|
|
||||||
otlp.protocols.grpc.endpoint = "127.0.0.1:4317";
|
|
||||||
otlp.protocols.http.endpoint = "127.0.0.1:4318";
|
|
||||||
};
|
|
||||||
|
|
||||||
processors = {
|
|
||||||
batch = { };
|
|
||||||
};
|
|
||||||
|
|
||||||
exporters = {
|
|
||||||
otlp = {
|
|
||||||
endpoint = "127.0.0.1:4319"; # Tempo otlp-grpc
|
|
||||||
tls.insecure = true;
|
|
||||||
};
|
|
||||||
"otlphttp/metrics" = {
|
|
||||||
compression = "gzip";
|
|
||||||
encoding = "proto";
|
|
||||||
endpoint = "http://localhost:8428/opentelemetry";
|
|
||||||
tls.insecure = true;
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
service = {
|
|
||||||
pipelines = {
|
|
||||||
traces = {
|
|
||||||
receivers = [ "otlp" ];
|
|
||||||
processors = [ "batch" ];
|
|
||||||
exporters = [ "otlp" ];
|
|
||||||
};
|
|
||||||
metrics = {
|
|
||||||
receivers = [ "otlp" ];
|
|
||||||
processors = [ "batch" ];
|
|
||||||
exporters = [ "otlphttp/metrics" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
services.victoriametrics.enable = true;
|
services.victoriametrics.enable = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue