Merge ~peppepetra/prometheus-openstack-exporter-snap:lp1998152 into prometheus-openstack-exporter-snap:master

Proposed by Giuseppe Petralia
Status: Needs review
Proposed branch: ~peppepetra/prometheus-openstack-exporter-snap:lp1998152
Merge into: prometheus-openstack-exporter-snap:master
Diff against target: 64 lines (+16/-7)
3 files modified
prometheus-openstack-exporter (+2/-6)
snap/snapcraft.yaml (+13/-0)
snap_cmd_wrapper (+1/-1)
Reviewer Review Type Date Requested Status
Erhan Sunar (community) Approve
Gabriel Cocenza (community) Approve
Martin Kalcok (community) Approve
Canonical IS SAs Pending
Review via email: mp+434246@code.launchpad.net

Commit message

Fix broken symlink python3 and unmet dependencies warnings.

To post a comment you must log in.
0a2d223... by Giuseppe Petralia

Fix exporter hitting systemd tasks limit.

Revision history for this message
Giuseppe Petralia (peppepetra) wrote :

This MP fixes the two issues reported on the bug.

1. Fix the broken symlinks to python3 so that now the exporter uses the python3 installed by the snap

2. Remove the usage of ForkingHTTPServer that is causing the exporter to fork a new thread on each execution and incrementing the tasks count until the limit is reached and then throws BlockingIOError

Test build: https://private-fileshare.canonical.com/~peppepetra/prometheus-openstack-exporter_0.1.9+git1.a696049-dirty_amd64.snap

2380c82... by Giuseppe Petralia

Replace the python38 stage snap with python3.8 stage-packages

Revision history for this message
Gabriel Cocenza (gabrielcocenza) wrote :

The patch LGTM, but I would like to ask a little change inline.

review: Needs Information
Revision history for this message
Martin Kalcok (martin-kalcok) wrote :

LGTM, thanks Giuseppe.

review: Approve
Revision history for this message
Giuseppe Petralia (peppepetra) wrote :

reply inline

e15f24f... by Giuseppe Petralia

Address review comments

Revision history for this message
Gabriel Cocenza (gabrielcocenza) wrote :

LGTM. Thanks

review: Approve
Revision history for this message
Erhan Sunar (esunar) :
review: Approve
Revision history for this message
Mustafa Kemal Gilor (mustafakemalgilor) wrote :

Hello,

Any ETA on when this is going to be merged?

Revision history for this message
Shunde Zhang (shunde-zhang) wrote (last edit ):

Hello,

Can we merge this and release the fix?
A customer is waiting for this.

Revision history for this message
Gabriel Cocenza (gabrielcocenza) wrote :

Hello folks.

A small mistake happened about this patch that was landed on launchpad when the repo is designed to use github[0].

I'll open a new PR on github and try to merge and release as soon as posible to have this fixed.

Thanks for the comprehension and I'll let you know when everything is fixed and released.

[0] https://github.com/canonical/prometheus-openstack-exporter

Revision history for this message
Chuan Li (lccn) wrote :

Hello,

Is there any update so far?
A customer is still waiting for this.

Revision history for this message
Gabriel Cocenza (gabrielcocenza) wrote :

Hello, it seems that version 0.1.10 that contains this patch is available since 28 July 2023 on the stable channel.

Thanks

Unmerged commits

e15f24f... by Giuseppe Petralia

Address review comments

2380c82... by Giuseppe Petralia

Replace the python38 stage snap with python3.8 stage-packages

0a2d223... by Giuseppe Petralia

Fix exporter hitting systemd tasks limit.

a696049... by Giuseppe Petralia

Fix broken symlink python3 and unmet dependencies warnings.

Closes-Bug: #1998152

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/prometheus-openstack-exporter b/prometheus-openstack-exporter
2index 72bb234..5cc300c 100755
3--- a/prometheus-openstack-exporter
4+++ b/prometheus-openstack-exporter
5@@ -1,4 +1,4 @@
6-#!/usr/bin/env python
7+#!/usr/bin/env python3
8 """
9 OpenStack exporter for the prometheus monitoring system.
10
11@@ -1008,10 +1008,6 @@ class SwiftAccountUsage:
12 return generate_latest(self.registry)
13
14
15-class ForkingHTTPServer(ForkingMixIn, HTTPServer): # noqa: D101
16- pass
17-
18-
19 # This could perhaps be cleverer, but surely not simpler.
20 COLLECTORS = {
21 "cinder": Cinder,
22@@ -1132,7 +1128,7 @@ if __name__ == "__main__":
23 if data_gatherer_needed(config):
24 data_gatherer = DataGatherer()
25 data_gatherer.start()
26- server = ForkingHTTPServer(("", config.get("listen_port")), handler)
27+ server = HTTPServer(("", config.get("listen_port")), handler)
28 server.timeout = config.get("cache_refresh_interval", 900)
29 while True:
30 sleep(0)
31diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
32index 6ae8945..37fdfb9 100644
33--- a/snap/snapcraft.yaml
34+++ b/snap/snapcraft.yaml
35@@ -22,6 +22,19 @@ parts:
36 stage-packages:
37 - libdb5.3
38 - liberasurecode-dev
39+ - libncursesw5
40+ - libtinfo5
41+ - libpython3-stdlib
42+ - libpython3.8-minimal
43+ - libpython3.8-stdlib
44+ - python3.8-minimal
45+ - python3-distutils
46+ - python3-minimal
47+ - python3-pkg-resources
48+ - python3-pip
49+ - python3-setuptools
50+ - python3-venv
51+ - python3-wheel
52 example-config:
53 plugin: dump
54 source: .
55diff --git a/snap_cmd_wrapper b/snap_cmd_wrapper
56index ef5611d..5ead4e8 100755
57--- a/snap_cmd_wrapper
58+++ b/snap_cmd_wrapper
59@@ -5,4 +5,4 @@
60 # Copy only if not existing
61 cp -pn $SNAP/etc/prometheus/prometheus-openstack-exporter.yaml.example $SNAP_DATA/prometheus-openstack-exporter.yaml
62 test -r $SNAP_DATA/admin.novarc && . $SNAP_DATA/admin.novarc
63-exec $SNAP/bin/prometheus-openstack-exporter $SNAP_DATA/prometheus-openstack-exporter.yaml
64+exec $SNAP/bin/python3 $SNAP/bin/prometheus-openstack-exporter $SNAP_DATA/prometheus-openstack-exporter.yaml

Subscribers

People subscribed via source and target branches