1 import ./make-test-python.nix ({ pkgs, ...} : let
4 name = "opentelemetry-collector";
5 meta = with pkgs.lib.maintainers; {
6 maintainers = [ tylerjl ];
9 nodes.machine = { ... }: {
10 networking.firewall.allowedTCPPorts = [ port ];
11 services.opentelemetry-collector = {
14 exporters.logging.verbosity = "detailed";
15 receivers.otlp.protocols = {
16 http.endpoint = "0.0.0.0:${toString port}";
20 receivers = [ "otlp" ];
21 exporters = [ "logging" ];
26 virtualisation.forwardPorts = [{
32 extraPythonPackages = p: [
37 # Send a log event through the OTLP pipeline and check for its
38 # presence in the collector logs.
39 testScript = /* python */ ''
43 from uuid import uuid4
47 machine.wait_for_unit("opentelemetry-collector.service")
48 machine.wait_for_open_port(${toString port})
53 "resource": {"attributes": []},
58 "timeUnixNano": str(time.time_ns()),
60 "severityText": "Info",
74 response = requests.post("http://localhost:${toString port}/v1/logs", json=event)
75 assert response.status_code == 200
76 assert flag in machine.execute("journalctl -u opentelemetry-collector")[-1]