diff -Nru prometheus-process-exporter-0.7.5/debian/changelog prometheus-process-exporter-0.7.5/debian/changelog --- prometheus-process-exporter-0.7.5/debian/changelog 2020-11-16 19:11:19.000000000 +0000 +++ prometheus-process-exporter-0.7.5/debian/changelog 2021-01-29 22:49:45.000000000 +0000 @@ -1,3 +1,38 @@ +prometheus-process-exporter (0.7.5-3) unstable; urgency=medium + + * Team upload. + * Indent debian/watch opts contents + * Update version.BuildUser to match the Maintainer address + * Build-Depend on golang-any instead of golang-go + * Add missing Pre-Depends with misc:Pre-Depends substvar + + -- Guillem Jover Fri, 29 Jan 2021 23:49:45 +0100 + +prometheus-process-exporter (0.7.5-2) unstable; urgency=medium + + * Team upload. + * Comment out disabled option in man page. + * Build-Depend on golang-github-prometheus-procfs-dev (>= 0.2.0) instead of + golang-procfs-dev, required by the new upstream release. + * Add a gitlab CI configuration file. + * Switch from vendored to packaged golang-github-ncabatoff-go-seq-dev. + * Update Standards-Version to 4.5.1 (no changes). + * Switch from transitional golang-yaml.v2-dev to golang-gopkg-yaml.v2-dev. + * Add missing dependency on adduser + * Use '' instead of `' in text + * Add systemd service Restart directive set to on-failure + * Improve man page formatting + * Remove error suppression from postinst + * Run adduser unconditionally + * Do not change pathname metadata if there are dpkg statoverrides in place + * Add a sysvinit init script + * Add a logrotate fragment file + * Add a postrm script to cleanup pidfile and log files on purge + * Update copyright claims + * Update gitignore entries + + -- Guillem Jover Sat, 23 Jan 2021 03:53:41 +0100 + prometheus-process-exporter (0.7.5-1) unstable; urgency=medium [ Daniel Swarbrick ] diff -Nru prometheus-process-exporter-0.7.5/debian/control prometheus-process-exporter-0.7.5/debian/control --- prometheus-process-exporter-0.7.5/debian/control 2020-11-12 15:48:46.000000000 +0000 +++ prometheus-process-exporter-0.7.5/debian/control 2021-01-29 19:36:58.000000000 +0000 @@ -7,14 +7,15 @@ Priority: optional Build-Depends: debhelper-compat (= 13), dh-golang, + golang-any, golang-github-google-go-cmp-dev, + golang-github-ncabatoff-go-seq-dev, golang-github-prometheus-client-golang-dev, golang-github-prometheus-common-dev, - golang-go, + golang-github-prometheus-procfs-dev (>= 0.2.0), golang-gopkg-check.v1-dev, - golang-procfs-dev, - golang-yaml.v2-dev, -Standards-Version: 4.5.0 + golang-gopkg-yaml.v2-dev, +Standards-Version: 4.5.1 Rules-Requires-Root: no Vcs-Browser: https://salsa.debian.org/go-team/packages/prometheus-process-exporter Vcs-Git: https://salsa.debian.org/go-team/packages/prometheus-process-exporter.git @@ -23,7 +24,9 @@ Package: prometheus-process-exporter Architecture: any -Depends: ${misc:Depends}, +Pre-Depends: ${misc:Pre-Depends} +Depends: adduser, + ${misc:Depends}, ${shlibs:Depends}, Built-Using: ${misc:Built-Using}, Description: Prometheus exporter that exposes process metrics from procfs diff -Nru prometheus-process-exporter-0.7.5/debian/copyright prometheus-process-exporter-0.7.5/debian/copyright --- prometheus-process-exporter-0.7.5/debian/copyright 2020-11-12 15:48:46.000000000 +0000 +++ prometheus-process-exporter-0.7.5/debian/copyright 2021-01-22 19:53:23.000000000 +0000 @@ -8,6 +8,7 @@ Files: debian/* Copyright: 2018-20 1&1 IONOS SE + 2021 Sipwise GmbH, Austria License: Expat License: Expat diff -Nru prometheus-process-exporter-0.7.5/debian/gitlab-ci.yml prometheus-process-exporter-0.7.5/debian/gitlab-ci.yml --- prometheus-process-exporter-0.7.5/debian/gitlab-ci.yml 1970-01-01 00:00:00.000000000 +0000 +++ prometheus-process-exporter-0.7.5/debian/gitlab-ci.yml 2020-12-01 16:24:21.000000000 +0000 @@ -0,0 +1,26 @@ +# auto-generated, DO NOT MODIFY. +# The authoritative copy of this file lives at: +# https://salsa.debian.org/go-team/ci/blob/master/config/gitlabciyml.go + +image: stapelberg/ci2 + +test_the_archive: + artifacts: + paths: + - before-applying-commit.json + - after-applying-commit.json + script: + # Create an overlay to discard writes to /srv/gopath/src after the build: + - "rm -rf /cache/overlay/{upper,work}" + - "mkdir -p /cache/overlay/{upper,work}" + - "mount -t overlay overlay -o lowerdir=/srv/gopath/src,upperdir=/cache/overlay/upper,workdir=/cache/overlay/work /srv/gopath/src" + - "export GOPATH=/srv/gopath" + - "export GOCACHE=/cache/go" + # Build the world as-is: + - "ci-build -exemptions=/var/lib/ci-build/exemptions.json > before-applying-commit.json" + # Copy this package into the overlay: + - "GBP_CONF_FILES=:debian/gbp.conf gbp buildpackage --git-no-pristine-tar --git-ignore-branch --git-ignore-new --git-export-dir=/tmp/export --git-no-overlay --git-tarball-dir=/nonexistant --git-cleaner=/bin/true --git-builder='dpkg-buildpackage -S -d --no-sign'" + - "pgt-gopath -dsc /tmp/export/*.dsc" + # Rebuild the world: + - "ci-build -exemptions=/var/lib/ci-build/exemptions.json > after-applying-commit.json" + - "ci-diff before-applying-commit.json after-applying-commit.json" diff -Nru prometheus-process-exporter-0.7.5/debian/init prometheus-process-exporter-0.7.5/debian/init --- prometheus-process-exporter-0.7.5/debian/init 1970-01-01 00:00:00.000000000 +0000 +++ prometheus-process-exporter-0.7.5/debian/init 2021-01-22 19:53:44.000000000 +0000 @@ -0,0 +1,45 @@ +#!/bin/sh +# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing. +if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then + set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script +fi +### BEGIN INIT INFO +# Provides: prometheus-process-exporter +# Required-Start: $remote_fs +# Required-Stop: $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Prometheus exporter for processes metrics +# Description: Prometheus exporter for processes metrics +### END INIT INFO + +# Author: Guillem Jover + +DESC="Prometheus exporter for processes metrics" +NAME=prometheus-process-exporter +USER=prometheus +GROUP=$USER +DAEMON=/usr/bin/$NAME +PIDFILE=/run/prometheus/$NAME.pid +LOGFILE=/var/log/prometheus/$NAME.log + +START_ARGS="--no-close --background --make-pidfile" +STOP_ARGS="--remove-pidfile" + +do_start_prepare() +{ + mkdir -p $(dirname $PIDFILE) +} + +do_start_cmd_override() +{ + start-stop-daemon --start --quiet --oknodo \ + --exec $DAEMON --pidfile $PIDFILE --user $USER --group $GROUP \ + --chuid $USER:$GROUP $START_ARGS -- $ARGS >>$LOGFILE 2>&1 +} + +do_stop_cmd_override() +{ + start-stop-daemon --stop --quiet --oknodo --retry=TERM/30/KILL/5 \ + --exec $DAEMON --pidfile $PIDFILE --user $USER $STOP_ARGS +} diff -Nru prometheus-process-exporter-0.7.5/debian/logrotate prometheus-process-exporter-0.7.5/debian/logrotate --- prometheus-process-exporter-0.7.5/debian/logrotate 1970-01-01 00:00:00.000000000 +0000 +++ prometheus-process-exporter-0.7.5/debian/logrotate 2021-01-21 01:27:17.000000000 +0000 @@ -0,0 +1,9 @@ +/var/log/prometheus/prometheus-process-exporter.log { + weekly + rotate 10 + copytruncate + compress + delaycompress + notifempty + missingok +} diff -Nru prometheus-process-exporter-0.7.5/debian/patches/02-vendor-ncabatoff-go-seq-seq.patch prometheus-process-exporter-0.7.5/debian/patches/02-vendor-ncabatoff-go-seq-seq.patch --- prometheus-process-exporter-0.7.5/debian/patches/02-vendor-ncabatoff-go-seq-seq.patch 2020-11-12 15:48:46.000000000 +0000 +++ prometheus-process-exporter-0.7.5/debian/patches/02-vendor-ncabatoff-go-seq-seq.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,185 +0,0 @@ -Description: Re-vendor github.com/ncabatoff/go-seq/seq package - Upstream repo completely removed vendor directory. However, the seq package is - not of sufficiently widespread appeal to justify packaging it separately. -Author: Daniel Swarbrick -Forwarded: not-needed ---- ---- /dev/null -+++ b/vendor/github.com/ncabatoff/go-seq/seq/compare.go -@@ -0,0 +1,176 @@ -+package seq -+ -+import ( -+ "fmt" -+ "reflect" -+ "sort" -+) -+ -+// Compare returns 0 if a and b are equal, -1 if a < b, or 1 if a > b. -+// Panics if a and b are not of the same type, or are of a type not listed here. -+// * Bools are compared assuming false < true. -+// * Strings, integer and float values are compared as Go compares them. -+// * Two nil pointers are equal; one nil pointer is treated as smaller than a non-nil pointer. -+// * Non-nil pointers are compared by comparing the values they point to. -+// * Structures are compared by comparing their fields in order. -+// * Slices are compared by comparing elements sequentially. If the slices are of different -+// length and all elements are the same up to the shorter length, the shorter slice is treated as -+// smaller. -+// * Maps can only be compared if they have string keys, in which case the ordered list of -+// keys are first compared as string slices, and if they're equal then the values are compared -+// sequentially in key order. -+func Compare(a, b interface{}) int { -+ return compareValue(reflect.ValueOf(a), reflect.ValueOf(b)) -+} -+ -+func boolToInt(b bool) int { -+ if b { -+ return 1 -+ } -+ return 0 -+} -+ -+func compareValue(ir1, ir2 reflect.Value) int { -+ var zerovalue reflect.Value -+ r1, r2 := reflect.Indirect(ir1), reflect.Indirect(ir2) -+ -+ if r1 == zerovalue { -+ if r2 == zerovalue { -+ return 0 -+ } -+ return -1 -+ } -+ if r2 == zerovalue { -+ return 1 -+ } -+ -+ switch r1.Kind() { -+ case reflect.Bool: -+ v1, v2 := boolToInt(r1.Bool()), boolToInt(r2.Bool()) -+ if v1 < v2 { -+ return -1 -+ } -+ if v1 > v2 { -+ return 1 -+ } -+ case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: -+ v1, v2 := r1.Int(), r2.Int() -+ if v1 < v2 { -+ return -1 -+ } -+ if v1 > v2 { -+ return 1 -+ } -+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: -+ v1, v2 := r1.Uint(), r2.Uint() -+ if v1 < v2 { -+ return -1 -+ } -+ if v1 > v2 { -+ return 1 -+ } -+ case reflect.Float32, reflect.Float64: -+ v1, v2 := r1.Float(), r2.Float() -+ if v1 < v2 { -+ return -1 -+ } -+ if v1 > v2 { -+ return 1 -+ } -+ case reflect.Map: -+ return compareMap(r1, r2) -+ case reflect.Struct: -+ return compareStruct(r1, r2) -+ case reflect.Slice: -+ if r1.Type().Elem().Kind() == reflect.Uint8 { -+ // Not using bytes.Compare because that fails on unexported fields: -+ // return bytes.Compare(r1.Interface().([]byte), r2.Interface().([]byte)) -+ var s string -+ strtype := reflect.TypeOf(s) -+ v1, v2 := r1.Convert(strtype).String(), r2.Convert(strtype).String() -+ if v1 < v2 { -+ return -1 -+ } -+ if v1 > v2 { -+ return 1 -+ } -+ } -+ return compareSlice(r1, r2) -+ case reflect.String: -+ v1, v2 := r1.String(), r2.String() -+ if v1 < v2 { -+ return -1 -+ } -+ if v1 > v2 { -+ return 1 -+ } -+ default: -+ panic(fmt.Sprintf("don't know how to compare values of type %v", r1.Type())) -+ } -+ return 0 -+} -+ -+func compareStruct(r1, r2 reflect.Value) int { -+ if r1.Type() != r2.Type() { -+ panic(fmt.Sprintf("s1 and s2 are not of the same type: %v, %v", r1.Type(), r2.Type())) -+ } -+ -+ n := r1.NumField() -+ for i := 0; i < n; i++ { -+ c := compareValue(r1.Field(i), r2.Field(i)) -+ if c != 0 { -+ return c -+ } -+ } -+ return 0 -+} -+ -+func compareSlice(r1, r2 reflect.Value) int { -+ maxlen := r1.Len() -+ if r2.Len() < maxlen { -+ maxlen = r2.Len() -+ } -+ for i := 0; i < maxlen; i++ { -+ c := compareValue(r1.Index(i), r2.Index(i)) -+ if c != 0 { -+ return c -+ } -+ } -+ if r1.Len() > maxlen { -+ return 1 -+ } -+ if r2.Len() > maxlen { -+ return -1 -+ } -+ return 0 -+} -+ -+func sortedKeys(r1 reflect.Value) []string { -+ keys := make([]string, 0, r1.Len()) -+ for _, k := range r1.MapKeys() { -+ keys = append(keys, k.String()) -+ } -+ sort.Strings(keys) -+ return keys -+} -+ -+func compareMap(r1, r2 reflect.Value) int { -+ if r1.Type().Key().Kind() != reflect.String { -+ panic("can only compare maps with keys of type string") -+ } -+ -+ s1, s2 := sortedKeys(r1), sortedKeys(r2) -+ c := compareSlice(reflect.ValueOf(s1), reflect.ValueOf(s2)) -+ if c != 0 { -+ return c -+ } -+ -+ for _, k := range s1 { -+ vk := reflect.ValueOf(k) -+ c := compareValue(r1.MapIndex(vk), r2.MapIndex(vk)) -+ if c != 0 { -+ return c -+ } -+ } -+ return 0 -+} diff -Nru prometheus-process-exporter-0.7.5/debian/patches/series prometheus-process-exporter-0.7.5/debian/patches/series --- prometheus-process-exporter-0.7.5/debian/patches/series 2020-11-12 15:48:46.000000000 +0000 +++ prometheus-process-exporter-0.7.5/debian/patches/series 2020-12-28 17:36:21.000000000 +0000 @@ -1,3 +1,2 @@ 01-fix-RSS-test-on-non4K-pagesize-systems.patch -02-vendor-ncabatoff-go-seq-seq.patch 03-disable-fakescraper.patch diff -Nru prometheus-process-exporter-0.7.5/debian/postinst prometheus-process-exporter-0.7.5/debian/postinst --- prometheus-process-exporter-0.7.5/debian/postinst 2020-11-12 15:48:07.000000000 +0000 +++ prometheus-process-exporter-0.7.5/debian/postinst 2021-01-21 00:39:55.000000000 +0000 @@ -4,13 +4,12 @@ case "$1" in configure) # Add prometheus user - if ! getent passwd prometheus > /dev/null; then - adduser --quiet --system --home /var/lib/prometheus \ - --group --gecos "Prometheus daemon" prometheus || true - fi - - chown prometheus:prometheus /var/lib/prometheus || true + adduser --quiet --system --home /var/lib/prometheus \ + --group --gecos "Prometheus daemon" prometheus + if ! dpkg-statoverride --list /var/lib/prometheus >/dev/null; then + chown prometheus:prometheus /var/lib/prometheus + fi ;; abort-upgrade|abort-remove|abort-deconfigure) @@ -18,7 +17,7 @@ ;; *) - echo "postinst called with unknown argument \`$1'" >&2 + echo "postinst called with unknown argument '$1'" >&2 exit 1 ;; esac diff -Nru prometheus-process-exporter-0.7.5/debian/postrm prometheus-process-exporter-0.7.5/debian/postrm --- prometheus-process-exporter-0.7.5/debian/postrm 1970-01-01 00:00:00.000000000 +0000 +++ prometheus-process-exporter-0.7.5/debian/postrm 2021-01-21 01:29:30.000000000 +0000 @@ -0,0 +1,15 @@ +#!/bin/sh +# postrm script for prometheus-process-exporter +# Script executed after the package is removed. + +set -e + +case "$1" in + purge) + rm -rf /var/log/prometheus/prometheus-process-exporter.log* \ + /run/prometheus/prometheus-process-exporter.pid + # We do NOT remove the system user. + ;; +esac + +#DEBHELPER# diff -Nru prometheus-process-exporter-0.7.5/debian/prometheus-process-exporter.1 prometheus-process-exporter-0.7.5/debian/prometheus-process-exporter.1 --- prometheus-process-exporter-0.7.5/debian/prometheus-process-exporter.1 2020-11-12 15:48:07.000000000 +0000 +++ prometheus-process-exporter-0.7.5/debian/prometheus-process-exporter.1 2021-01-21 00:30:28.000000000 +0000 @@ -1,15 +1,15 @@ -.TH PROMETHEUS-PROCESS-EXPORTER 1 "October 2018" "0.4.0" "prometheus-process-exporter man page" +.TH PROMETHEUS-PROCESS-EXPORTER 1 "October 2018" "0.4.0" Prometheus .SH NAME prometheus-process-exporter \- Prometheus exporter which mines procfs to report on selected processes. .SH SYNOPSIS -prometheus-process-exporter [options] +.B prometheus-process-exporter +.RI [ option ...] .SH DESCRIPTION Some apps are impractical to instrument directly, either because you don't control the code or they're written in a language that isn't easy to instrument with Prometheus. This exporter solves that issue by mining process metrics from procfs. -.SH OPTIONS .PP The recommended option is to use a config file, but for convenience and backwards compatibility the \f[B]\-procnames\f[] / \f[B]\-namemapping\f[] @@ -20,35 +20,46 @@ found (if any) when walking the process tree upwards. In other words, resource usage of subprocesses is added to their parent's usage unless the subprocess identifies as a different group name. -.PP -\f[B]\-children\f[] If a proc is tracked, track with it any children that +.SH OPTIONS +.TP +\f[B]\-children\f[] +If a proc is tracked, track with it any children that aren't part of their own group (default true). -.PP -\f[B]\-config.path\f[] \f[I]string\f[] Path to YAML config file. -.PP -\f[B]\-debug\f[] Log debugging information to stdout. -.PP -\f[B]\-man\f[] Print manual. -.PP -\f[B]\-namemapping\f[] \f[I]string\f[] Comma\-separated list, alternating +.TP +\f[B]\-config.path\f[] \f[I]string\f[] +Path to YAML config file. +.TP +\f[B]\-debug\f[] +Log debugging information to stdout. +.TP +\f[B]\-man\f[] +Print manual. +.TP +\f[B]\-namemapping\f[] \f[I]string\f[] +Comma\-separated list, alternating process name and capturing regex to apply to cmdline. -.PP -\f[B]\-once\-to\-stdout\-delay\f[] \f[I]duration\f[] Don't bind, just wait this +.\" The following option has been patched out, we comment it out. +.ig +.TP +\f[B]\-once\-to\-stdout\-delay\f[] \f[I]duration\f[] +Don't bind, just wait this much time, print the metrics once to stdout, and exit. -.PP -\f[B]\-procfs\f[] \f[I]string\f[] Path to read proc data from (default -"/proc"). -.PP -\f[B]\-procnames\f[] \f[I]string\f[] Comma\-separated list of process names to -monitor. -.PP +.. +.TP +\f[B]\-procfs\f[] \f[I]string\f[] +Path to read proc data from (default "/proc"). +.TP +\f[B]\-procnames\f[] \f[I]string\f[] +Comma\-separated list of process names to monitor. +.TP \f[B]\-recheck\f[] Re\-check process names on each scrape. -.PP -\f[B]\-web.listen\-address\f[] \f[I]string\f[] Address on which to expose +.TP +\f[B]\-web.listen\-address\f[] \f[I]string\f[] +Address on which to expose metrics and web interface. (default ":9256"). -.PP -\f[B]\-web.telemetry\-path\f[] \f[I]string\f[] Path under which to expose -metrics. (default "/metrics"). +.TP +\f[B]\-web.telemetry\-path\f[] \f[I]string\f[] +Path under which to expose metrics. (default "/metrics"). .SH SEE ALSO \f[B]proc\f[](5) .SH AUTHOR diff -Nru prometheus-process-exporter-0.7.5/debian/rules prometheus-process-exporter-0.7.5/debian/rules --- prometheus-process-exporter-0.7.5/debian/rules 2020-11-13 16:56:18.000000000 +0000 +++ prometheus-process-exporter-0.7.5/debian/rules 2021-01-25 21:53:55.000000000 +0000 @@ -8,7 +8,7 @@ METAPKG := github.com/prometheus/common BRANCH := debian/sid -USER := pkg-go-maintainers@lists.alioth.debian.org +USER := team+pkg-go@tracker.debian.org BUILD_DATE := $(shell date --utc --date='@$(SOURCE_DATE_EPOCH)' \ +%Y%m%d-%H:%M:%S) GO_VERSION := $(shell go version | sed 's/go version \(\S*\).*/\1/') diff -Nru prometheus-process-exporter-0.7.5/debian/service prometheus-process-exporter-0.7.5/debian/service --- prometheus-process-exporter-0.7.5/debian/service 2020-11-12 15:48:07.000000000 +0000 +++ prometheus-process-exporter-0.7.5/debian/service 2021-01-20 22:58:54.000000000 +0000 @@ -4,6 +4,7 @@ After=network.target [Service] +Restart=on-failure User=prometheus EnvironmentFile=/etc/default/prometheus-process-exporter ExecStart=/usr/bin/prometheus-process-exporter $ARGS diff -Nru prometheus-process-exporter-0.7.5/debian/watch prometheus-process-exporter-0.7.5/debian/watch --- prometheus-process-exporter-0.7.5/debian/watch 2020-11-12 15:48:46.000000000 +0000 +++ prometheus-process-exporter-0.7.5/debian/watch 2021-01-25 21:52:02.000000000 +0000 @@ -1,4 +1,4 @@ version=4 opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/process-exporter-$1\.tar\.gz/,\ -dversionmangle=s/\+ds\d*$// \ + dversionmangle=s/\+ds\d*$// \ https://github.com/ncabatoff/process-exporter/tags .*/v?(\d\S+)\.tar\.gz