Merge autopkgtest-cloud:instance-cleanup-client-error into autopkgtest-cloud:master

Proposed by Brian Murray
Status: Merged
Merge reported by: Brian Murray
Merged at revision: 3b507b88e0f150b48dcd679e570ef54da340c653
Proposed branch: autopkgtest-cloud:instance-cleanup-client-error
Merge into: autopkgtest-cloud:master
Diff against target: 22 lines (+6/-1)
1 file modified
charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/tools/cleanup-instances (+6/-1)
Reviewer Review Type Date Requested Status
Paride Legovini Approve
Ubuntu Release Team Pending
Review via email: mp+426989@code.launchpad.net

Description of the change

The cleanup-instances script was not cleaning up instances because it was unable to write to the influx database as we hit the same limit as earlier but with "max-values-per-tag".

To post a comment you must log in.
Revision history for this message
Brian Murray (brian-murray) wrote :

Here's an example of logging the error:

Jul 15 23:58:11 juju-4d1272-prod-proposed-migration-9 cloud-worker-maintenance[2674356]: WARNING:root:Unable to write to InfluxDB: 400: {"error":"partial write: max-values-per-tag limit exceeded (100000/100000): measurement=\"autopkgtest_delete_event\" tag=\"message\" value=\"instance adt-kinetic-arm64-libdata-phrasebook-perl-20220616-020233-juju-4d1272-prod-proposed-migration-9 (833ad1be-fa29-49ab-bcef-89b9b4b62597) is 717.9 hours old, deleting\" dropped=2"}

2b81192... by Brian Murray

Log the error we encountered.

3b507b8... by Brian Murray

Change error message to match the worker one

Revision history for this message
Paride Legovini (paride) wrote :

LGTM, thanks!

review: Approve
Revision history for this message
Brian Murray (brian-murray) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/tools/cleanup-instances b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/tools/cleanup-instances
2index f2910ad..1d0e871 100755
3--- a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/tools/cleanup-instances
4+++ b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/tools/cleanup-instances
5@@ -10,6 +10,7 @@ from urllib.error import HTTPError
6
7 import novaclient.client, novaclient.exceptions
8 from influxdb import InfluxDBClient
9+from influxdb.exceptions import InfluxDBClientError
10 from keystoneauth1 import session
11 from keystoneauth1.identity import v2, v3
12
13@@ -178,4 +179,8 @@ for instance in nova.servers.list():
14 logging.warning("instance %s has invalid name" % instance.name)
15
16 if measurements and influx_client:
17- influx_client.write_points(measurements)
18+ try:
19+ influx_client.write_points(measurements)
20+ except InfluxDBClientError as err:
21+ logging.warning("Write to InfluxDB failed: %s" % err)
22+ pass

Subscribers

People subscribed via source and target branches