Blame SPECS/grafana-pcp.spec

1bbbef
# https://bugzilla.redhat.com/show_bug.cgi?id=1752991
1bbbef
# unfortunately the go_arches macro doesn't reflect that change yet
1bbbef
ExcludeArch: i686
1bbbef
1bbbef
%global grafanapcp_arches %{lua: go_arches = {}
1bbbef
  for arch in rpm.expand("%{go_arches}"):gmatch("%S+") do
1bbbef
    go_arches[arch] = 1
1bbbef
  end
1bbbef
  for arch in rpm.expand("%{nodejs_arches}"):gmatch("%S+") do
1bbbef
    if go_arches[arch] then
1bbbef
      print(arch .. " ")
1bbbef
  end
1bbbef
end}
1bbbef
1bbbef
# gobuild and gotest macros are defined in go-rpm-macros, which is not available on RHEL
1bbbef
# definitions lifted from Fedora 34 podman.spec
1bbbef
%if ! 0%{?gobuild:1}
1bbbef
%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 %{?**};
1bbbef
%endif
1bbbef
%if ! 0%{?gotest:1}
1bbbef
%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 '" %{?**};
1bbbef
%endif
1bbbef
1bbbef
# Specify if the frontend and dashboards will be compiled as part of the build or are attached
1bbbef
# as a webpack tarball (in case of an unsuitable nodejs or jsonnet version on the build system)
1bbbef
%define compile_frontend 0
1bbbef
8f9145
Name:           grafana-pcp
1bbbef
Version:        3.0.2
1bbbef
Release:        1%{?dist}
8f9145
Summary:        Performance Co-Pilot Grafana Plugin
8f9145
License:        ASL 2.0
1bbbef
URL:            https://github.com/performancecopilot/grafana-pcp
1bbbef
1bbbef
Source0:        https://github.com/performancecopilot/grafana-pcp/archive/v%{version}/%{name}-%{version}.tar.gz
1bbbef
Source1:        grafana-pcp-vendor-%{version}.tar.xz
1bbbef
%if %{compile_frontend} == 0
1bbbef
# Source2 contains the precompiled frontend and dashboards
1bbbef
Source2:        grafana-pcp-webpack-%{version}.tar.gz
1bbbef
%endif
1bbbef
Source3:        Makefile
1bbbef
Source4:        list_bundled_nodejs_packages.py
1bbbef
1bbbef
# Intersection of go_arches and nodejs_arches
1bbbef
ExclusiveArch:  %{grafanapcp_arches}
1bbbef
1bbbef
BuildRequires:  systemd-rpm-macros, golang, go-srpm-macros
1bbbef
%if 0%{?fedora} >= 31
1bbbef
BuildRequires:  go-rpm-macros
1bbbef
%endif
1bbbef
%if %{compile_frontend}
1bbbef
BuildRequires:  make, nodejs >= 1:12, nodejs < 1:13, yarnpkg, golang-github-google-jsonnet
1bbbef
%endif
1bbbef
1bbbef
# omit golang debugsource, see BZ 995136 and related
1bbbef
%global         dwz_low_mem_die_limit 0
1bbbef
%global         _debugsource_template %{nil}
1bbbef
1bbbef
%global         install_dir %{_sharedstatedir}/grafana/plugins/performancecopilot-pcp-app
1bbbef
1bbbef
Requires:       grafana >= 7.3.6
1bbbef
Suggests:       pcp >= 5.2.2
8f9145
Suggests:       redis >= 5.0.0
8f9145
Suggests:       bpftrace >= 0.9.2
8f9145
8f9145
# Obsolete old webapps
44cbad
Obsoletes: pcp-webjs <= 4.3.4
44cbad
Obsoletes: pcp-webapp-blinkenlights <= 4.3.4
44cbad
Obsoletes: pcp-webapp-grafana <= 4.3.4
44cbad
Obsoletes: pcp-webapp-graphite <= 4.3.4
44cbad
Obsoletes: pcp-webapp-vector <= 4.3.4
8f9145
1bbbef
# vendored golang and node.js build dependencies
1bbbef
# this is for security purposes, if nodejs-foo ever needs an update,
1bbbef
# affected packages can be easily identified.
1bbbef
# Note: generated by the Makefile (see README.md)
1bbbef
Provides: bundled(golang(github.com/grafana/grafana-plugin-sdk-go)) = 0.79.0
1bbbef
Provides: bundled(golang(github.com/smartystreets/goconvey)) = 1.6.4
1bbbef
Provides: bundled(npm(@babel/plugin-transform-modules-commonjs)) = 7.12.1
1bbbef
Provides: bundled(npm(@grafana/data)) = 7.3.6
1bbbef
Provides: bundled(npm(@grafana/runtime)) = 7.3.6
1bbbef
Provides: bundled(npm(@grafana/toolkit)) = 7.3.6
1bbbef
Provides: bundled(npm(@grafana/ui)) = 7.3.6
1bbbef
Provides: bundled(npm(@types/blueimp-md5)) = 2.7.0
1bbbef
Provides: bundled(npm(@types/d3-selection)) = 1.4.3
1bbbef
Provides: bundled(npm(@types/enzyme)) = 3.10.5
1bbbef
Provides: bundled(npm(@types/enzyme-adapter-react-16)) = 1.0.6
1bbbef
Provides: bundled(npm(@types/expect-puppeteer)) = 3.3.1
1bbbef
Provides: bundled(npm(@types/jest)) = 24.0.13
1bbbef
Provides: bundled(npm(@types/jest-environment-puppeteer)) = 4.4.1
1bbbef
Provides: bundled(npm(@types/lodash)) = 4.14.165
1bbbef
Provides: bundled(npm(@types/memoize-one)) = 5.1.2
1bbbef
Provides: bundled(npm(@types/react-autosuggest)) = 9.3.14
1bbbef
Provides: bundled(npm(@types/react-redux)) = 7.1.12
1bbbef
Provides: bundled(npm(@types/redux)) = 3.6.0
1bbbef
Provides: bundled(npm(@types/redux-persist)) = 4.3.1
1bbbef
Provides: bundled(npm(@types/redux-persist-transform-filter)) = 0.0.4
1bbbef
Provides: bundled(npm(babel-plugin-remove-object-properties)) = 1.0.2
1bbbef
Provides: bundled(npm(blueimp-md5)) = 2.18.0
1bbbef
Provides: bundled(npm(core-js)) = 1.2.7
1bbbef
Provides: bundled(npm(d3-flame-graph)) = 3.1.1
1bbbef
Provides: bundled(npm(d3-selection)) = 1.4.1
1bbbef
Provides: bundled(npm(emotion)) = 10.0.27
1bbbef
Provides: bundled(npm(enzyme)) = 3.11.0
1bbbef
Provides: bundled(npm(enzyme-adapter-react-16)) = 1.15.5
1bbbef
Provides: bundled(npm(eslint-plugin-prettier)) = 3.1.4
1bbbef
Provides: bundled(npm(jest)) = 25.5.4
1bbbef
Provides: bundled(npm(jest-date-mock)) = 1.0.8
1bbbef
Provides: bundled(npm(jest-puppeteer)) = 4.4.0
1bbbef
Provides: bundled(npm(lodash)) = 4.17.19
1bbbef
Provides: bundled(npm(loglevel)) = 1.7.1
1bbbef
Provides: bundled(npm(loglevel-plugin-prefix)) = 0.8.4
1bbbef
Provides: bundled(npm(memoize-one)) = 4.1.0
1bbbef
Provides: bundled(npm(monaco-editor)) = 0.20.0
1bbbef
Provides: bundled(npm(monaco-editor-webpack-plugin)) = 1.9.0
1bbbef
Provides: bundled(npm(prettier)) = 1.19.1
1bbbef
Provides: bundled(npm(prettier-plugin-organize-imports)) = 1.1.1
1bbbef
Provides: bundled(npm(puppeteer)) = 5.5.0
1bbbef
Provides: bundled(npm(react-autosuggest)) = 10.0.4
1bbbef
Provides: bundled(npm(react-monaco-editor)) = 0.36.0
1bbbef
Provides: bundled(npm(react-redux)) = 7.2.2
1bbbef
Provides: bundled(npm(react-use)) = 15.3.4
1bbbef
Provides: bundled(npm(redux)) = 3.7.2
1bbbef
Provides: bundled(npm(redux-persist)) = 4.10.2
1bbbef
Provides: bundled(npm(redux-thunk)) = 2.3.0
1bbbef
Provides: bundled(npm(ts-jest)) = 26.3.0
1bbbef
Provides: bundled(npm(utility-types)) = 3.10.0
8f9145
8f9145
8f9145
%description
8f9145
This Grafana plugin for Performance Co-Pilot includes datasources for
8f9145
scalable time series from pmseries(1) and Redis, live PCP metrics and
8f9145
bpftrace scripts from pmdabpftrace(1), as well as several dashboards.
8f9145
8f9145
%prep
1bbbef
%setup -q -T -D -b 0
1bbbef
%setup -q -T -D -b 1
1bbbef
%if %{compile_frontend} == 0
1bbbef
%setup -q -T -D -b 2
1bbbef
%endif
1bbbef
1bbbef
# Set up Go build subdir and links
1bbbef
mkdir -p %{_builddir}/src/github.com/performancecopilot
1bbbef
ln -s %{_builddir}/%{name}-%{version} \
1bbbef
    %{_builddir}/src/github.com/performancecopilot/grafana-pcp
8f9145
8f9145
1bbbef
%build
1bbbef
# Build frontend datasources
1bbbef
%if %{compile_frontend}
1bbbef
make dist-dashboards dist-frontend
8f9145
# webpack/copy-webpack-plugin sometimes outputs files with mode = 666 due to reasons unknown (race condition/umask issue afaics)
1bbbef
chmod -R g-w,o-w dist
1bbbef
%endif
1bbbef
1bbbef
# Build backend datasource
1bbbef
cd %{_builddir}/src/github.com/performancecopilot/grafana-pcp
1bbbef
export GOPATH=%{_builddir}
1bbbef
%gobuild -o dist/datasources/redis/pcp_redis_datasource_$(go env GOOS)_$(go env GOARCH) ./pkg
8f9145
8f9145
8f9145
%install
8f9145
install -d -m 755 %{buildroot}/%{install_dir}
8f9145
cp -a dist/* %{buildroot}/%{install_dir}
8f9145
1bbbef
%postun
1bbbef
# uninstall of old package
1bbbef
%systemd_postun_with_restart grafana-server.service
1bbbef
1bbbef
%posttrans
1bbbef
# install or upgrade of new package
1bbbef
if [ -x /usr/bin/systemctl ]; then
1bbbef
  /usr/bin/systemctl try-restart grafana-server.service || :
1bbbef
fi
1bbbef
1bbbef
1bbbef
%check
1bbbef
# Test frontend datasources
1bbbef
%if %{compile_frontend}
1bbbef
yarn test
1bbbef
%endif
1bbbef
1bbbef
# Test backend datasource
1bbbef
cd %{_builddir}/src/github.com/performancecopilot/grafana-pcp
1bbbef
export GOPATH=%{_builddir}
1bbbef
%gotest ./pkg/...
1bbbef
1bbbef
8f9145
%files
8f9145
%{install_dir}
8f9145
8f9145
%license LICENSE NOTICE
8f9145
%doc README.md
8f9145
1bbbef
8f9145
%changelog
1bbbef
* Fri Jan 22 2021 Andreas Gerstmayr <agerstmayr@redhat.com> 3.0.2-1
1bbbef
- update to 3.0.2 tagged upstream community sources, see CHANGELOG
1bbbef
1bbbef
* Wed Dec 23 2020 Andreas Gerstmayr <agerstmayr@redhat.com> 3.0.1-1
1bbbef
- update to 3.0.1 tagged upstream community sources, see CHANGELOG
1bbbef
1bbbef
* Thu Nov 26 2020 Andreas Gerstmayr <agerstmayr@redhat.com> 3.0.0-1
1bbbef
- update to 3.0.0 tagged upstream community sources, see CHANGELOG
1bbbef
- bundle golang dependencies and (optionally) node.js dependencies
1bbbef
44cbad
* Fri Aug 07 2020 Andreas Gerstmayr <agerstmayr@redhat.com> 2.0.2-3
44cbad
- bpftrace: show process name and PID in flame graphs
44cbad
44cbad
* Fri Jul 24 2020 Andreas Gerstmayr <agerstmayr@redhat.com> 2.0.2-2
44cbad
- vector: do not show all cgroups in the container overview dashboard in case no containers are present on the system
44cbad
44cbad
* Mon May 11 2020 Andreas Gerstmayr <agerstmayr@redhat.com> 2.0.2-1
44cbad
- update to upstream version 2.0.2, see CHANGELOG
44cbad
8f9145
* Tue Jan 28 2020 Andreas Gerstmayr <agerstmayr@redhat.com> 1.0.5-3
8f9145
- redis: pass correct timespec to pmproxy (fixes empty graphs for large time ranges)
8f9145
8f9145
* Tue Jan 07 2020 Andreas Gerstmayr <agerstmayr@redhat.com> 1.0.5-2
8f9145
- redis: support wildcards in metric names
8f9145
- redis: fix legend and label support
8f9145
8f9145
* Mon Dec 16 2019 Andreas Gerstmayr <agerstmayr@redhat.com> 1.0.5-1
8f9145
- upgrade to upstream 1.0.5
8f9145
- flame graphs: clean flame graph stacks every 5s (reduces CPU load)
8f9145
- general: implement PCP version checks
8f9145
- redis: set default sample interval to 60s (fixes empty graph borders)
8f9145
8f9145
* Mon Dec 16 2019 Andreas Gerstmayr <agerstmayr@redhat.com> 1.0.3-2
8f9145
- remove node_modules/node-notifier directory from webpack (due to licensing issues)
8f9145
- upgrade copy-webpack-plugin, terser-webpack-plugin and remove uglifyjs-webpack-plugin to mitigate XSS vulnerability in serialize-javascript dependency
8f9145
8f9145
* Tue Nov 26 2019 Nathan Scott <nathans@redhat.com> 1.0.3-1
8f9145
- fix flame graph dependency (flamegraph.destroy error in javascript console)
8f9145
8f9145
* Tue Nov 12 2019 Andreas Gerstmayr <agerstmayr@redhat.com> 1.0.2-1
8f9145
- handle counter wraps (overflows)
8f9145
- convert time based counters to time utilization
8f9145
- flame graphs: aggregate stack counts by selected time range in the Grafana UI
8f9145
- flame graphs: add option to hide idle stacks
8f9145
- vector: fix container dropdown in query editor
8f9145
- vector: remove container setting from datasource settings page
8f9145
- redis: fix value transformations (e.g. rate conversation of counters)
8f9145
- request more datapoints from the datasource to fill the borders of the graph panel
8f9145
8f9145
* Fri Oct 11 2019 Andreas Gerstmayr <agerstmayr@redhat.com> 1.0.0-1
8f9145
- bpftrace: support for Flame Graphs
8f9145
- bpftrace: context-sensitive auto completion for bpftrace probes, builtin variables and functions incl. help texts
8f9145
- bpftrace: parse output of bpftrace scripts (e.g. using `printf()`) as CSV and display it in the Grafana table panel
8f9145
- bpftrace: sample dashboards (BPFtrace System Analysis, BPFtrace Flame Graphs)
8f9145
- vector: table output: show instance name in left column
8f9145
- vector: table output: support non-matching instance names (cells of metrics which don't have the specific instance will be blank)
8f9145
- vector & bpftrace: if the metric/script gets changed in the query editor, immeditately stop polling the old metric/deregister the old script
8f9145
- vector & bpftrace: improve pmwebd compatibility
8f9145
- misc: help texts for all datasources (visible with the **[ ? ]** button in the query editor)
8f9145
- misc: renamed PCP Live to PCP Vector
8f9145
- misc: logos for all datasources
8f9145
- misc: improved error handling
8f9145
8f9145
* Fri Aug 16 2019 Andreas Gerstmayr <agerstmayr@redhat.com> 0.0.7-1
8f9145
- converted into a Grafana app plugin, renamed to grafana-pcp
8f9145
- redis: support for instance domains, labels, autocompletion, automatic rate conversation
8f9145
- live and bpftrace: initial commit of datasources
8f9145
8f9145
* Tue Jun 11 2019 Mark Goodwin <mgoodwin@redhat.com> 0.0.6-1
8f9145
- renamed package to grafana-pcp-redis, updated README, etc
8f9145
8f9145
* Wed Jun 05 2019 Mark Goodwin <mgoodwin@redhat.com> 0.0.5-1
8f9145
- renamed package to grafana-pcp-datasource, README, etc
8f9145
8f9145
* Fri May 17 2019 Mark Goodwin <mgoodwin@redhat.com> 0.0.4-1
8f9145
- add suggested pmproxy URL in config html
8f9145
- updated instructions and README.md now that grafana is in Fedora
8f9145
8f9145
* Fri Apr 12 2019 Mark Goodwin <mgoodwin@redhat.com> 0.0.3-1
8f9145
- require grafana v6.1.3 or later
8f9145
- install directory is now below /var/lib/grafana/plugins
8f9145
8f9145
* Wed Mar 20 2019 Mark Goodwin <mgoodwin@redhat.com> 0.0.2-1
8f9145
- initial version