Merge pull request #168706 from roidelapluie/update-prometheus

Prometheus: 2.30.3 -> 2.35.0
This commit is contained in:
Maximilian Bosch 2022-04-28 12:19:28 +02:00 committed by GitHub
commit 19f9d47e9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 59 additions and 98239 deletions

View file

@ -2,13 +2,10 @@
, lib , lib
, go , go
, pkgs , pkgs
, nodejs-14_x
, nodePackages
, buildGoModule , buildGoModule
, fetchFromGitHub , fetchFromGitHub
, mkYarnPackage , fetchurl
, nixosTests , nixosTests
, fetchpatch
, enableAWS ? true , enableAWS ? true
, enableAzure ? true , enableAzure ? true
, enableConsul ? true , enableConsul ? true
@ -30,131 +27,82 @@
}: }:
let let
version = "2.30.3"; version = "2.35.0";
webUiStatic = fetchurl {
url = "https://github.com/prometheus/prometheus/releases/download/v${version}/prometheus-web-ui-${version}.tar.gz";
sha256 = "sha256-66zWOjFTYwmspiKeklt3NAAT1uJJrZqeyQvWWsCN9fQ=";
};
in
buildGoModule rec {
pname = "prometheus";
inherit version;
src = fetchFromGitHub { src = fetchFromGitHub {
rev = "v${version}"; rev = "v${version}";
owner = "prometheus"; owner = "prometheus";
repo = "prometheus"; repo = "prometheus";
sha256 = "1as6x5bsp7mxa4rp7jhyjlpcvzqm1zngnwvp73rc4rwhz8w8vm3k"; sha256 = "sha256-h0uBs3xMKpRH3A1VG5xrhjXVAT7GL5L3UZWb3HJ2Fz4=";
}; };
goPackagePath = "github.com/prometheus/prometheus"; vendorSha256 = "sha256-0I6hmjhdfB41rWOQ9FM9CMq5w5437ka/jLuFXcBQBlM=";
codemirrorNode = import ./webui/codemirror-promql {
inherit pkgs;
nodejs = nodejs-14_x;
inherit (stdenv.hostPlatform) system;
};
webuiNode = import ./webui/webui {
inherit pkgs;
nodejs = nodejs-14_x;
inherit (stdenv.hostPlatform) system;
};
codemirror = stdenv.mkDerivation {
name = "prometheus-webui-codemirror-promql";
src = "${src}/web/ui/module/codemirror-promql";
buildInputs = [ nodejs-14_x nodePackages.typescript codemirrorNode.nodeDependencies ];
configurePhase = ''
ln -s ${codemirrorNode.nodeDependencies}/lib/node_modules node_modules
'';
buildPhase = ''
PUBLIC_URL=. npm run build
'';
installPhase = ''
mkdir -p $out
mv lib dist $out
'';
distPhase = ":";
};
webui = stdenv.mkDerivation {
name = "prometheus-webui";
src = "${src}/web/ui/react-app";
buildInputs = [ nodejs-14_x webuiNode.nodeDependencies ];
# create `node_modules/.cache` dir (we need writeable .cache)
# and then copy the rest over.
configurePhase = ''
mkdir -p node_modules/{.cache,.bin}
cp -a ${webuiNode.nodeDependencies}/lib/node_modules/. node_modules
'';
buildPhase = "PUBLIC_URL=. npm run build";
installPhase = "mv build $out";
distPhase = "true";
};
in
buildGoModule rec {
pname = "prometheus";
inherit src version;
vendorSha256 = "0qyv8vybx5wg8k8hwvrpp4hz9wv6g4kf9sq5v5qc2bxx6apc0s9r";
excludedPackages = [ "documentation/prometheus-mixin" ]; excludedPackages = [ "documentation/prometheus-mixin" ];
nativeBuildInputs = [ nodejs-14_x ];
postPatch = '' postPatch = ''
# we don't want this anyways, as we tar -C web/ui -xzf ${webUiStatic}
# build modules for them
echo "exit 0" > web/ui/module/build.sh
ln -s ${webuiNode.nodeDependencies}/lib/node_modules web/ui/react-app/node_modules patchShebangs scripts
ln -s ${webui} web/ui/static/react
# webui-codemirror # Enable only select service discovery to shrink binaries.
ln -s ${codemirror}/dist web/ui/module/codemirror-promql/dist (
ln -s ${codemirror}/lib web/ui/module/codemirror-promql/lib ${lib.optionalString (enableAWS)
"echo - github.com/prometheus/prometheus/discovery/aws"}
${lib.optionalString (enableAzure)
"echo - github.com/prometheus/prometheus/discovery/azure"}
${lib.optionalString (enableConsul)
"echo - github.com/prometheus/prometheus/discovery/consul"}
${lib.optionalString (enableDigitalOcean)
"echo - github.com/prometheus/prometheus/discovery/digitalocean"}
${lib.optionalString (enableEureka)
"echo - github.com/prometheus/prometheus/discovery/eureka"}
${lib.optionalString (enableGCE)
"echo - github.com/prometheus/prometheus/discovery/gce"}
${lib.optionalString (enableHetzner)
"echo - github.com/prometheus/prometheus/discovery/hetzner"}
${lib.optionalString (enableKubernetes)
"echo - github.com/prometheus/prometheus/discovery/kubernetes"}
${lib.optionalString (enableLinode)
"echo - github.com/prometheus/prometheus/discovery/linode"}
${lib.optionalString (enableMarathon)
"echo - github.com/prometheus/prometheus/discovery/marathon"}
${lib.optionalString (enableMoby)
"echo - github.com/prometheus/prometheus/discovery/moby"}
${lib.optionalString (enableOpenstack)
"echo - github.com/prometheus/prometheus/discovery/openstack"}
${lib.optionalString (enablePuppetDB)
"echo - github.com/prometheus/prometheus/discovery/puppetdb"}
${lib.optionalString (enableScaleway)
"echo - github.com/prometheus/prometheus/discovery/scaleway"}
${lib.optionalString (enableTriton)
"echo - github.com/prometheus/prometheus/discovery/triton"}
${lib.optionalString (enableUyuni)
"echo - github.com/prometheus/prometheus/discovery/uyuni"}
${lib.optionalString (enableXDS)
"echo - github.com/prometheus/prometheus/discovery/xds"}
${lib.optionalString (enableZookeeper)
"echo - github.com/prometheus/prometheus/discovery/zookeeper"}
) > plugins.yml
'';
# Disable some service discovery to shrink binaries. preBuild = ''
${lib.optionalString (!enableAWS) if [[ -d vendor ]]; then make -o assets assets-compress plugins; fi
"sed -i -e '/register aws/d' discovery/install/install.go"}
${lib.optionalString (!enableAzure)
"sed -i -e '/register azure/d' discovery/install/install.go"}
${lib.optionalString (!enableConsul)
"sed -i -e '/register consul/d' discovery/install/install.go"}
${lib.optionalString (!enableDigitalOcean)
"sed -i -e '/register digitalocean/d' discovery/install/install.go"}
${lib.optionalString (!enableEureka)
"sed -i -e '/register eureka/d' discovery/install/install.go"}
${lib.optionalString (!enableGCE)
"sed -i -e '/register gce/d' discovery/install/install.go"}
${lib.optionalString (!enableHetzner)
"sed -i -e '/register hetzner/d' discovery/install/install.go"}
${lib.optionalString (!enableKubernetes)
"sed -i -e '/register kubernetes/d' discovery/install/install.go"}
${lib.optionalString (!enableLinode)
"sed -i -e '/register linode/d' discovery/install/install.go"}
${lib.optionalString (!enableMarathon)
"sed -i -e '/register marathon/d' discovery/install/install.go"}
${lib.optionalString (!enableMoby)
"sed -i -e '/register moby/d' discovery/install/install.go"}
${lib.optionalString (!enableOpenstack)
"sed -i -e '/register openstack/d' discovery/install/install.go"}
${lib.optionalString (!enablePuppetDB)
"sed -i -e '/register puppetdb/d' discovery/install/install.go"}
${lib.optionalString (!enableScaleway)
"sed -i -e '/register scaleway/d' discovery/install/install.go"}
${lib.optionalString (!enableTriton)
"sed -i -e '/register triton/d' discovery/install/install.go"}
${lib.optionalString (!enableUyuni)
"sed -i -e '/register uyuni/d' discovery/install/install.go"}
${lib.optionalString (!enableXDS)
"sed -i -e '/register xds/d' discovery/install/install.go"}
${lib.optionalString (!enableZookeeper)
"sed -i -e '/register zookeeper/d' discovery/install/install.go"}
''; '';
tags = [ "builtinassets" ]; tags = [ "builtinassets" ];
ldflags = ldflags =
let let
t = "${goPackagePath}/vendor/github.com/prometheus/common/version"; t = "github.com/prometheus/common/version";
in in
[ [
"-X ${t}.Version=${version}" "-X ${t}.Version=${version}"
@ -165,20 +113,13 @@ buildGoModule rec {
"-X ${t}.GoVersion=${lib.getVersion go}" "-X ${t}.GoVersion=${lib.getVersion go}"
]; ];
# only run this in the real build, not during the vendor build
# this should probably be fixed in buildGoModule
preBuild = ''
if [ -d vendor ]; then make assets; fi
'';
preInstall = '' preInstall = ''
mkdir -p "$out/share/doc/prometheus" "$out/etc/prometheus" mkdir -p "$out/share/doc/prometheus" "$out/etc/prometheus"
cp -a $src/documentation/* $out/share/doc/prometheus cp -a $src/documentation/* $out/share/doc/prometheus
cp -a $src/console_libraries $src/consoles $out/etc/prometheus cp -a $src/console_libraries $src/consoles $out/etc/prometheus
''; '';
# doCheck = !stdenv.isDarwin; # https://hydra.nixos.org/build/130673870/nixlog/1 doCheck = !stdenv.isDarwin; # https://hydra.nixos.org/build/130673870/nixlog/1
doCheck = false;
passthru.tests = { inherit (nixosTests) prometheus; }; passthru.tests = { inherit (nixosTests) prometheus; };

View file

@ -1,17 +0,0 @@
# This file has been generated by node2nix 1.9.0. Do not edit!
{pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-12_x"}:
let
nodeEnv = import ../../../../../development/node-packages/node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
inherit pkgs nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
};
in
import ./node-packages.nix {
inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
inherit nodeEnv;
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,93 +0,0 @@
{
"name": "codemirror-promql",
"version": "0.17.0",
"description": "a CodeMirror mode for the PromQL language",
"main": "cjs/index.js",
"module": "esm/index.js",
"scripts": {
"start": "webpack-dev-server --config webpack.config.cjs --open",
"build": "npm run build:grammar && npm run build:lib && npm run build:app",
"build:grammar": "lezer-generator src/lang-promql/grammar/promql.grammar -o src/lang-promql/grammar/parser",
"build:lib": "bash ./build.sh",
"build:app": "webpack --config webpack.config.cjs",
"test": "npm run build:grammar && ts-mocha -p tsconfig.json src/**/*.test.ts",
"test-coverage": "npm run build:grammar && nyc ts-mocha -p ./tsconfig.json ./**/*.test.ts",
"codecov": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
"lint": "eslint src/ --ext .ts",
"lint:fix": "eslint --fix src/ --ext .ts"
},
"repository": {
"type": "git",
"url": "git+https://github.com/prometheus-community/codemirror-promql.git"
},
"keywords": [
"promql",
"codemirror",
"mode",
"prometheus"
],
"author": "Prometheus Authors <prometheus-developers@googlegroups.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/prometheus-community/codemirror-promql/issues"
},
"homepage": "https://github.com/prometheus-community/codemirror-promql/blob/master/README.md",
"dependencies": {
"lru-cache": "^6.0.0"
},
"devDependencies": {
"@codemirror/autocomplete": "^0.18.3",
"@codemirror/basic-setup": "^0.18.0",
"@codemirror/highlight": "^0.18.3",
"@codemirror/language": "^0.18.0",
"@codemirror/lint": "^0.18.1",
"@codemirror/state": "^0.18.2",
"@codemirror/view": "^0.18.1",
"@types/chai": "^4.2.12",
"@types/lru-cache": "^5.1.0",
"@types/mocha": "^8.0.3",
"@types/node": "^14.0.13",
"@typescript-eslint/eslint-plugin": "^2.22.0",
"@typescript-eslint/parser": "^2.22.0",
"chai": "^4.2.0",
"clean-webpack-plugin": "^3.0.0",
"codecov": "^3.8.1",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-prettier": "^3.1.4",
"html-webpack-plugin": "^4.3.0",
"isomorphic-fetch": "^3.0.0",
"lezer": "^0.13.1",
"lezer-generator": "^0.13.1",
"mocha": "^8.1.2",
"nock": "^13.0.11",
"nyc": "^15.1.0",
"prettier": "^2.0.5",
"ts-loader": "^7.0.4",
"ts-mocha": "^8.0.0",
"ts-node": "^9.0.0",
"typescript": "^4.2.3",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.11.0"
},
"peerDependencies": {
"@codemirror/autocomplete": "^0.18.3",
"@codemirror/highlight": "^0.18.3",
"@codemirror/language": "^0.18.0",
"@codemirror/lint": "^0.18.1",
"@codemirror/state": "^0.18.2",
"@codemirror/view": "^0.18.1",
"lezer": "^0.13.0"
},
"prettier": {
"singleQuote": true,
"trailingComma": "es5",
"printWidth": 150
},
"engines": {
"node": ">=12.0.0"
}
}

View file

@ -1,32 +0,0 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p nodePackages.node2nix
set -euo pipefail
if [[ "$#" -ne 1 || "$1" == -* ]]; then
echo "Regenerates the npm dependency lock files for the prometheus package."
echo "Usage: $0 <git release tag>"
exit 1
fi
update() {
RELEASE_TAG=$1
GIT_PATH=$2
OUTPUT_PATH=$3
NODE_ENV=$4
PROM_WEB_SRC="https://raw.githubusercontent.com/prometheus/prometheus/$1"
wget "$PROM_WEB_SRC/$GIT_PATH/package.json" -O package.json
wget "$PROM_WEB_SRC/$GIT_PATH/package-lock.json" -O package-lock.json
node2nix \
--lock package-lock.json \
--development \
--node-env $NODE_ENV \
--no-copy-node-env
mkdir -p $OUTPUT_PATH
mv default.nix node-packages.nix package.json package-lock.json $OUTPUT_PATH
}
update $1 "web/ui/module/codemirror-promql" "codemirror-promql" ../../../../../development/node-packages/node-env.nix
update $1 "web/ui/react-app" "webui" ../../../../../development/node-packages/node-env.nix

View file

@ -1,17 +0,0 @@
# This file has been generated by node2nix 1.9.0. Do not edit!
{pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-12_x"}:
let
nodeEnv = import ../../../../../development/node-packages/node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
inherit pkgs nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
};
in
import ./node-packages.nix {
inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
inherit nodeEnv;
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,109 +0,0 @@
{
"name": "graph",
"version": "0.1.0",
"private": true,
"dependencies": {
"@codemirror/autocomplete": "^0.18.3",
"@codemirror/closebrackets": "^0.18.0",
"@codemirror/commands": "^0.18.0",
"@codemirror/comment": "^0.18.0",
"@codemirror/highlight": "^0.18.3",
"@codemirror/history": "^0.18.0",
"@codemirror/language": "^0.18.0",
"@codemirror/lint": "^0.18.1",
"@codemirror/matchbrackets": "^0.18.0",
"@codemirror/search": "^0.18.2",
"@codemirror/state": "^0.18.2",
"@codemirror/view": "^0.18.3",
"@forevolve/bootstrap-dark": "^1.0.0",
"@fortawesome/fontawesome-svg-core": "^1.2.14",
"@fortawesome/free-solid-svg-icons": "^5.7.1",
"@fortawesome/react-fontawesome": "^0.1.4",
"@nexucis/fuzzy": "^0.3.0",
"bootstrap": "^4.6.0",
"codemirror-promql": "^0.17.0",
"css.escape": "^1.5.1",
"downshift": "^3.4.8",
"i": "^0.3.6",
"jquery": "^3.5.1",
"jquery.flot.tooltip": "^0.9.0",
"jsdom": "^16.4.0",
"moment": "^2.24.0",
"moment-timezone": "^0.5.23",
"popper.js": "^1.14.3",
"react": "^16.7.0",
"react-copy-to-clipboard": "^5.0.1",
"react-dom": "^16.7.0",
"react-resize-detector": "^5.0.7",
"react-router-dom": "^5.2.1",
"react-test-renderer": "^16.9.0",
"reactstrap": "^8.9.0",
"sanitize-html": "^2.3.3",
"sass": "1.39.0",
"tempusdominus-bootstrap-4": "^5.1.2",
"tempusdominus-core": "^5.0.3",
"use-media": "^1.4.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --runInBand --resetMocks=false",
"test:debug": "react-scripts --inspect-brk test --runInBand --no-cache",
"eject": "react-scripts eject",
"lint:ci": "eslint --quiet \"src/**/*.{ts,tsx}\"",
"lint": "eslint --fix \"src/**/*.{ts,tsx}\""
},
"prettier": {
"singleQuote": true,
"trailingComma": "es5",
"printWidth": 125
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"devDependencies": {
"@testing-library/react-hooks": "^3.1.1",
"@types/enzyme": "^3.10.3",
"@types/enzyme-adapter-react-16": "^1.0.5",
"@types/flot": "0.0.32",
"@types/jest": "^27.0.0",
"@types/jquery": "^3.5.1",
"@types/moment-timezone": "^0.5.10",
"@types/node": "^12.11.1",
"@types/react": "^16.8.2",
"@types/react-copy-to-clipboard": "^5.0.0",
"@types/react-dom": "^16.8.0",
"@types/react-resize-detector": "^5.0.0",
"@types/react-router-dom": "^5.1.8",
"@types/reactstrap": "^8.7.2",
"@types/sanitize-html": "^1.20.2",
"@types/sinon": "^9.0.4",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.15.1",
"enzyme-to-json": "^3.4.3",
"eslint-config-prettier": "^8.3.0",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-prettier": "^4.0.0",
"jest-fetch-mock": "^3.0.3",
"mutationobserver-shim": "^0.3.7",
"prettier": "^2.3.2",
"react-scripts": "4.0.3",
"sinon": "^9.0.3",
"typescript": "^4.4.2"
},
"proxy": "http://localhost:9090",
"jest": {
"snapshotSerializers": [
"enzyme-to-json/serializer"
],
"transformIgnorePatterns": [
"/node_modules/(?!codemirror-promql).+(js|jsx)$"
]
},
"optionalDependencies": {
"fsevents": "^2.3.2"
}
}

View file

@ -22293,7 +22293,7 @@ with pkgs;
postgresqlTestHook = callPackage ../build-support/setup-hooks/postgresql-test-hook { }; postgresqlTestHook = callPackage ../build-support/setup-hooks/postgresql-test-hook { };
prom2json = callPackage ../servers/monitoring/prometheus/prom2json.nix { }; prom2json = callPackage ../servers/monitoring/prometheus/prom2json.nix { };
prometheus = callPackage ../servers/monitoring/prometheus { }; prometheus = callPackage ../servers/monitoring/prometheus { buildGoModule = buildGo118Module; };
prometheus-alertmanager = callPackage ../servers/monitoring/prometheus/alertmanager.nix { }; prometheus-alertmanager = callPackage ../servers/monitoring/prometheus/alertmanager.nix { };
prometheus-apcupsd-exporter = callPackage ../servers/monitoring/prometheus/apcupsd-exporter.nix { }; prometheus-apcupsd-exporter = callPackage ../servers/monitoring/prometheus/apcupsd-exporter.nix { };
prometheus-artifactory-exporter = callPackage ../servers/monitoring/prometheus/artifactory-exporter.nix { }; prometheus-artifactory-exporter = callPackage ../servers/monitoring/prometheus/artifactory-exporter.nix { };