import grafana-pcp-3.2.0-2.el9_0

This commit is contained in:
CentOS Sources 2022-05-17 04:47:36 -04:00 committed by Stepan Oksanichenko
commit 905f1029e6
7 changed files with 486 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
SOURCES/grafana-pcp-3.2.0.tar.gz
SOURCES/grafana-pcp-vendor-3.2.0-1.tar.xz
SOURCES/grafana-pcp-webpack-3.2.0-1.tar.gz

3
.grafana-pcp.metadata Normal file
View File

@ -0,0 +1,3 @@
7819dc1ba2fce0cc82ee4a3fb6729c3e527def16 SOURCES/grafana-pcp-3.2.0.tar.gz
10dac7852a8a4ba901344a4467c2ad60079cbff6 SOURCES/grafana-pcp-vendor-3.2.0-1.tar.xz
977e3be2161e3b288c6be1932bf8d1c5c01fff14 SOURCES/grafana-pcp-webpack-3.2.0-1.tar.gz

View File

@ -0,0 +1,28 @@
diff --git a/package.json b/package.json
index 698043c..d9f0f44 100644
--- a/package.json
+++ b/package.json
@@ -70,6 +70,8 @@
"redux-thunk": "^2.3.0"
},
"resolutions": {
+ "crypto-browserify": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz",
+ "http-signature": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz",
"monaco-editor": "0.20.0",
"rxjs": "6.6.3"
},
diff --git a/webpack.config.js b/webpack.config.js
index ae72fd8..529d6bf 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -89,6 +89,10 @@ module.exports.getWebpackConfig = (config, options) => {
...config.module,
rules: removeDataTestAttributeInProduction(options.production, excludeExtractionLoaderForMonaco(config.module.rules)),
},
+ node: {
+ ...config.node,
+ crypto: false
+ },
plugins: [
...updateForkTsCheckerPluginSettings(config.plugins),
new MonacoWebpackPlugin({

74
SOURCES/Makefile Normal file
View File

@ -0,0 +1,74 @@
VERSION := $(shell rpm --specfile *.spec --qf '%{VERSION}\n' | head -1)
RELEASE := $(shell rpm --specfile *.spec --qf '%{RELEASE}\n' | head -1 | cut -d. -f1)
NAME := grafana-pcp
RPM_NAME := $(NAME)
SOURCE_DIR := $(NAME)-$(VERSION)
SOURCE_TAR := $(NAME)-$(VERSION).tar.gz
VENDOR_TAR := $(RPM_NAME)-vendor-$(VERSION)-$(RELEASE).tar.xz
WEBPACK_TAR := $(RPM_NAME)-webpack-$(VERSION)-$(RELEASE).tar.gz
# patches which must be applied before creating the vendor tarball, for example:
# - changes in dependency versions
# - changes in Go module imports (which affect the vendored Go modules)
PATCHES_PRE_VENDOR := \
001-remove-unused-frontend-crypto.patch
# patches which must be applied before creating the webpack, for example:
# - changes in Node.js sources or vendored dependencies
PATCHES_PRE_WEBPACK := \
001-remove-unused-frontend-crypto.patch
all: $(SOURCE_TAR) $(VENDOR_TAR) $(WEBPACK_TAR)
$(SOURCE_TAR):
spectool -g $(RPM_NAME).spec
$(VENDOR_TAR): $(SOURCE_TAR)
# start with a clean state
rm -rf $(SOURCE_DIR)
tar xf $(SOURCE_TAR)
# Patches to apply before vendoring
for patch in $(PATCHES_PRE_VENDOR); do echo applying $$patch ...; patch -d $(SOURCE_DIR) -p1 --fuzz=0 < $$patch; done
# Go
cd $(SOURCE_DIR) && go mod vendor -v
awk '$$2~/^v/ && $$4 != "indirect" {print "Provides: bundled(golang(" $$1 ")) = " substr($$2, 2)}' $(SOURCE_DIR)/go.mod | \
sed -E 's/=(.*)-(.*)-(.*)/=\1-\2.\3/g' > $@.manifest
# Node.js
cd $(SOURCE_DIR) && yarn install --pure-lockfile
# Remove files with licensing issues
find $(SOURCE_DIR) -type d -name 'node-notifier' -prune -exec rm -r {} \;
find $(SOURCE_DIR) -type f -name '*.exe' -delete
# Remove not required packages
rm -r $(SOURCE_DIR)/node_modules/puppeteer
./list_bundled_nodejs_packages.py $(SOURCE_DIR) >> $@.manifest
# Jsonnet
cd $(SOURCE_DIR) && jb --jsonnetpkg-home=vendor_jsonnet install
# Create tarball
XZ_OPT=-9 time -p tar cJf $@ \
$(SOURCE_DIR)/vendor \
$(SOURCE_DIR)/node_modules \
$(SOURCE_DIR)/vendor_jsonnet
$(WEBPACK_TAR): $(VENDOR_TAR)
# start with a clean state
rm -rf $(SOURCE_DIR)
tar xf $(SOURCE_TAR)
tar xf $(VENDOR_TAR)
# Patches to apply before creating the webpack
for patch in $(PATCHES_PRE_WEBPACK); do echo applying $$patch ...; patch -d $(SOURCE_DIR) -p1 --fuzz=0 < $$patch; done
cd $(SOURCE_DIR) && \
../build_frontend.sh
tar cfz $@ $(SOURCE_DIR)/dist
clean:
rm -rf *.tar.gz *.tar.xz *.manifest *.rpm $(NAME)-*/

10
SOURCES/build_frontend.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash -eu
# Build the frontend
yarn run build
# Build the dashboards
make build-dashboards
# Fix permissions (webpack sometimes outputs files with mode = 666 due to reasons unknown (race condition/umask issue afaics))
chmod -R g-w,o-w dist

View File

@ -0,0 +1,47 @@
#!/usr/bin/env python3
#
# generates Provides: bundled(npm(...)) = ... lines for each declared dependency and devDependency of package.json
#
import sys
import json
import re
from packaging import version
def read_declared_pkgs(package_json_path):
with open(package_json_path) as f:
package_json = json.load(f)
return list(package_json['dependencies'].keys()) + list(package_json['devDependencies'].keys())
def read_installed_pkgs(yarn_lock_path):
with open(yarn_lock_path) as f:
lockfile = f.read()
return re.findall(r'^"?' # can start with a "
r'(.+?)@.+(?:,.*)?:\n' # characters up to @
r' version "(.+)"', # and the version
lockfile, re.MULTILINE)
def list_provides(declared_pkgs, installed_pkgs):
for declared_pkg in declared_pkgs:
# there can be multiple versions installed of one package (transitive dependencies)
# but rpm doesn't support Provides: with a single package and multiple versions
# so let's declare the oldest version here
versions = [version.parse(pkg_version)
for pkg_name, pkg_version in installed_pkgs if pkg_name == declared_pkg]
oldest_version = sorted(versions)[0]
yield f"Provides: bundled(npm({declared_pkg})) = {oldest_version}"
if __name__ == "__main__":
if len(sys.argv) != 2:
print(f"usage: {sys.argv[0]} package-X.Y.Z/", file=sys.stdout)
sys.exit(1)
package_dir = sys.argv[1]
declared_pkgs = read_declared_pkgs(f"{package_dir}/package.json")
installed_pkgs = read_installed_pkgs(f"{package_dir}/yarn.lock")
provides = list_provides(declared_pkgs, installed_pkgs)
for provide in sorted(provides):
print(provide)

321
SPECS/grafana-pcp.spec Normal file
View File

@ -0,0 +1,321 @@
# gobuild and gotest macros are not available on CentOS Stream
# remove once BZ 1965292 is resolved
# definitions lifted from Fedora 34 podman.spec
%if ! 0%{?gobuild:1}
%define gobuild(o:) GO111MODULE=off go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" -a -v -x %{?**};
%endif
%if ! 0%{?gotest:1}
%define gotest() GO111MODULE=off go test -buildmode pie -compiler gc -ldflags "${LDFLAGS:-} -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" %{?**};
%endif
%global grafanapcp_arches %{lua: go_arches = {}
for arch in rpm.expand("%{go_arches}"):gmatch("%S+") do
go_arches[arch] = 1
end
for arch in rpm.expand("%{nodejs_arches}"):gmatch("%S+") do
if go_arches[arch] then
print(arch .. " ")
end
end}
# Specify if the frontend and dashboards will be compiled as part of the build or are attached
# as a webpack tarball (in case of an unsuitable nodejs or jsonnet version on the build system)
%define compile_frontend 0
Name: grafana-pcp
Version: 3.2.0
Release: 2%{?dist}
Summary: Performance Co-Pilot Grafana Plugin
License: ASL 2.0
URL: https://github.com/performancecopilot/grafana-pcp
Source0: https://github.com/performancecopilot/grafana-pcp/archive/v%{version}/%{name}-%{version}.tar.gz
Source1: grafana-pcp-vendor-%{version}-1.tar.xz
# Note: In case there were no changes to this tarball, the NVR of this tarball
# lags behind the NVR of this package.
%if %{compile_frontend} == 0
# Source2 contains the precompiled frontend and dashboards
# Note: In case there were no changes to this tarball, the NVR of this tarball
# lags behind the NVR of this package.
Source2: grafana-pcp-webpack-%{version}-1.tar.gz
%endif
Source3: Makefile
Source4: build_frontend.sh
Source5: list_bundled_nodejs_packages.py
Patch1: 001-remove-unused-frontend-crypto.patch
# Intersection of go_arches and nodejs_arches
ExclusiveArch: %{grafanapcp_arches}
BuildRequires: systemd-rpm-macros, golang, go-srpm-macros
%if 0%{?fedora} >= 31
BuildRequires: go-rpm-macros
%endif
%if %{compile_frontend}
BuildRequires: make, nodejs >= 1:14, yarnpkg, golang-github-google-jsonnet
%endif
# omit golang debugsource, see BZ 995136 and related
%global dwz_low_mem_die_limit 0
%global _debugsource_template %{nil}
%global install_dir %{_sharedstatedir}/grafana/plugins/performancecopilot-pcp-app
Requires: grafana >= 7.5.9
Suggests: pcp >= 5.2.2
Suggests: redis >= 5.0.0
Suggests: bpftrace >= 0.9.2
# Obsolete old webapps
Obsoletes: pcp-webjs <= 4.3.4
Obsoletes: pcp-webapp-blinkenlights <= 4.3.4
Obsoletes: pcp-webapp-grafana <= 4.3.4
Obsoletes: pcp-webapp-graphite <= 4.3.4
Obsoletes: pcp-webapp-vector <= 4.3.4
# vendored golang and node.js build dependencies
# this is for security purposes, if nodejs-foo ever needs an update,
# affected packages can be easily identified.
# Note: generated by the Makefile (see README.md)
Provides: bundled(golang(github.com/grafana/grafana-plugin-sdk-go)) = 0.115.0
Provides: bundled(golang(github.com/stretchr/testify)) = 1.7.0
Provides: bundled(npm(@babel/plugin-transform-modules-commonjs)) = 7.16.0
Provides: bundled(npm(@grafana/data)) = 7.5.11
Provides: bundled(npm(@grafana/runtime)) = 7.5.11
Provides: bundled(npm(@grafana/toolkit)) = 7.5.11
Provides: bundled(npm(@grafana/ui)) = 7.5.11
Provides: bundled(npm(@testing-library/jest-dom)) = 5.4.0
Provides: bundled(npm(@testing-library/react)) = 10.4.9
Provides: bundled(npm(@types/blueimp-md5)) = 2.18.0
Provides: bundled(npm(@types/d3-selection)) = 1.4.3
Provides: bundled(npm(@types/enzyme)) = 3.10.8
Provides: bundled(npm(@types/enzyme-adapter-react-16)) = 1.0.6
Provides: bundled(npm(@types/expect-puppeteer)) = 3.3.1
Provides: bundled(npm(@types/jest)) = 26.0.15
Provides: bundled(npm(@types/jest-environment-puppeteer)) = 4.4.1
Provides: bundled(npm(@types/lodash)) = 4.14.176
Provides: bundled(npm(@types/memoize-one)) = 5.1.2
Provides: bundled(npm(@types/react-autosuggest)) = 9.3.14
Provides: bundled(npm(@types/react-redux)) = 7.1.20
Provides: bundled(npm(@types/redux)) = 3.6.0
Provides: bundled(npm(@types/redux-persist)) = 4.3.1
Provides: bundled(npm(@types/redux-persist-transform-filter)) = 0.0.4
Provides: bundled(npm(babel-plugin-remove-object-properties)) = 1.0.2
Provides: bundled(npm(blueimp-md5)) = 2.19.0
Provides: bundled(npm(core-js)) = 2.6.12
Provides: bundled(npm(d3-flame-graph)) = 3.1.1
Provides: bundled(npm(d3-selection)) = 1.4.2
Provides: bundled(npm(emotion)) = 10.0.27
Provides: bundled(npm(enzyme)) = 3.11.0
Provides: bundled(npm(enzyme-adapter-react-16)) = 1.15.6
Provides: bundled(npm(eslint-plugin-prettier)) = 3.3.1
Provides: bundled(npm(jest-date-mock)) = 1.0.8
Provides: bundled(npm(jest-puppeteer)) = 5.0.4
Provides: bundled(npm(lodash)) = 4.17.21
Provides: bundled(npm(loglevel)) = 1.7.1
Provides: bundled(npm(loglevel-plugin-prefix)) = 0.8.4
Provides: bundled(npm(memoize-one)) = 4.1.0
Provides: bundled(npm(monaco-editor)) = 0.20.0
Provides: bundled(npm(monaco-editor-webpack-plugin)) = 1.9.0
Provides: bundled(npm(prettier-plugin-organize-imports)) = 2.3.4
Provides: bundled(npm(puppeteer)) = 10.4.0
Provides: bundled(npm(react-autosuggest)) = 10.1.0
Provides: bundled(npm(react-monaco-editor)) = 0.36.0
Provides: bundled(npm(react-redux)) = 7.2.6
Provides: bundled(npm(react-use)) = 15.3.8
Provides: bundled(npm(redux)) = 3.7.2
Provides: bundled(npm(redux-persist)) = 4.10.2
Provides: bundled(npm(redux-thunk)) = 2.4.0
Provides: bundled(npm(utility-types)) = 3.10.0
%description
This Grafana plugin for Performance Co-Pilot includes datasources for
scalable time series from pmseries(1) and Redis, live PCP metrics and
bpftrace scripts from pmdabpftrace(1), as well as several dashboards.
%prep
%setup -q -T -D -b 0
%setup -q -T -D -b 1
%if %{compile_frontend} == 0
%setup -q -T -D -b 2
%endif
%patch1 -p1
# Set up Go build subdir and links
mkdir -p %{_builddir}/src/github.com/performancecopilot
ln -s %{_builddir}/%{name}-%{version} \
%{_builddir}/src/github.com/performancecopilot/grafana-pcp
%build
# Build frontend datasources
%if %{compile_frontend}
%{SOURCE4}
%endif
# Build backend datasource
cd %{_builddir}/src/github.com/performancecopilot/grafana-pcp
export GOPATH=%{_builddir}
%gobuild -o dist/datasources/redis/pcp_redis_datasource_$(go env GOOS)_$(go env GOARCH) ./pkg
%install
install -d -m 755 %{buildroot}/%{install_dir}
cp -a dist/* %{buildroot}/%{install_dir}
%postun
# uninstall of old package
%systemd_postun_with_restart grafana-server.service
%posttrans
# install or upgrade of new package
if [ -x /usr/bin/systemctl ]; then
/usr/bin/systemctl try-restart grafana-server.service || :
fi
%check
# Test frontend datasources
%if %{compile_frontend}
yarn test
%endif
# Test backend datasource
cd %{_builddir}/src/github.com/performancecopilot/grafana-pcp
export GOPATH=%{_builddir}
%gotest ./pkg/...
%files
%{install_dir}
%license LICENSE NOTICE
%doc README.md
%changelog
* Fri Mar 18 2022 Andreas Gerstmayr <agerstmayr@redhat.com> 3.2.0-2
- resolves rhbz#1975396
* Fri Nov 12 2021 Andreas Gerstmayr <agerstmayr@redhat.com> 3.2.0-1
- update to 3.2.0 tagged upstream community sources, see CHANGELOG
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 3.1.0-2
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Fri Jun 25 2021 Andreas Gerstmayr <agerstmayr@redhat.com> 3.1.0-1
- update to 3.1.0 tagged upstream community sources, see CHANGELOG
- remove unused cryptographic implementations
* Tue Jun 22 2021 Mohan Boddu <mboddu@redhat.com> - 3.0.2-4
- Rebuilt for RHEL 9 BETA for openssl 3.0
Related: rhbz#1971065
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 3.0.2-3
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Fri Jan 22 2021 Andreas Gerstmayr <agerstmayr@redhat.com> 3.0.2-1
- update to 3.0.2 tagged upstream community sources, see CHANGELOG
* Wed Dec 23 2020 Andreas Gerstmayr <agerstmayr@redhat.com> 3.0.1-1
- update to 3.0.1 tagged upstream community sources, see CHANGELOG
* Thu Nov 26 2020 Andreas Gerstmayr <agerstmayr@redhat.com> 3.0.0-1
- update to 3.0.0 tagged upstream community sources, see CHANGELOG
- bundle golang dependencies and (optionally) node.js dependencies
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Feb 25 2020 Andreas Gerstmayr <agerstmayr@redhat.com> 2.0.2-1
- vector, redis: remove autocompletion cache (PCP metrics can be added and removed dynamically)
* Thu Feb 20 2020 Andreas Gerstmayr <agerstmayr@redhat.com> 2.0.1-1
- support for Grafana 6.6+, drop support for Grafana < 6.6
- vector, bpftrace: fix version checks on dashboard load (prevent multiple pmcd.version checks on dashboard load)
- vector, bpftrace: change datasource check box to red if URL is inaccessible
- redis: add tests
- flame graphs: support multidimensional eBPF maps (required to display e.g. the process name)
- dashboards: remove BCC metrics from Vector host overview (because the BCC PMDA is not installed by default)
- misc: update dependencies
- build: fix production build (implement workaround for https://github.com/systemjs/systemjs/issues/2117, https://github.com/grafana/grafana/issues/21785)
* Wed Jan 29 2020 Andreas Gerstmayr <agerstmayr@redhat.com> 1.0.7-1
- redis: fix timespec (fixes empty graphs for large time ranges)
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Tue Jan 07 2020 Andreas Gerstmayr <agerstmayr@redhat.com> 1.0.6-1
- redis: support wildcards in metric names
- redis: fix label support
- redis: fix legends
- redis: set default sample interval to 60s (fixes empty graph borders)
- build: upgrade copy-webpack-plugin to mitigate XSS vulnerability in the serialize-javascript transitive dependency
- build: remove deprecated uglify-webpack-plugin
* Thu Dec 12 2019 Andreas Gerstmayr <agerstmayr@redhat.com> 1.0.4-2
- remove node_modules/node-notifier directory from webpack (due to licensing issues)
* Wed Dec 11 2019 Andreas Gerstmayr <agerstmayr@redhat.com> 1.0.4-1
- flame graphs: clean flame graph stacks every 5s (reduces CPU load)
- general: implement PCP version checks
- build: remove weak dependency (doesn't work with Node.js 12)
- build: upgrade terser-webpack-plugin to mitigate XSS vulnerability in the serialize-javascript transitive dependency
* Tue Nov 26 2019 Nathan Scott <nathans@redhat.com> 1.0.3-1
- fix flame graph dependency (flamegraph.destroy error in javascript console)
* Tue Nov 12 2019 Andreas Gerstmayr <agerstmayr@redhat.com> 1.0.2-1
- handle counter wraps (overflows)
- convert time based counters to time utilization
- flame graphs: aggregate stack counts by selected time range in the Grafana UI
- flame graphs: add option to hide idle stacks
- vector: fix container dropdown in query editor
- vector: remove container setting from datasource settings page
- redis: fix value transformations (e.g. rate conversation of counters)
- request more datapoints from the datasource to fill the borders of the graph panel
* Fri Oct 11 2019 Andreas Gerstmayr <agerstmayr@redhat.com> 1.0.0-1
- bpftrace: support for Flame Graphs
- bpftrace: context-sensitive auto completion for bpftrace probes, builtin variables and functions incl. help texts
- bpftrace: parse output of bpftrace scripts (e.g. using `printf()`) as CSV and display it in the Grafana table panel
- bpftrace: sample dashboards (BPFtrace System Analysis, BPFtrace Flame Graphs)
- vector: table output: show instance name in left column
- vector: table output: support non-matching instance names (cells of metrics which don't have the specific instance will be blank)
- vector & bpftrace: if the metric/script gets changed in the query editor, immeditately stop polling the old metric/deregister the old script
- vector & bpftrace: improve pmwebd compatibility
- misc: help texts for all datasources (visible with the **[ ? ]** button in the query editor)
- misc: renamed PCP Live to PCP Vector
- misc: logos for all datasources
- misc: improved error handling
* Fri Aug 16 2019 Andreas Gerstmayr <agerstmayr@redhat.com> 0.0.7-1
- converted into a Grafana app plugin, renamed to grafana-pcp
- redis: support for instance domains, labels, autocompletion, automatic rate conversation
- live and bpftrace: initial commit of datasources
* Tue Jun 11 2019 Mark Goodwin <mgoodwin@redhat.com> 0.0.6-1
- renamed package to grafana-pcp-redis, updated README, etc
* Wed Jun 05 2019 Mark Goodwin <mgoodwin@redhat.com> 0.0.5-1
- renamed package to grafana-pcp-datasource, README, etc
* Fri May 17 2019 Mark Goodwin <mgoodwin@redhat.com> 0.0.4-1
- add suggested pmproxy URL in config html
- updated instructions and README.md now that grafana is in Fedora
* Fri Apr 12 2019 Mark Goodwin <mgoodwin@redhat.com> 0.0.3-1
- require grafana v6.1.3 or later
- install directory is now below /var/lib/grafana/plugins
* Wed Mar 20 2019 Mark Goodwin <mgoodwin@redhat.com> 0.0.2-1
- initial version