Unverified Commit 3ad1ebe9 authored by Maximilian Bosch's avatar Maximilian Bosch Committed by GitHub
Browse files

Merge pull request #258047 from mweinelt/knot-exporter

prometheus-knot-exporter: 2021-08-21 -> 3.3.1; python310Packages.libknot: init at 3.3.1
parents 6da23cc9 d4b380d6
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -313,6 +313,8 @@

- `rome` was removed because it is no longer maintained and is succeeded by `biome`.

- The `prometheus-knot-exporter` was migrated to a version maintained by CZ.NIC. Various metric names have changed, so checking existing rules is recommended.

- The `services.mtr-exporter.target` has been removed in favor of `services.mtr-exporter.jobs` which allows specifying multiple targets.

- Setting `nixpkgs.config` options while providing an external `pkgs` instance will now raise an error instead of silently ignoring the options. NixOS modules no longer set `nixpkgs.config` to accomodate this. This specifically affects `services.locate`, `services.xserver.displayManager.lightdm.greeters.tiny` and `programs.firefox` NixOS modules. No manual intervention should be required in most cases, however, configurations relying on those modules affecting packages outside the system environment should switch to explicit overlays.
+12 −7
Original line number Diff line number Diff line
@@ -8,9 +8,9 @@ in {
  port = 9433;
  extraOpts = {
    knotLibraryPath = mkOption {
      type = types.str;
      default = "${pkgs.knot-dns.out}/lib/libknot.so";
      defaultText = literalExpression ''"''${pkgs.knot-dns.out}/lib/libknot.so"'';
      type = types.nullOr types.str;
      default = null;
      example = literalExpression ''"''${pkgs.knot-dns.out}/lib/libknot.so"'';
      description = lib.mdDoc ''
        Path to the library of `knot-dns`.
      '';
@@ -25,7 +25,7 @@ in {
    };

    knotSocketTimeout = mkOption {
      type = types.int;
      type = types.ints.positive;
      default = 2000;
      description = lib.mdDoc ''
        Timeout in seconds.
@@ -33,17 +33,22 @@ in {
    };
  };
  serviceOpts = {
    path = with pkgs; [
      procps
    ];
    serviceConfig = {
      ExecStart = ''
        ${pkgs.prometheus-knot-exporter}/bin/knot_exporter \
        ${pkgs.prometheus-knot-exporter}/bin/knot-exporter \
          --web-listen-addr ${cfg.listenAddress} \
          --web-listen-port ${toString cfg.port} \
          --knot-library-path ${cfg.knotLibraryPath} \
          --knot-socket-path ${cfg.knotSocketPath} \
          --knot-socket-timeout ${toString cfg.knotSocketTimeout} \
          ${lib.optionalString (cfg.knotLibraryPath != null) "--knot-library-path ${cfg.knotLibraryPath}"} \
          ${concatStringsSep " \\\n  " cfg.extraFlags}
      '';
      SupplementaryGroups = [ "knot" ];
      SupplementaryGroups = [
        "knot"
      ];
      RestrictAddressFamilies = [
        # Need AF_UNIX to collect data
        "AF_UNIX"
+1 −1
Original line number Diff line number Diff line
@@ -512,7 +512,7 @@ let
        wait_for_unit("knot.service")
        wait_for_unit("prometheus-knot-exporter.service")
        wait_for_open_port(9433)
        succeed("curl -sSf 'localhost:9433' | grep 'knot_server_zone_count 1.0'")
        succeed("curl -sSf 'localhost:9433' | grep '2\.019031301'")
      '';
    };

+43 −0
Original line number Diff line number Diff line
{ lib
, buildPythonPackage
, fetchPypi

# build-system
, hatchling

# native dependencies
, knot-dns
}:

buildPythonPackage rec {
  pname = "libknot";
  version = "3.3.2";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-uttdIl2ONoR9ba6gJXmJkU++UQldcezwTUG+X5mCcbE=";
  };

  postPatch = ''
    substituteInPlace libknot/__init__.py \
      --replace "libknot%s.dylib" "${lib.getLib knot-dns}/lib/libknot%s.dylib" \
      --replace "libknot.so%s" "${lib.getLib knot-dns}/lib/libknot.so%s"
  '';

  nativeBuildInputs = [
    hatchling
  ];

  pythonImportsCheck = [
    "libknot"
  ];

  meta = with lib; {
    description = "Python bindings for libknot";
    homepage = "https://gitlab.nic.cz/knot/knot-dns/-/tree/master/python/libknot";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ hexa ];
    mainProgram = "libknot";
  };
}
+1 −0
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ stdenv.mkDerivation rec {
    inherit knot-resolver;
  } // lib.optionalAttrs stdenv.isLinux {
    inherit (nixosTests) knot kea;
    prometheus-exporter = nixosTests.prometheus-exporters.knot;
    # Some dependencies are very version-sensitive, so the might get dropped
    # or embedded after some update, even if the nixPackagers didn't intend to.
    # For non-linux I don't know a good replacement for `ldd`.
Loading