Skip to content

Commit

Permalink
Fix minor and patch OS versions metrics labels
Browse files Browse the repository at this point in the history
The minor and patch OS version in the database should default to 0, and
0 is a valid value for those 2 labels.
  • Loading branch information
np5 committed Nov 7, 2024
1 parent 2c91130 commit 6d6b7db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tests/inventory/test_metrics_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def setUpTestData(cls):
"source": {"module": "tests2.zentral.io", "name": "Zentral Tests2"},
"serial_number": "0123456789",
"system_info": {"hardware_model": "MacBookPro14,2"},
"os_version": {'name': 'OS X', 'major': 12, 'minor': 2, 'version': "(a)"},
"os_version": {'name': 'OS X', 'major': 12, 'minor': 2, 'patch': 0, 'version': "(a)"},
"android_apps": [
{"display_name": "AndroidApp1",
"version_name": "2.1"},
Expand Down Expand Up @@ -363,7 +363,7 @@ def test_prometheus_metrics_os_versions(self):
'major': '12',
'minor': '2',
'name': 'OS X',
'patch': '',
'patch': '0',
'version': '(a)',
'source_name': self.ms2.source.name,
'source_id': str(self.ms2.source.pk),
Expand Down
2 changes: 1 addition & 1 deletion zentral/contrib/inventory/metrics_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def add_os_versions(self):
registry=self.registry)
for r in os_version_count(sources):
labels = {
k: r[k] or ""
k: "" if r[k] is None else r[k]
for k in ('name',
'major', 'minor', 'patch',
'build', 'version',
Expand Down

0 comments on commit 6d6b7db

Please sign in to comment.