diff --git a/.buildkite/setup.yml b/.buildkite/setup.yml index 6a200def16..6ee802b352 100644 --- a/.buildkite/setup.yml +++ b/.buildkite/setup.yml @@ -1,6 +1,6 @@ - label: Prepare scion_base and scion images command: - - ./tools/ci/prepare_image d1706fb3c9c8eacdc9a91ddeac7c3ac1ad815fe43fc81bd50a280b3738ce7569 + - ./tools/ci/prepare_image 12897905098b25a493ecf876d0a3ab355521d0f2e8044eae3c0cfda8714b7339 - ./docker.sh build concurrency: 1 concurrency_group: "build-scion" diff --git a/.circleci/config.yml b/.circleci/config.yml index 5e4d30ec84..821faf3d0a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,7 +25,7 @@ jobs: command: sudo apt-get update && sudo ./tools/install_docker - run: name: Pull and tag scion_base image - command: ./tools/ci/prepare_image d1706fb3c9c8eacdc9a91ddeac7c3ac1ad815fe43fc81bd50a280b3738ce7569 + command: ./tools/ci/prepare_image 12897905098b25a493ecf876d0a3ab355521d0f2e8044eae3c0cfda8714b7339 when: always - run: name: Build scion:latest image diff --git a/go/border/metrics/metrics.go b/go/border/metrics/metrics.go index d172696099..d81835ca94 100644 --- a/go/border/metrics/metrics.go +++ b/go/border/metrics/metrics.go @@ -72,26 +72,18 @@ func Init(elem string) { // Some closures to reduce boiler-plate. newCVec := func(name, help string, lNames []string) *prometheus.CounterVec { - v := prom.NewCounterVec(namespace, "", name, help, constLabels, lNames) - prometheus.MustRegister(v) - return v + return prom.NewCounterVec(namespace, "", name, help, constLabels, lNames) } newG := func(name, help string) prometheus.Gauge { - v := prom.NewGauge(namespace, "", name, help, constLabels) - prometheus.MustRegister(v) - return v + return prom.NewGauge(namespace, "", name, help, constLabels) } newGVec := func(name, help string, lNames []string) *prometheus.GaugeVec { - v := prom.NewGaugeVec(namespace, "", name, help, constLabels, lNames) - prometheus.MustRegister(v) - return v + return prom.NewGaugeVec(namespace, "", name, help, constLabels, lNames) } newHVec := func(name, help string, lNames []string, buckets []float64) *prometheus.HistogramVec { - v := prom.NewHistogramVec(namespace, "", name, help, constLabels, lNames, buckets) - prometheus.MustRegister(v) - return v + return prom.NewHistogramVec(namespace, "", name, help, constLabels, lNames, buckets) } InputPkts = newCVec("input_pkts_total", "Total number of input packets received.", sockLabels) diff --git a/go/lib/prom/prom.go b/go/lib/prom/prom.go index a5f6719e6f..60575cd9d4 100644 --- a/go/lib/prom/prom.go +++ b/go/lib/prom/prom.go @@ -1,4 +1,5 @@ // Copyright 2017 ETH Zurich +// Copyright 2018 ETH Zurich, Anapaya Systems // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,6 +19,7 @@ package prom import ( "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promauto" ) func CopyLabels(labels prometheus.Labels) prometheus.Labels { @@ -28,9 +30,10 @@ func CopyLabels(labels prometheus.Labels) prometheus.Labels { return l } +// NewCounter creates a new prometheus counter that is registered with the default registry. func NewCounter(namespace, subsystem, name, help string, constLabels prometheus.Labels) prometheus.Counter { - return prometheus.NewCounter( + return promauto.NewCounter( prometheus.CounterOpts{ Namespace: namespace, Subsystem: subsystem, @@ -41,9 +44,10 @@ func NewCounter(namespace, subsystem, name, help string, ) } +// NewCounterVec creates a new prometheus counter vec that is registered with the default registry. func NewCounterVec(namespace, subsystem, name, help string, constLabels prometheus.Labels, labelNames []string) *prometheus.CounterVec { - return prometheus.NewCounterVec( + return promauto.NewCounterVec( prometheus.CounterOpts{ Namespace: namespace, Subsystem: subsystem, @@ -55,9 +59,10 @@ func NewCounterVec(namespace, subsystem, name, help string, ) } +// NewGauge creates a new prometheus gauge that is registered with the default registry. func NewGauge(namespace, subsystem, name, help string, constLabels prometheus.Labels) prometheus.Gauge { - return prometheus.NewGauge( + return promauto.NewGauge( prometheus.GaugeOpts{ Namespace: namespace, Subsystem: subsystem, @@ -67,9 +72,11 @@ func NewGauge(namespace, subsystem, name, help string, }, ) } + +// NewGaugeVec creates a new prometheus gauge vec that is registered with the default registry. func NewGaugeVec(namespace, subsystem, name, help string, constLabels prometheus.Labels, labelNames []string) *prometheus.GaugeVec { - return prometheus.NewGaugeVec( + return promauto.NewGaugeVec( prometheus.GaugeOpts{ Namespace: namespace, Subsystem: subsystem, @@ -81,9 +88,11 @@ func NewGaugeVec(namespace, subsystem, name, help string, ) } +// NewHistogramVec creates a new prometheus histogram vec +// that is registered with the default registry. func NewHistogramVec(namespace, subsystem, name, help string, constLabels prometheus.Labels, labelNames []string, buckets []float64) *prometheus.HistogramVec { - return prometheus.NewHistogramVec( + return promauto.NewHistogramVec( prometheus.HistogramOpts{ Namespace: namespace, Subsystem: subsystem, diff --git a/go/lib/ringbuf/metrics.go b/go/lib/ringbuf/metrics.go index b99bd0c34a..08db99e2a1 100644 --- a/go/lib/ringbuf/metrics.go +++ b/go/lib/ringbuf/metrics.go @@ -1,4 +1,5 @@ // Copyright 2017 ETH Zurich +// Copyright 2018 ETH Zurich, Anapaya Systems // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -32,19 +33,13 @@ var UsedEntries *prometheus.GaugeVec func InitMetrics(namespace string, constLabels prometheus.Labels, labelNames []string) { lNames := append(labelNames, "desc") newCVec := func(name, help string) *prometheus.CounterVec { - v := prom.NewCounterVec(namespace, "ringbuf", name, help, constLabels, lNames) - prometheus.MustRegister(v) - return v + return prom.NewCounterVec(namespace, "ringbuf", name, help, constLabels, lNames) } newGVec := func(name, help string) *prometheus.GaugeVec { - v := prom.NewGaugeVec(namespace, "ringbuf", name, help, constLabels, lNames) - prometheus.MustRegister(v) - return v + return prom.NewGaugeVec(namespace, "ringbuf", name, help, constLabels, lNames) } newHVec := func(name, help string, buckets []float64) *prometheus.HistogramVec { - v := prom.NewHistogramVec(namespace, "ringbuf", name, help, constLabels, lNames, buckets) - prometheus.MustRegister(v) - return v + return prom.NewHistogramVec(namespace, "ringbuf", name, help, constLabels, lNames, buckets) } WriteCalls = newCVec("write_calls_total", "Number of calls to Write.") ReadCalls = newCVec("read_calls_total", "Number of calls to Read.") @@ -63,8 +58,8 @@ type metrics struct { readCalls prometheus.Counter writesBlocked prometheus.Counter readsBlocked prometheus.Counter - writeEntries prometheus.Histogram - readEntries prometheus.Histogram + writeEntries prometheus.Observer + readEntries prometheus.Observer maxEntries prometheus.Gauge usedEntries prometheus.Gauge } diff --git a/go/sig/metrics/metrics.go b/go/sig/metrics/metrics.go index 4f45ac274e..2775555c75 100644 --- a/go/sig/metrics/metrics.go +++ b/go/sig/metrics/metrics.go @@ -65,14 +65,10 @@ func Init(elem string) { // Some closures to reduce boiler-plate. newC := func(name, help string) prometheus.Counter { - v := prom.NewCounter(namespace, "", name, help, constLabels) - prometheus.MustRegister(v) - return v + return prom.NewCounter(namespace, "", name, help, constLabels) } newCVec := func(name, help string, lNames []string) *prometheus.CounterVec { - v := prom.NewCounterVec(namespace, "", name, help, constLabels, lNames) - prometheus.MustRegister(v) - return v + return prom.NewCounterVec(namespace, "", name, help, constLabels, lNames) } // FIXME(kormat): these metrics should probably have more informative labels PktsRecv = newCVec("pkts_recv_total", "Number of packets received.", iaLabels) diff --git a/go/vendor/vendor.json b/go/vendor/vendor.json index 06cc7493e1..0da853648a 100644 --- a/go/vendor/vendor.json +++ b/go/vendor/vendor.json @@ -363,18 +363,30 @@ "revisionTime": "2017-07-14T08:24:55Z" }, { - "checksumSHA1": "Ph+qmEo8RdBKBHZUhx0y5Oyk/U0=", + "checksumSHA1": "JKm/LRfEg6/MwrN6bdjRSHnWazM=", "license": "APL 2.0", "path": "github.com/prometheus/client_golang/prometheus", - "revision": "334af0119a8f8fb6af5bb950d535c482cac7f836", - "revisionTime": "2016-10-17T12:35:36Z" + "revision": "abad2d1bd44235a26707c172eab6bca5bf2dbad3", + "revisionTime": "2018-11-03T14:23:28Z" }, { - "checksumSHA1": "lG3//eDlwqA4IOuAPrNtLh9G0TA=", + "checksumSHA1": "UBqhkyjCz47+S19MVTigxJ2VjVQ=", + "path": "github.com/prometheus/client_golang/prometheus/internal", + "revision": "abad2d1bd44235a26707c172eab6bca5bf2dbad3", + "revisionTime": "2018-11-03T14:23:28Z" + }, + { + "checksumSHA1": "BFMAsj5z3cYaNKx9fwHrazQRFvI=", + "path": "github.com/prometheus/client_golang/prometheus/promauto", + "revision": "abad2d1bd44235a26707c172eab6bca5bf2dbad3", + "revisionTime": "2018-11-03T14:23:28Z" + }, + { + "checksumSHA1": "wJzzub/0w2espYvar3lylwHXBAk=", "license": "APL 2.0", "path": "github.com/prometheus/client_golang/prometheus/promhttp", - "revision": "334af0119a8f8fb6af5bb950d535c482cac7f836", - "revisionTime": "2016-10-17T12:35:36Z" + "revision": "abad2d1bd44235a26707c172eab6bca5bf2dbad3", + "revisionTime": "2018-11-03T14:23:28Z" }, { "checksumSHA1": "DvwvOlPNAgRntBzt3b3OSRMS2N4=", @@ -384,32 +396,50 @@ "revisionTime": "2015-02-12T10:17:44Z" }, { - "checksumSHA1": "mHyjbJ3BWOfUV6q9f5PBt0gaY1k=", + "checksumSHA1": "ljxJzXiQ7dNsmuRIUhqqP+qjRWc=", "license": "APL 2.0", "path": "github.com/prometheus/common/expfmt", - "revision": "85637ea67b04b5c3bb25e671dacded2977f8f9f6", - "revisionTime": "2016-10-02T21:02:34Z" + "revision": "0b1957f9d949dfa3084171a6ec5642b38055276a", + "revisionTime": "2018-11-09T10:09:15Z" }, { "checksumSHA1": "GWlM3d2vPYyNATtTFgftS10/A9w=", "license": "3-BSD", "path": "github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg", - "revision": "85637ea67b04b5c3bb25e671dacded2977f8f9f6", - "revisionTime": "2016-10-02T21:02:34Z" + "revision": "0b1957f9d949dfa3084171a6ec5642b38055276a", + "revisionTime": "2018-11-09T10:09:15Z" }, { - "checksumSHA1": "nFie+rxcX5WdIv1diZ+fu3aj6lE=", + "checksumSHA1": "ewHRWF7p/HQeh7RowZg5BUeDkdY=", "license": "APL 2.0", "path": "github.com/prometheus/common/model", - "revision": "85637ea67b04b5c3bb25e671dacded2977f8f9f6", - "revisionTime": "2016-10-02T21:02:34Z" + "revision": "0b1957f9d949dfa3084171a6ec5642b38055276a", + "revisionTime": "2018-11-09T10:09:15Z" }, { - "checksumSHA1": "W218eJZPXJG783fUr/z6IaAZyes=", + "checksumSHA1": "4zOdjJcskuocAzI+i6rcRzYjSlI=", "license": "APL 2.0", "path": "github.com/prometheus/procfs", - "revision": "abf152e5f3e97f2fafac028d2cc06c1feb87ffa5", - "revisionTime": "2016-04-11T19:08:41Z" + "revision": "185b4288413d2a0dd0806f78c90dde719829e5ae", + "revisionTime": "2018-10-05T14:02:18Z" + }, + { + "checksumSHA1": "8E1IbrgtLBee7J404VKPyoI+qsk=", + "path": "github.com/prometheus/procfs/internal/util", + "revision": "185b4288413d2a0dd0806f78c90dde719829e5ae", + "revisionTime": "2018-10-05T14:02:18Z" + }, + { + "checksumSHA1": "HSP5hVT0CNMRa8+Xtz4z2Ic5U0E=", + "path": "github.com/prometheus/procfs/nfs", + "revision": "185b4288413d2a0dd0806f78c90dde719829e5ae", + "revisionTime": "2018-10-05T14:02:18Z" + }, + { + "checksumSHA1": "yItvTQLUVqm/ArLEbvEhqG0T5a0=", + "path": "github.com/prometheus/procfs/xfs", + "revision": "185b4288413d2a0dd0806f78c90dde719829e5ae", + "revisionTime": "2018-10-05T14:02:18Z" }, { "checksumSHA1": "6AYg4fjEvFuAVN3wHakGApjhZAM=",