Skip to content

Commit

Permalink
Several Python tools enhancements
Browse files Browse the repository at this point in the history
cmonitor_chart:
* BACKWARD INCOMPATIBLE CHANGE: remove --input option in favour of more standard positional argument for input
* BACKWARD INCOMPATIBLE CHANGE: remove --filter option moved into new cmonitor_filter --task_name option
* add support for reading JSON directly from stdin using '-'
* add custom metadata in chart output under "Configuration"
* add commit hash into --version output
* refactoring to share code with other Python utils
* refactoring to allow using cmonitor_chart from other Python programs by moving all core classes into system-wide python modules

cmonitor_statistics:
* BACKWARD INCOMPATIBLE CHANGE: remove --input option in favour of more standard positional argument for input
* add support for reading JSON directly from stdin using '-'
* add commit hash into --version output
* refactoring to share code with other Python utils
* refactoring to allow using cmonitor_statistics from other Python programs by moving all core classes into system-wide python modules

cmonitor_collector:
* add commit hash into --version output

others:
* add new cmonitor_filter utility that can be used as filtering stage before cmonitor_statistics or cmonitor_chart are used
* all components: bump to a 3digits version 2.3.0 plus release number for RPMs fixed to 0; this is to better match github tags
  • Loading branch information
f18m authored Jan 27, 2022
1 parent 0393f9b commit 56f9724
Show file tree
Hide file tree
Showing 22 changed files with 2,476 additions and 2,371 deletions.
18 changes: 16 additions & 2 deletions .copr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ COPR_PACKAGE_NAMES_SUFFIX:=1.8-4 2.0-0 2.2-0 latest
# make -f /home/fmontorsi/git/cmonitor/.copr/Makefile srpm outdir=/tmp/cmonitor-tools-rpm
#
# NOTE:
# https://docs.pagure.org/copr.copr/user_documentation.html#how-long-do-you-keep-the-builds
# see https://docs.pagure.org/copr.copr/user_documentation.html#how-long-do-you-keep-the-builds
# https://pagure.io/copr/copr/issue/2050
#
srpm:
@echo "Env variables in this COPR build:"
export
@export
@echo "Installing git client:"
dnf -y install git
@echo "Running srpm target from .copr/Makefile"
mkdir -p $(RPM_TMP_DIR)/ $(RPM_TARBALL_DIR)/
rm -rf $(RPM_TMP_DIR)/* $(RPM_TARBALL_DIR)/*
Expand All @@ -45,3 +48,14 @@ endif
curl -X POST https://copr.fedorainfracloud.org/webhooks/custom/24475/$(COPR_TOKEN)/cmonitor-collector-$${pkgname}/ ; \
curl -X POST https://copr.fedorainfracloud.org/webhooks/custom/24475/$(COPR_TOKEN)/cmonitor-tools-$${pkgname}/ ; \
done

rebuild_latest_copr_packages:
# IMPORTANT: take the COPR_TOKEN from the webpage: https://copr.fedorainfracloud.org/coprs/f18m/cmonitor/integrations/
ifndef COPR_TOKEN
@echo "*** ERROR: please call this makefile supplying explicitly the COPR_TOKEN variable"
@exit 1
endif
for pkgname in latest; do \
curl -X POST https://copr.fedorainfracloud.org/webhooks/custom/24475/$(COPR_TOKEN)/cmonitor-collector-$${pkgname}/ ; \
curl -X POST https://copr.fedorainfracloud.org/webhooks/custom/24475/$(COPR_TOKEN)/cmonitor-tools-$${pkgname}/ ; \
done
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: install deps
run: sudo apt install -y libgtest-dev libbenchmark-dev libfmt-dev tidy python3 python3-dateutil
run: sudo apt install -y libgtest-dev libbenchmark-dev libfmt-dev tidy python3 python3-dateutil git
- name: make all
run: make
- name: make test
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ addons:
- libbenchmark-dev
- libfmt-dev
- tidy
- git

install: pip install j2cli

Expand Down
2 changes: 1 addition & 1 deletion collector/spec/collector.spec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Requires: fmt
# these are the requirements that we need on COPR builds:
# IMPORTANT: cmonitor-collector RPM is built also on the 'old' Centos7 platform shipping fmt-devel-6.2.1
# so make sure not to use any feature of libfmt > 6.2.1
BuildRequires: gcc-c++, make, gtest-devel, fmt-devel
BuildRequires: gcc-c++, make, gtest-devel, fmt-devel, git
# python3-pip works and gets installed but then it fails later for unknown reasons

# Disable automatic debug package creation: it fails within Fedora 28, 29 and 30 for the lack
Expand Down
3 changes: 2 additions & 1 deletion collector/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ DEFS=-DVERSION_STRING=\"$(CMONITOR_VERSION)-$(CMONITOR_RELEASE)\" -DCMONITOR_LAS
# IMPORTANT: we do require c++11, i.e. GCC 4.8.1 or higher;
# Centos7 which is one of the oldest-supported distributions provides gcc 4.8.5 so we
# cannot move to e.g. c++14/17/20 yet
CXXFLAGS=-Wall -Werror -Wno-switch-bool -std=c++11 $(DEFS)
# IMPORTANT#2: -fPIC is required to build on fedora-rawhide
CXXFLAGS=-Wall -Werror -Wno-switch-bool -std=c++11 -fPIC $(DEFS)

ifeq ($(DEBUG),1)
CXXFLAGS += -g -O0 #useful for debugging
Expand Down
2 changes: 1 addition & 1 deletion collector/src/benchmarks/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
THIS_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
ROOT_DIR:=$(shell readlink -f $(THIS_DIR)/../../..)

CXXFLAGS=-Wall -Werror -Wno-switch-bool -std=c++11 -DVERSION_STRING=\"$(RPM_VERSION)-$(RPM_RELEASE)\"
CXXFLAGS=-Wall -Werror -Wno-switch-bool -std=c++11 -fPIC -DVERSION_STRING=\"$(RPM_VERSION)-$(RPM_RELEASE)\"

ifeq ($(DEBUG),1)
CXXFLAGS += -g -O0 #useful for debugging
Expand Down
2 changes: 1 addition & 1 deletion collector/src/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
THIS_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
ROOT_DIR:=$(shell readlink -f $(THIS_DIR)/../../..)

CXXFLAGS=-Wall -Werror -Wno-switch-bool -std=c++11 -DVERSION_STRING=\"$(RPM_VERSION)-$(RPM_RELEASE)\"
CXXFLAGS=-Wall -Werror -Wno-switch-bool -std=c++11 -fPIC -DVERSION_STRING=\"$(RPM_VERSION)-$(RPM_RELEASE)\"

ifeq ($(DEBUG),1)
CXXFLAGS += -g -O0 #useful for debugging
Expand Down
2 changes: 1 addition & 1 deletion examples/baremetal1.html
Original file line number Diff line number Diff line change
Expand Up @@ -4105,7 +4105,7 @@ <h3>Monitoring Summary</h3>
</ul></td><td><ul>
<li>Total time sampled (hh:mm:ss): <span class='bottom_table_val'>0:10:00</span></li>
<li>Version (cmonitor_collector): <span class='bottom_table_val'>2.2-0</span></li>
<li>Version (cmonitor_chart): <span class='bottom_table_val'>2.3-0</span></li>
<li>Version (cmonitor_chart): <span class='bottom_table_val'>2.3.0-0</span></li>
</ul></td></tr>
</table>
</div>
Expand Down
2 changes: 1 addition & 1 deletion examples/docker-collecting-baremetal-stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -2080,7 +2080,7 @@ <h3>Monitoring Summary</h3>
</ul></td><td><ul>
<li>Total time sampled (hh:mm:ss): <span class='bottom_table_val'>0:03:00</span></li>
<li>Version (cmonitor_collector): <span class='bottom_table_val'>2.2-0</span></li>
<li>Version (cmonitor_chart): <span class='bottom_table_val'>2.3-0</span></li>
<li>Version (cmonitor_chart): <span class='bottom_table_val'>2.3.0-0</span></li>
</ul></td></tr>
</table>
</div>
Expand Down
2 changes: 1 addition & 1 deletion examples/docker-collecting-docker-stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ <h3>Monitoring Summary</h3>
</ul></td><td><ul>
<li>Total time sampled (hh:mm:ss): <span class='bottom_table_val'>0:03:00</span></li>
<li>Version (cmonitor_collector): <span class='bottom_table_val'>2.2-0</span></li>
<li>Version (cmonitor_chart): <span class='bottom_table_val'>2.3-0</span></li>
<li>Version (cmonitor_chart): <span class='bottom_table_val'>2.3.0-0</span></li>
</ul></td></tr>
</table>
</div>
Expand Down
2 changes: 1 addition & 1 deletion examples/docker-stress-test-cpu.html
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ <h3>Monitoring Summary</h3>
</ul></td><td><ul>
<li>Total time sampled (hh:mm:ss): <span class='bottom_table_val'>0:00:15</span></li>
<li>Version (cmonitor_collector): <span class='bottom_table_val'>2.2-0</span></li>
<li>Version (cmonitor_chart): <span class='bottom_table_val'>2.3-0</span></li>
<li>Version (cmonitor_chart): <span class='bottom_table_val'>2.3.0-0</span></li>
</ul></td></tr>
</table>
</div>
Expand Down
2 changes: 1 addition & 1 deletion examples/docker-stress-test-mem.html
Original file line number Diff line number Diff line change
Expand Up @@ -2306,7 +2306,7 @@ <h3>Monitoring Summary</h3>
</ul></td><td><ul>
<li>Total time sampled (hh:mm:ss): <span class='bottom_table_val'>0:00:15</span></li>
<li>Version (cmonitor_collector): <span class='bottom_table_val'>2.2-0</span></li>
<li>Version (cmonitor_chart): <span class='bottom_table_val'>2.3-0</span></li>
<li>Version (cmonitor_chart): <span class='bottom_table_val'>2.3.0-0</span></li>
</ul></td></tr>
</table>
</div>
Expand Down
2 changes: 1 addition & 1 deletion examples/docker-userapp.html
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ <h3>Monitoring Summary</h3>
</ul></td><td><ul>
<li>Total time sampled (hh:mm:ss): <span class='bottom_table_val'>0:02:00</span></li>
<li>Version (cmonitor_collector): <span class='bottom_table_val'>2.2-0</span></li>
<li>Version (cmonitor_chart): <span class='bottom_table_val'>2.3-0</span></li>
<li>Version (cmonitor_chart): <span class='bottom_table_val'>2.3.0-0</span></li>
</ul></td></tr>
</table>
</div>
Expand Down
3 changes: 2 additions & 1 deletion tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ SYMLINKS = \
filter/cmonitor_filter \
statistics/cmonitor_statistics
COMMON_CODE = \
common-code/cmonitor_loader.py \
$(wildcard common-code/*.py) \
common-code/cmonitor_version.py

#
Expand Down Expand Up @@ -89,6 +89,7 @@ srpm_tarball:
mv cmonitor cmonitor-tools-$(CMONITOR_VERSION) && \
sed -i 's@__RPM_VERSION__@$(CMONITOR_VERSION)@g' cmonitor-tools-$(CMONITOR_VERSION)/tools/spec/tools.spec && \
sed -i 's@__RPM_RELEASE__@$(CMONITOR_RELEASE)@g' cmonitor-tools-$(CMONITOR_VERSION)/tools/spec/tools.spec && \
sed -i 's@__LAST_COMMIT_HASH__@$(CMONITOR_LAST_COMMIT_HASH)@g' cmonitor-tools-$(CMONITOR_VERSION)/tools/spec/tools.spec && \
tar cvzf $(RPM_TMP_DIR)/cmonitor-tools-$(CMONITOR_VERSION).tar.gz cmonitor-tools-$(CMONITOR_VERSION)/*
#
# This target is used by Fedora COPR to automatically produce RPMs for lots of distros.
Expand Down
Loading

0 comments on commit 56f9724

Please sign in to comment.