prometheus-ebpf-exporter: 2.4.2 -> 2.5.1 (#447992)
This commit is contained in:
@@ -1,82 +1,88 @@
|
||||
{
|
||||
lib,
|
||||
clangStdenv,
|
||||
buildGoModule,
|
||||
fetchFromGitHub,
|
||||
nixosTests,
|
||||
pkgs,
|
||||
versionCheckHook,
|
||||
nix-update-script,
|
||||
libbpf,
|
||||
libelf,
|
||||
libsystemtap,
|
||||
libz,
|
||||
}:
|
||||
|
||||
let
|
||||
version = "2.4.2";
|
||||
tag = "v${version}";
|
||||
in
|
||||
buildGoModule.override
|
||||
{
|
||||
stdenv = pkgs.clangStdenv;
|
||||
}
|
||||
{
|
||||
name = "ebpf_exporter";
|
||||
# BPF programs must be compiled with Clang
|
||||
buildGoModule.override { stdenv = clangStdenv; } (finalAttrs: {
|
||||
pname = "prometheus-ebpf-exporter";
|
||||
version = "2.5.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
inherit tag;
|
||||
owner = "cloudflare";
|
||||
repo = "ebpf_exporter";
|
||||
hash = "sha256-gXzaMx9Z6LzrlDaQnagQIi183uKhJvdYiolYb8P+MIs=";
|
||||
};
|
||||
src = fetchFromGitHub {
|
||||
owner = "cloudflare";
|
||||
repo = "ebpf_exporter";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-zIevVZ4ldPj/4OvQFo+Nv/g//xNZEppO9ccB6y65rZA=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-GhQvPp8baw2l91OUOg+/lrG27P/D4Uzng8XevJf8Pj4=";
|
||||
vendorHash = "sha256-ZwKXIIoV4yEyjSpGjVDr91/CQmVuF9zc0IHkJYraE9o=";
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace examples/Makefile \
|
||||
--replace-fail "-Wall -Werror" ""
|
||||
'';
|
||||
postPatch = ''
|
||||
substituteInPlace examples/Makefile \
|
||||
--replace-fail "-Wall -Werror" ""
|
||||
'';
|
||||
|
||||
buildInputs = [
|
||||
libbpf
|
||||
libelf
|
||||
libsystemtap
|
||||
libz
|
||||
buildInputs = [
|
||||
libbpf
|
||||
libelf
|
||||
libsystemtap
|
||||
libz
|
||||
];
|
||||
|
||||
CGO_LDFLAGS = "-l bpf";
|
||||
|
||||
hardeningDisable = [ "zerocallusedregs" ];
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
"-X github.com/prometheus/common/version.Version=${finalAttrs.version}"
|
||||
"-X github.com/prometheus/common/version.Revision=${finalAttrs.src.tag}"
|
||||
"-X github.com/prometheus/common/version.Branch=${finalAttrs.src.tag}"
|
||||
"-X github.com/prometheus/common/version.BuildUser=nix@nixpkgs"
|
||||
"-X github.com/prometheus/common/version.BuildDate=unknown"
|
||||
];
|
||||
|
||||
postBuild = ''
|
||||
BUILD_LIBBPF=0 make examples
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p $out/examples
|
||||
mv examples/*.o examples/*.yaml $out/examples
|
||||
'';
|
||||
|
||||
# Tests fail on trying to access cgroups.
|
||||
doCheck = false;
|
||||
|
||||
doInstallCheck = true;
|
||||
nativeInstallCheckInputs = [ versionCheckHook ];
|
||||
versionCheckProgramArg = "--version";
|
||||
|
||||
passthru = {
|
||||
updateScript = nix-update-script { };
|
||||
tests = { inherit (nixosTests.prometheus-exporters) ebpf; };
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Prometheus exporter for custom eBPF metrics";
|
||||
mainProgram = "ebpf_exporter";
|
||||
homepage = "https://github.com/cloudflare/ebpf_exporter";
|
||||
changelog = "https://github.com/cloudflare/ebpf_exporter/releases/tag/${finalAttrs.src.tag}";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [
|
||||
jpds
|
||||
stepbrobd
|
||||
];
|
||||
|
||||
CGO_LDFLAGS = "-l bpf";
|
||||
|
||||
hardeningDisable = [ "zerocallusedregs" ];
|
||||
|
||||
# Tests fail on trying to access cgroups.
|
||||
doCheck = false;
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
"-X github.com/prometheus/common/version.Version=${version}"
|
||||
"-X github.com/prometheus/common/version.Revision=${tag}"
|
||||
"-X github.com/prometheus/common/version.Branch=unknown"
|
||||
"-X github.com/prometheus/common/version.BuildUser=nix@nixpkgs"
|
||||
"-X github.com/prometheus/common/version.BuildDate=unknown"
|
||||
];
|
||||
|
||||
postBuild = ''
|
||||
BUILD_LIBBPF=0 make examples
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p $out/examples
|
||||
mv examples/*.o examples/*.yaml $out/examples
|
||||
'';
|
||||
|
||||
passthru.tests = { inherit (nixosTests.prometheus-exporters) ebpf; };
|
||||
|
||||
meta = {
|
||||
description = "Prometheus exporter for custom eBPF metrics";
|
||||
mainProgram = "ebpf_exporter";
|
||||
homepage = "https://github.com/cloudflare/ebpf_exporter";
|
||||
changelog = "https://github.com/cloudflare/ebpf_exporter/releases/tag/v${tag}";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ jpds ];
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user