Browse Source

Merge "Update dib stats"

Zuul 2 weeks ago
parent
commit
ba8dd4a354

+ 20
- 10
doc/source/operation.rst View File

@@ -407,23 +407,33 @@ Nodepool builder
407 407
 .. zuul:stat:: nodepool.dib_image_build.<diskimage_name>.<ext>.size
408 408
    :type: gauge
409 409
 
410
-   This stat reports the size of the built image in bytes.
410
+   This stat reports the size of the built image in bytes.  ``ext`` is
411
+   based on the formats of the images created for the build, for
412
+   example ``qcow2``, ``raw``, ``vhd``, etc.
411 413
 
412
-.. zuul:stat:: nodepool.image_update.<image name>.<provider name>
413
-   :type: counter, timer
414
+.. zuul:stat:: nodepool.dib_image_build.<diskimage_name>.status.rc
415
+   :type: gauge
414 416
 
415
-   Number of image uploads to a specific provider in the cloud plus the time in
416
-   seconds spent to upload the image.
417
+   Return code of the last DIB run.  Zero is successful, non-zero is
418
+   unsuccessful.
419
+
420
+.. zuul:stat:: nodepool.dib_image_build.<diskimage_name>.status.duration
421
+   :type: timer
417 422
 
418
-.. zuul:stat:: nodepool.dib_image_build.<diskimage_name>.<ext>.rc
423
+   Time the last DIB run for this image build took, in ms
424
+
425
+.. zuul:stat:: nodepool.dib_image_build.<diskimage_name>.status.last_build
419 426
    :type: gauge
420 427
 
421
-   Return code of the DIB.
428
+   The UNIX timestamp of the last time a build for this image
429
+   returned.  This can be useful for presenting a relative time ("X
430
+   hours ago") in a dashboard.
422 431
 
423
-.. zuul:stat:: nodepool.dib_image_build.<diskimage_name>.<ext>.duration
424
-   :type: timer
432
+.. zuul:stat:: nodepool.image_update.<image name>.<provider name>
433
+   :type: counter, timer
425 434
 
426
-   Time the DIB run took in ms
435
+   Number of image uploads to a specific provider in the cloud plus the time in
436
+   seconds spent to upload the image.
427 437
 
428 438
 Nodepool launcher
429 439
 ~~~~~~~~~~~~~~~~~

+ 7
- 6
nodepool/builder.py View File

@@ -915,12 +915,13 @@ class BuildWorker(BaseWorker):
915 915
 
916 916
         if self._statsd:
917 917
             # report result to statsd
918
-            for ext in img_types.split(','):
919
-                key_base = 'nodepool.dib_image_build.%s.%s' % (
920
-                    diskimage.name, ext)
921
-                pipeline.gauge(key_base + '.rc', rc)
922
-                pipeline.timing(key_base + '.duration',
923
-                                int(build_time * 1000))
918
+            key_base = 'nodepool.dib_image_build.%s.status' % (
919
+                diskimage.name)
920
+            pipeline.timing(key_base + '.duration',
921
+                            int(build_time * 1000))
922
+            pipeline.gauge(key_base + '.rc', rc)
923
+            pipeline.gauge(key_base + '.last_build',
924
+                           int(time.time()))
924 925
             pipeline.send()
925 926
 
926 927
         return build_data

+ 8
- 4
nodepool/tests/unit/test_builder.py View File

@@ -309,10 +309,11 @@ class TestNodePoolBuilder(tests.DBTestCase):
309 309
         self.waitForImage('fake-provider', 'fake-image')
310 310
         # Make sure our cleanup worker properly removes the first build.
311 311
         self.waitForBuildDeletion('fake-image', '0000000001')
312
-        self.assertReportedStat('nodepool.dib_image_build.fake-image.qcow2.rc',
312
+        self.assertReportedStat('nodepool.dib_image_build.'
313
+                                'fake-image.status.rc',
313 314
                                 '127', 'g')
314 315
         self.assertReportedStat('nodepool.dib_image_build.'
315
-                                'fake-image.qcow2.duration', None, 'ms')
316
+                                'fake-image.status.duration', None, 'ms')
316 317
 
317 318
     def test_diskimage_build_only(self):
318 319
         configfile = self.setup_config('node_diskimage_only.yaml')
@@ -323,12 +324,15 @@ class TestNodePoolBuilder(tests.DBTestCase):
323 324
 
324 325
         self.assertEqual(build_tar._formats, ['tar'])
325 326
         self.assertEqual(build_default._formats, ['qcow2'])
326
-        self.assertReportedStat('nodepool.dib_image_build.fake-image.tar.rc',
327
+        self.assertReportedStat('nodepool.dib_image_build.'
328
+                                'fake-image.status.rc',
327 329
                                 '0', 'g')
328 330
         self.assertReportedStat('nodepool.dib_image_build.'
329
-                                'fake-image.tar.duration', None, 'ms')
331
+                                'fake-image.status.duration', None, 'ms')
330 332
         self.assertReportedStat('nodepool.dib_image_build.'
331 333
                                 'fake-image.tar.size', '4096', 'g')
334
+        self.assertReportedStat('nodepool.dib_image_build.'
335
+                                'fake-image.status.last_build', None, 'g')
332 336
 
333 337
     def test_diskimage_build_formats(self):
334 338
         configfile = self.setup_config('node_diskimage_formats.yaml')

+ 12
- 0
releasenotes/notes/dib-stats-update-c4efeab13753e090.yaml View File

@@ -0,0 +1,12 @@
1
+---
2
+upgrade:
3
+  - The diskimage-builder stats have been reworked to be more useful.
4
+    The return code and duration is now stored in
5
+    ``nodepool.dib_image-build.<diskimage_name>.status.<rc|duration>``;
6
+    previously this was split for each image format.  This is
7
+    unnecessary and confusing since the results will always be the
8
+    same, since all formats are generated from the same
9
+    diskimage-builder run.  An additional gauge
10
+    ``nodepool.dib_image_build.<diskimage_name>.status.last_build`` is
11
+    added to make it easy to show relative time of builds in
12
+    dashboards.

Loading…
Cancel
Save