diff -Nru prometheus-pushgateway-0.3.0+ds/CHANGELOG.md prometheus-pushgateway-0.3.1+ds/CHANGELOG.md --- prometheus-pushgateway-0.3.0+ds/CHANGELOG.md 2016-06-14 13:27:33.000000000 +0000 +++ prometheus-pushgateway-0.3.1+ds/CHANGELOG.md 2016-12-26 01:13:50.000000000 +0000 @@ -1,3 +1,7 @@ +## 0.3.1 / 2016-11-03 +* [BUGFIX] Fixed a race condition in the storage layer. +* [ENHANCEMENT] Improved README.md. + ## 0.3.0 / 2016-06-07 * [CHANGE] Push now rejects improper and reserved labels. * [CHANGE] Required labels flag removed. diff -Nru prometheus-pushgateway-0.3.0+ds/circle.yml prometheus-pushgateway-0.3.1+ds/circle.yml --- prometheus-pushgateway-0.3.0+ds/circle.yml 2016-06-14 13:27:33.000000000 +0000 +++ prometheus-pushgateway-0.3.1+ds/circle.yml 2016-12-26 01:13:50.000000000 +0000 @@ -2,7 +2,7 @@ environment: DOCKER_IMAGE_NAME: prom/pushgateway QUAY_IMAGE_NAME: quay.io/prometheus/pushgateway - DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.6.2-main + DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.6-base REPO_PATH: github.com/prometheus/pushgateway pre: - sudo curl -L -o /usr/bin/docker 'https://s3-external-1.amazonaws.com/circle-downloads/docker-1.9.1-circleci' @@ -44,7 +44,7 @@ - docker push $DOCKER_IMAGE_NAME - docker push $QUAY_IMAGE_NAME hub_tag: - tag: /^[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/ + tag: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/ owner: prometheus commands: - promu crossbuild tarballs @@ -53,7 +53,7 @@ - docker login -e $DOCKER_EMAIL -u $DOCKER_LOGIN -p $DOCKER_PASSWORD - docker login -e $QUAY_EMAIL -u $QUAY_LOGIN -p $QUAY_PASSWORD quay.io - | - if [[ "$CIRCLE_TAG" =~ ^[0-9]+(\.[0-9]+){2}$ ]]; then + if [[ "$CIRCLE_TAG" =~ ^v[0-9]+(\.[0-9]+){2}$ ]]; then docker tag "$DOCKER_IMAGE_NAME:$CIRCLE_TAG" "$DOCKER_IMAGE_NAME:latest" docker tag "$QUAY_IMAGE_NAME:$CIRCLE_TAG" "$QUAY_IMAGE_NAME:latest" fi diff -Nru prometheus-pushgateway-0.3.0+ds/debian/changelog prometheus-pushgateway-0.3.1+ds/debian/changelog --- prometheus-pushgateway-0.3.0+ds/debian/changelog 2016-06-27 15:19:16.000000000 +0000 +++ prometheus-pushgateway-0.3.1+ds/debian/changelog 2016-12-26 02:54:22.000000000 +0000 @@ -1,3 +1,11 @@ +prometheus-pushgateway (0.3.1+ds-1) unstable; urgency=medium + + * Also remove state file on purge. + * New upstream release. + * Replace vendored jQuery with Debian version. + + -- Martín Ferrari Mon, 26 Dec 2016 02:54:22 +0000 + prometheus-pushgateway (0.3.0+ds-2) unstable; urgency=medium * Use a persistence file by default. diff -Nru prometheus-pushgateway-0.3.0+ds/debian/control prometheus-pushgateway-0.3.1+ds/debian/control --- prometheus-pushgateway-0.3.0+ds/debian/control 2016-06-27 15:19:16.000000000 +0000 +++ prometheus-pushgateway-0.3.1+ds/debian/control 2016-12-26 02:54:22.000000000 +0000 @@ -18,7 +18,11 @@ Package: prometheus-pushgateway Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, daemon, libjs-bootstrap +Depends: ${misc:Depends}, + ${shlibs:Depends}, + daemon, + libjs-bootstrap, + libjs-jquery, Built-Using: ${misc:Built-Using} Description: Prometheus exporter for ephemereal jobs The Prometheus Pushgateway exists to allow ephemeral and batch jobs to expose diff -Nru prometheus-pushgateway-0.3.0+ds/debian/copyright prometheus-pushgateway-0.3.1+ds/debian/copyright --- prometheus-pushgateway-0.3.0+ds/debian/copyright 2016-06-27 15:19:16.000000000 +0000 +++ prometheus-pushgateway-0.3.1+ds/debian/copyright 2016-12-26 02:54:22.000000000 +0000 @@ -1,26 +1,21 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: github.com/prometheus/pushgateway Source: https://github.com/prometheus/pushgateway +Files-Excluded: + resources/static/jquery-* + resources/static/bootstrap-* + vendor/*/ Files: * Copyright: 2014-2015 The Prometheus Authors License: Apache-2.0 -Comment: Upstream embeds dependencies into the source tree. The bootstrap - library is already packaged in Debian and has been removed. The jquery library - was left embedded, as the version in Debian is too old, but I removed the - minified file and replaced it with the original source. +Comment: Upstream embeds dependencies into the source tree, which have been + removed. Files: debian/* Copyright: 2015 Martín Ferrari License: Apache-2.0 -Files: resources/static/jquery-2.1.4.js -Copyright: 2005, 2014 jQuery Foundation, Inc. and other contributors -License: MIT -Comment: Had to maintain the embedded version, as the Debian package is - ancient, and other libraries refuse to work. This is version v2.1.4 from - http://code.jquery.com/jquery-2.1.4.js - License: Apache-2.0 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -36,22 +31,3 @@ . On Debian systems, the full text of the Apache License version 2 can be found in the file `/usr/share/common-licenses/Apache-2.0'. - -License: MIT - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - . - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - . - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. diff -Nru prometheus-pushgateway-0.3.0+ds/debian/links prometheus-pushgateway-0.3.1+ds/debian/links --- prometheus-pushgateway-0.3.0+ds/debian/links 2016-06-27 15:19:16.000000000 +0000 +++ prometheus-pushgateway-0.3.1+ds/debian/links 2016-12-26 02:54:22.000000000 +0000 @@ -1 +1,2 @@ /usr/share/javascript/bootstrap /usr/share/prometheus/pushgateway/static/bootstrap +/usr/share/javascript/jquery /usr/share/prometheus/pushgateway/static/jquery diff -Nru prometheus-pushgateway-0.3.0+ds/debian/patches/02-Do_not_embed_blobs.patch prometheus-pushgateway-0.3.1+ds/debian/patches/02-Do_not_embed_blobs.patch --- prometheus-pushgateway-0.3.0+ds/debian/patches/02-Do_not_embed_blobs.patch 2016-06-27 15:19:16.000000000 +0000 +++ prometheus-pushgateway-0.3.1+ds/debian/patches/02-Do_not_embed_blobs.patch 2016-12-26 02:54:22.000000000 +0000 @@ -76,7 +76,7 @@ - - - -+ ++ + + + diff -Nru prometheus-pushgateway-0.3.0+ds/debian/postrm prometheus-pushgateway-0.3.1+ds/debian/postrm --- prometheus-pushgateway-0.3.0+ds/debian/postrm 2016-06-27 15:19:16.000000000 +0000 +++ prometheus-pushgateway-0.3.1+ds/debian/postrm 2016-12-26 02:54:22.000000000 +0000 @@ -8,6 +8,7 @@ purge) rm -rf /var/log/prometheus/prometheus-pushgateway.log \ /var/log/prometheus/prometheus-pushgateway.log.* \ + /var/lib/prometheus/pushgateway.data \ /var/run/prometheus/prometheus-pushgateway.pid # We do NOT remove the system user. ;; diff -Nru prometheus-pushgateway-0.3.0+ds/.promu.yml prometheus-pushgateway-0.3.1+ds/.promu.yml --- prometheus-pushgateway-0.3.0+ds/.promu.yml 2016-06-14 13:27:33.000000000 +0000 +++ prometheus-pushgateway-0.3.1+ds/.promu.yml 2016-12-26 01:13:50.000000000 +0000 @@ -1,4 +1,3 @@ -go: 1.6.2 repository: path: github.com/prometheus/pushgateway build: diff -Nru prometheus-pushgateway-0.3.0+ds/README.md prometheus-pushgateway-0.3.1+ds/README.md --- prometheus-pushgateway-0.3.0+ds/README.md 2016-06-14 13:27:33.000000000 +0000 +++ prometheus-pushgateway-0.3.1+ds/README.md 2016-12-26 01:13:50.000000000 +0000 @@ -1,5 +1,6 @@ -# Prometheus Pushgateway [![Build Status](https://travis-ci.org/prometheus/pushgateway.svg)][travis] +# Prometheus Pushgateway +[![Build Status](https://travis-ci.org/prometheus/pushgateway.svg)][travis] [![CircleCI](https://circleci.com/gh/prometheus/pushgateway/tree/master.svg?style=shield)][circleci] [![Docker Repository on Quay](https://quay.io/repository/prometheus/pushgateway/status)][quay] [![Docker Pulls](https://img.shields.io/docker/pulls/prom/pushgateway.svg?maxAge=604800)][hub] @@ -10,19 +11,32 @@ to a Pushgateway. The Pushgateway then exposes these metrics to Prometheus. -The Pushgateway is explicitly not an aggregator, but rather a metrics -cache. It does not have a statsd-like semantics. The metrics pushed -are exactly the same as you would present for scraping in a -permanently running program. +## Non-goals + +The Pushgateway is explicitly not an _aggregator or distributed counter_ but +rather a metrics cache. It does not have a statsd-like semantics. The metrics +pushed are exactly the same as you would present for scraping in a permanently +running program. For machine-level metrics, the [textfile](https://github.com/prometheus/node_exporter/blob/master/README.md#textfile-collector) -collector of the Node exporter is usually more appropriate. The Pushgateway is best -used for service-level metrics. +collector of the Node exporter is usually more appropriate. The Pushgateway is +intended for service-level metrics. + +The Pushgateway is not an _event store_. While you can use Prometheus as a data +source for +[Grafana annotations](http://docs.grafana.org/reference/annotations/), tracking +something like release events has to happen with some event-logging framework. + ## Run it -Compile the binary using the provided Makefile (type `make`). +Download binary releases for your platform from the +[release page](https://github.com/prometheus/pushgateway/releases) and unpack +the tarball. + +If you want to compile yourself from the sources, you need a working Go +setup. Then use the provided Makefile (type `make`). For the most basic setup, just start the binary. To change the address to listen on, use the `-web.listen-address` flag. The `-persistence.file` flag @@ -31,6 +45,13 @@ ## Use it +### Configure the Pushgateway as a target to scrape + +The Pushgateway has to be configured as a target to scrape by Prometheus, using +one of the usual methods. _However, you should always set `honor_labels: true` +in the scrape config_ (see [below](#about-the-job-and-instance-labels) for a +detailed explanation). + ### Libraries Prometheus client libraries should have a feature to push the @@ -83,34 +104,44 @@ curl -X DELETE http://pushgateway.example.org:9091/metrics/job/some_job -### About the instance label +### About the job and instance labels -The Prometheus server will attach an `instance` label to each scraped -metric that does not already have one. The automatically attached -instance label contains the host and port of the target scraped. If a -metric already has an instance label, an `exporter_instance` label is -attached instead. (This behavior will be configurable once -[server issue #490](https://github.com/prometheus/prometheus/issues/490) is -fixed.) - -However, metrics pushed to the Pushgateway are often on a service -level and therefore not related to a particular instance. Not -attaching an instance label in that case is not an option because the -server will then attach the host and port of the Pushgateway as an -instance label (which is actually desired for metrics about the state -of the Pushgateway itself). - -Therefore, if a metric is pushed to the Pushgateway without an -instance label (and without instance label in the grouping key, see -below), the Pushgateway will export it with an emtpy instance label -(`{instance=""}`). +The Prometheus server will attach a `job` label and an `instance` label to each +scraped metric. The value of the `job` label comes from the scrape +configuration. When you configure the Pushgateway as a scrape target for your +Prometheus server, you will probably pick a job name like `pushgateway`. The +value of the `instance` label is automatically set to the host and port of the +target scraped. Hence, all the metrics scraped from the Pushgateway will have +the host and port of the Pushgateway as the `instance` label and a `job` label +like `pushgateway`. The conflict with the `job` and `instance` labels you might +have attached to the metrics pushed to the Pushgateway is solved by renaming +those labels to `exported_job` and `exported_instance`. + +However, this behavior is usually undesired when scraping a +Pushgateway. Generally, you would like to retain the `job` and `instance` +labels of the metrics pushed to the Pushgateway. That's why you have set +`honor_labels: true` in the scrape config for the Pushgateway. It enables the +desired behavior. See the +[documentation](https://prometheus.io/docs/operating/configuration/#scrape_config) +for details. + +This leaves us with the case where the metrics pushed to the Pushgateway do not +feature an `instance` label. This case is quite commen as the pushed metrics +are often on a service level and therefore not related to a particular +instance. Even with `honor_labels: true`, the Prometheus server will attach an +`instance` label if no `instance` label has been set in the first +place. Therefore, if a metric is pushed to the Pushgateway without an instance +label (and without instance label in the grouping key, see below), the +Pushgateway will export it with an emtpy instance label (`{instance=""}`), +which is equivalent to having no `instance` label at all but prevents the +server from attaching one. ### About timestamps -If you push metrics at time *t1*, you might be tempted to -believe that Prometheus will scrape them with that same timestamp -*t1*. Instead, what Prometheus attaches as a timestamp is -the time when it scrapes the push gateway. Why so? +If you push metrics at time *t*1, you might be tempted to believe +that Prometheus will scrape them with that same timestamp +*t*1. Instead, what Prometheus attaches as a timestamp is the time +when it scrapes the Pushgateway. Why so? In the world view of Prometheus, a metric can be scraped at any time. A metric that cannot be scraped has basically ceased to @@ -282,4 +313,4 @@ [travis]: https://travis-ci.org/prometheus/pushgateway [hub]: https://hub.docker.com/r/prom/pushgateway/ [circleci]: https://circleci.com/gh/prometheus/pushgateway -[quay]: https://quay.io/repository/prometheus/pushgateway \ No newline at end of file +[quay]: https://quay.io/repository/prometheus/pushgateway diff -Nru prometheus-pushgateway-0.3.0+ds/storage/diskmetricstore.go prometheus-pushgateway-0.3.1+ds/storage/diskmetricstore.go --- prometheus-pushgateway-0.3.0+ds/storage/diskmetricstore.go 2016-06-14 13:27:33.000000000 +0000 +++ prometheus-pushgateway-0.3.1+ds/storage/diskmetricstore.go 2016-12-26 01:13:50.000000000 +0000 @@ -246,7 +246,11 @@ } inProgressFileName := f.Name() e := gob.NewEncoder(f) - if err := e.Encode(dms.metricGroups); err != nil { + + dms.lock.RLock() + err = e.Encode(dms.metricGroups) + dms.lock.RUnlock() + if err != nil { f.Close() os.Remove(inProgressFileName) return err diff -Nru prometheus-pushgateway-0.3.0+ds/VERSION prometheus-pushgateway-0.3.1+ds/VERSION --- prometheus-pushgateway-0.3.0+ds/VERSION 2016-06-14 13:27:33.000000000 +0000 +++ prometheus-pushgateway-0.3.1+ds/VERSION 2016-12-26 01:13:50.000000000 +0000 @@ -1 +1 @@ -0.3.0 +0.3.1