prometheus-knot-exporter: add patch to fix stats

This is a patch I filed against upstream[1] a while ago. As it isn't
merged yet and fixes configurations with all stats enabled in knot
(otherwise it'd crash when sending a request to `localhost:9433`), I
decided that it makes sense to add it to the package directly.

I extended the test to make sure that it only passes with this patch.

[1] https://github.com/ghedo/knot_exporter/pull/6
This commit is contained in:
Maximilian Bosch
2021-05-03 17:27:36 +02:00
parent 040f0acccd
commit 75c5a703ab
2 changed files with 46 additions and 2 deletions
@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, lib, python3, nixosTests }:
{ stdenv, fetchFromGitHub, lib, python3, nixosTests, fetchpatch }:
stdenv.mkDerivation rec {
pname = "knot-exporter";
@@ -11,6 +11,15 @@ stdenv.mkDerivation rec {
sha256 = "sha256-4au4lpaq3jcqC2JXdCcf8h+YN8Nmm4eE0kZwA+1rWlc=";
};
patches = [
# Fixes a crash with all metrics enabled. See
# https://github.com/ghedo/knot_exporter/pull/6 for further context.
(fetchpatch {
url = "https://github.com/ghedo/knot_exporter/commit/2317476e080369450ae51a707ccd30d4b89d680f.patch";
sha256 = "sha256-yEPu8EE1V/draNx9DeMrPj+bMfJRxauweo33dITl4AA=";
})
];
dontBuild = true;
nativeBuildInputs = [ python3.pkgs.wrapPython ];