Merge ~ballot/prometheus-snap/+git/prometheus-snap:upgrade_2.34.0 into prometheus-snap:master

Proposed by Benjamin Allot
Status: Merged
Approved by: Benjamin Allot
Approved revision: c99ed25ab7bfa0d149c8f955f0a528ac7eed0c52
Merged at revision: b326947f1ec8cde1438549d22c053f3063c68259
Proposed branch: ~ballot/prometheus-snap/+git/prometheus-snap:upgrade_2.34.0
Merge into: prometheus-snap:master
Diff against target: 301 lines (+82/-164)
4 files modified
.gitignore (+1/-0)
daemon_arguments (+41/-136)
snap_config_wrapper (+1/-1)
snapcraft.yaml (+39/-27)
Reviewer Review Type Date Requested Status
Barry Price Approve
Review via email: mp+418885@code.launchpad.net

Commit message

Updating prometheus to 2.34.0 and removing the workaround for non-amd64

To post a comment you must log in.
Revision history for this message
Barry Price (barryprice) wrote :

Could shellcheck the override-build script, and would be nice to get onto Go 1.18, but I think we can circle back to those, this is still worth landing to get a newer prometheus and fix the other issues

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/.gitignore b/.gitignore
2index 252d247..e9d9154 100644
3--- a/.gitignore
4+++ b/.gitignore
5@@ -1,4 +1,5 @@
6 /*.snap
7+/snap/
8 /parts/
9 /stage/
10 /prime/
11diff --git a/daemon_arguments b/daemon_arguments
12index a1a8e21..6bb5f84 100644
13--- a/daemon_arguments
14+++ b/daemon_arguments
15@@ -4,140 +4,45 @@ ARGS=""
16 ##############################################################################
17 # WARNINIG: Due to snap confinement the following options should not be set: #
18 ##############################################################################
19-# -config.file
20-# -storage.local.path
21+# --config.file
22+# --storage.tsdb.path
23
24-
25-# Prometheus supports the following options:
26-# -log.level "info"
27-# Only log messages with the given severity or above. Valid levels:
28-# [debug, info, warn, error, fatal, panic].
29-#
30-# == ALERTMANAGER ==
31-#
32-# -alertmanager.http-deadline 10s
33-# Alert manager HTTP API timeout.
34-#
35-# -alertmanager.notification-queue-capacity 100
36-# The capacity of the queue for pending alert manager notifications.
37-#
38-# -alertmanager.url
39-# The URL of the alert manager to send notifications to.
40-#
41-# == QUERY ==
42-#
43-# -query.max-concurrency 20
44-# Maximum number of queries executed concurrently.
45-#
46-# -query.staleness-delta 5m0s
47-# Staleness delta allowance during expression evaluations.
48-#
49-# -query.timeout 2m0s
50-# Maximum time a query may take before being aborted.
51-#
52-# == STORAGE ==
53-#
54-# -storage.local.checkpoint-dirty-series-limit 5000
55-# If approx. that many time series are in a state that would require
56-# a recovery operation after a crash, a checkpoint is triggered, even if
57-# the checkpoint interval hasn't passed yet. A recovery operation requires
58-# a disk seek. The default limit intends to keep the recovery time below
59-# 1min even on spinning disks. With SSD, recovery is much faster, so you
60-# might want to increase this value in that case to avoid overly frequent
61-# checkpoints.
62-#
63-# -storage.local.checkpoint-interval 5m0s
64-# The period at which the in-memory metrics and the chunks not yet
65-# persisted to series files are checkpointed.
66-#
67-# -storage.local.chunk-encoding-version 1
68-# Which chunk encoding version to use for newly created chunks.
69-# Currently supported is 0 (delta encoding) and 1 (double-delta encoding).
70-#
71-# -storage.local.dirty false
72-# If set, the local storage layer will perform crash recovery even if
73-# the last shutdown appears to be clean.
74-#
75-# -storage.local.index-cache-size.fingerprint-to-metric 10485760
76-# The size in bytes for the fingerprint to metric index cache.
77-#
78-# -storage.local.index-cache-size.fingerprint-to-timerange 5242880
79-# The size in bytes for the metric time range index cache.
80-#
81-# -storage.local.index-cache-size.label-name-to-label-values 10485760
82-# The size in bytes for the label name to label values index cache.
83-#
84-# -storage.local.index-cache-size.label-pair-to-fingerprints 20971520
85-# The size in bytes for the label pair to fingerprints index cache.
86-#
87-# -storage.local.max-chunks-to-persist 1048576
88-# How many chunks can be waiting for persistence before sample
89-# ingestion will stop. Many chunks waiting to be persisted will increase
90-# the checkpoint size.
91-#
92-# -storage.local.memory-chunks 1048576
93-# How many chunks to keep in memory. While the size of a chunk is
94-# 1kiB, the total memory usage will be significantly higher than this value
95-# * 1kiB. Furthermore, for various reasons, more chunks might have to be
96-# kept in memory temporarily.
97-#
98-# -storage.local.pedantic-checks false
99-# If set, a crash recovery will perform checks on each series file.
100-# This might take a very long time.
101-#
102-# -storage.local.retention 360h0m0s
103-# How long to retain samples in the local storage.
104-#
105-# -storage.local.series-sync-strategy "adaptive"
106-# When to sync series files after modification. Possible values:
107-# 'never', 'always', 'adaptive'. Sync'ing slows down storage performance
108-# but reduces the risk of data loss in case of an OS crash. With the
109-# 'adaptive' strategy, series files are sync'd for as long as the storage
110-# is not too much behind on chunk persistence.
111-#
112-# -storage.remote.influxdb-url
113-# The URL of the remote InfluxDB server to send samples to. None, if
114-# empty.
115-#
116-# -storage.remote.influxdb.database "prometheus"
117-# The name of the database to use for storing samples in InfluxDB.
118-#
119-# -storage.remote.influxdb.retention-policy "default"
120-# The InfluxDB retention policy to use.
121-#
122-# -storage.remote.opentsdb-url
123-# The URL of the remote OpenTSDB server to send samples to. None, if
124-# empty.
125-#
126-# -storage.remote.timeout 30s
127-# The timeout to use when sending samples to the remote storage.
128-#
129-# == WEB ==
130-#
131-# -web.console.libraries "/etc/prometheus/console_libraries"
132-# Path to the console library directory.
133-#
134-# -web.console.templates "/etc/prometheus/consoles"
135-# Path to the console template directory, available at /consoles.
136-#
137-# -web.enable-remote-shutdown false
138-# Enable remote service shutdown.
139-#
140-# -web.external-url
141-# The URL under which Prometheus is externally reachable (for
142-# example, if Prometheus is served via a reverse proxy). Used for
143-# generating relative and absolute links back to Prometheus itself. If
144-# omitted, relevant URL components will be derived automatically.
145-#
146-# -web.listen-address ":9090"
147-# Address to listen on for the web interface, API, and telemetry.
148-#
149-# -web.local-assets "/usr/share/prometheus/web/"
150-# Path to static assets/templates directory.
151-#
152-# -web.telemetry-path "/metrics"
153-# Path under which to expose metrics.
154-#
155-# -web.user-assets
156-# Path to static asset directory, available at /user.
157-#
158+# Flags supported by the charm:
159+# --web.listen-address="0.0.0.0:9090"
160+# Address to listen on for UI, API, and telemetry.
161+# --web.read-timeout=5m Maximum duration before timing out read of the request,
162+# and closing idle connections.
163+# --web.max-connections=512 Maximum number of simultaneous connections.
164+# --web.external-url=<URL> The URL under which Prometheus is externally reachable (for example, if Prometheus
165+# is served via a reverse proxy). Used for generating relative and absolute links back
166+# to Prometheus itself. If the URL has a path portion, it will be used to prefix all
167+# HTTP endpoints served by Prometheus. If omitted, relevant URL components will be
168+# derived automatically.
169+# --web.route-prefix=<path> Prefix for the internal routes of web endpoints.
170+# Defaults to path of --web.external-url.
171+# --web.user-assets=<path> Path to static asset directory, available at /user.
172+# --web.enable-lifecycle Enable shutdown and reload via HTTP request.
173+# --web.enable-admin-api Enables API endpoints for admin control actions.
174+# --web.console.templates="consoles"
175+# Path to the console template directory, available at /consoles.
176+# --web.console.libraries="console_libraries"
177+# Path to the console library directory.
178+# --storage.tsdb.min-block-duration=2h
179+# Minimum duration of a data block before being persisted.
180+# --storage.tsdb.max-block-duration=<duration>
181+# Maximum duration compacted blocks may span. (Defaults to
182+# 10% of the retention period)
183+# --storage.tsdb.retention=15d
184+# How long to retain samples in the storage.
185+# --storage.tsdb.no-lockfile
186+# Do not create lockfile in data directory.
187+# --alertmanager.notification-queue-capacity=10000
188+# The capacity of the queue for pending alert manager notifications.
189+# --alertmanager.timeout=10s
190+# Timeout for sending alerts to Alertmanager.
191+# --query.lookback-delta=5m The delta difference allowed for retrieving metrics during expression evaluations.
192+# --query.timeout=2m Maximum time a query may take before being aborted.
193+# --query.max-concurrency=20
194+# Maximum number of queries executed concurrently.
195+# --log.level=info Only log messages with the given severity or above.
196+# One of: [debug, info, warn, error]
197diff --git a/snap_config_wrapper b/snap_config_wrapper
198index 0283233..ae4d288 100755
199--- a/snap_config_wrapper
200+++ b/snap_config_wrapper
201@@ -6,4 +6,4 @@ test -d $SNAP_DATA/promreg || mkdir $SNAP_DATA/promreg
202
203 ulimit -n 65536
204 . $SNAP_DATA/daemon_arguments
205-$SNAP/bin/prometheus $ARGS -config.file=$SNAP_DATA/prometheus.yml -storage.local.path=$SNAP_COMMON
206+$SNAP/bin/prometheus $ARGS --config.file=$SNAP_DATA/prometheus.yml --storage.tsdb.path=$SNAP_COMMON
207diff --git a/snapcraft.yaml b/snapcraft.yaml
208index f721fc7..f902a31 100644
209--- a/snapcraft.yaml
210+++ b/snapcraft.yaml
211@@ -1,51 +1,63 @@
212 name: prometheus
213-version: 1.8.2
214+version: 2.34.0
215+base: core20
216 grade: stable
217 summary: The Prometheus monitoring system and time series database
218 description: |
219 Prometheus is a systems and service monitoring system. It collects metrics from configured targets at given intervals, evaluates rule expressions, displays the results, and can trigger alerts if some condition is observed to be true.
220 confinement: strict
221+architectures:
222+ - build-on: amd64
223+ - build-on: arm64
224+ - build-on: ppc64el
225+ - build-on: s390x
226+
227 apps:
228 prometheus:
229 command: 'bin/prometheus.wrapper'
230 plugs: [network-bind, network, content]
231 daemon: simple
232- stop-timeout: 1800s
233+ stop-timeout: 900s
234 promtool:
235+ plugs: [home]
236 command: 'bin/promtool'
237 plugs:
238 content:
239+ interface: content
240 content: promreg
241 target: $SNAP_DATA/promreg
242+
243 parts:
244 prometheus:
245 plugin: go
246+ go-channel: 1.18/stable
247 source: https://github.com/prometheus/prometheus.git
248- source-tag: v1.8.2
249- go-importpath: github.com/prometheus/prometheus
250- build-packages: [golang-1.8]
251- build: |
252- # Make sure we use go 1.8
253- export "PATH=/usr/lib/go-1.8/bin/:$PATH"
254- export "GOPATH=$PWD/../go" "PATH=$PATH:$PWD/../go/bin"
255- cd ../go/src/github.com/prometheus/prometheus/
256- make promu
257- make build
258- install: |
259- mkdir $SNAPCRAFT_PART_INSTALL/bin
260- cp -p $SNAPCRAFT_PART_INSTALL/../src/promtool $SNAPCRAFT_PART_INSTALL/bin/
261- cp -p $SNAPCRAFT_PART_INSTALL/../src/prometheus $SNAPCRAFT_PART_INSTALL/bin/
262- example-config:
263- plugin: dump
264- source: https://github.com/prometheus/prometheus.git
265- source-tag: v1.8.2
266- source-type: git
267- organize:
268- documentation/examples/prometheus.yml: etc/prometheus/prometheus.yml.example
269- stage:
270- - etc/prometheus/prometheus.yml.example
271- prime:
272- - etc/prometheus/prometheus.yml.example
273+ source-tag: v${SNAPCRAFT_PROJECT_VERSION}
274+ build-packages: [build-essential, curl, make, wget]
275+ override-build: |
276+ set -x
277+ NODE_VERSION=16.14.0
278+ NODE_ARCH=$(dpkg --print-architecture)
279+ case "${NODE_ARCH}" in
280+ "amd64")
281+ NODE_ARCH="x64"
282+ ;;
283+ "ppc64el")
284+ NODE_ARCH="ppc64le"
285+ ;;
286+ esac
287+ wget https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.xz
288+ mkdir -p /usr/local/lib/nodejs
289+ tar xf node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.xz -C /usr/local/lib/nodejs
290+ export PATH=/usr/local/lib/nodejs/node-v${NODE_VERSION}-linux-${NODE_ARCH}/bin:$PATH
291+ npm install yarn -g
292+ make build
293+ make common-test-short
294+ mkdir -p "$SNAPCRAFT_PART_INSTALL/bin"
295+ mkdir -p "$SNAPCRAFT_PART_INSTALL/etc/prometheus"
296+ cp -p "$SNAPCRAFT_PART_BUILD/promtool" "$SNAPCRAFT_PART_INSTALL/bin/"
297+ cp -p "$SNAPCRAFT_PART_BUILD/prometheus" "$SNAPCRAFT_PART_INSTALL/bin/"
298+ cp -p "$SNAPCRAFT_PART_SRC/documentation/examples/prometheus.yml" "$SNAPCRAFT_PART_INSTALL/etc/prometheus/prometheus.yml.example"
299 snap-wrappers:
300 plugin: dump
301 source: .

Subscribers

People subscribed via source and target branches