Skip to content

Commit

Permalink
Treat lv_lockargs as info string, not numeric metric
Browse files Browse the repository at this point in the history
`lv_lockargs` fields are strings which can't be parsed as floating point
numbers.

Reported in issue #30.
  • Loading branch information
hansmi committed Jun 29, 2023
1 parent a855fad commit e501804
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 39 deletions.
1 change: 1 addition & 0 deletions collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func TestCollector(t *testing.T) {
{name: "mirrored-unhealthy"},
{name: "snapshot"},
{name: "issue29-vdo-online"},
{name: "issue30-lockargs"},
} {
t.Run(tc.name, func(t *testing.T) {
c := newCollector()
Expand Down
10 changes: 5 additions & 5 deletions lv.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ var lvGroup = &group{
metricName: "lv_layout",
desc: "LV layout",
},
{
fieldName: "lv_lockargs",
metricName: "lv_lockargs",
desc: "Lock args of the LV used by lvmlockd",
},
{
fieldName: "lv_modules",
metricName: "lv_modules",
Expand Down Expand Up @@ -361,11 +366,6 @@ var lvGroup = &group{
metricName: "lv_live_table",
desc: "Set if LV has live table present",
},
{
fieldName: "lv_lockargs",
metricName: "lv_lockargs",
desc: "Lock args of the LV used by lvmlockd",
},
{
fieldName: "lv_major",
metricName: "lv_major",
Expand Down
12 changes: 6 additions & 6 deletions testdata/issue29-vdo-online.golden
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# HELP lvm_lv_info
# TYPE lvm_lv_info gauge
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="",lv_dm_path="",lv_full_ancestors="",lv_full_descendants="",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="[vpool0_vdata]",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="tHnHR1-bjg8-ycJX-eyhR-heEp-L4qs-S510dO",lv_vdo_compression_state="",lv_vdo_index_state="",lv_vdo_operating_mode="",lv_when_full=""} 1
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="",lv_dm_path="",lv_full_ancestors="",lv_full_descendants="",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="lv_data",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="5UyOrx-zG6u-w7cF-G2Ny-HmVd-0lsb-4J6lG2",lv_vdo_compression_state="",lv_vdo_index_state="",lv_vdo_operating_mode="",lv_when_full=""} 1
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="",lv_dm_path="",lv_full_ancestors="",lv_full_descendants="",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="lv_db_backup",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="r7Btja-nL3P-Co38-X2K4-DLWS-LMhT-LajcQa",lv_vdo_compression_state="online",lv_vdo_index_state="online",lv_vdo_operating_mode="normal",lv_when_full=""} 1
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="",lv_dm_path="",lv_full_ancestors="",lv_full_descendants="",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="root",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="cqZnVQ-FUPG-btWz-3fff-cMX5-wViK-8MM3QY",lv_vdo_compression_state="",lv_vdo_index_state="",lv_vdo_operating_mode="",lv_when_full=""} 1
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="",lv_dm_path="",lv_full_ancestors="",lv_full_descendants="",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="swap",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="lGs7Tn-1Fyv-jMHN-aniN-r8qk-duEI-B9Xl9e",lv_vdo_compression_state="",lv_vdo_index_state="",lv_vdo_operating_mode="",lv_when_full=""} 1
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="",lv_dm_path="",lv_full_ancestors="",lv_full_descendants="",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="vpool0",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="dylifl-81AF-n2mG-kFKo-Ntxe-mnNQ-3eB7fF",lv_vdo_compression_state="online",lv_vdo_index_state="online",lv_vdo_operating_mode="normal",lv_when_full=""} 1
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="",lv_dm_path="",lv_full_ancestors="",lv_full_descendants="",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_lockargs="",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="[vpool0_vdata]",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="tHnHR1-bjg8-ycJX-eyhR-heEp-L4qs-S510dO",lv_vdo_compression_state="",lv_vdo_index_state="",lv_vdo_operating_mode="",lv_when_full=""} 1
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="",lv_dm_path="",lv_full_ancestors="",lv_full_descendants="",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_lockargs="",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="lv_data",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="5UyOrx-zG6u-w7cF-G2Ny-HmVd-0lsb-4J6lG2",lv_vdo_compression_state="",lv_vdo_index_state="",lv_vdo_operating_mode="",lv_when_full=""} 1
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="",lv_dm_path="",lv_full_ancestors="",lv_full_descendants="",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_lockargs="",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="lv_db_backup",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="r7Btja-nL3P-Co38-X2K4-DLWS-LMhT-LajcQa",lv_vdo_compression_state="online",lv_vdo_index_state="online",lv_vdo_operating_mode="normal",lv_when_full=""} 1
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="",lv_dm_path="",lv_full_ancestors="",lv_full_descendants="",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_lockargs="",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="root",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="cqZnVQ-FUPG-btWz-3fff-cMX5-wViK-8MM3QY",lv_vdo_compression_state="",lv_vdo_index_state="",lv_vdo_operating_mode="",lv_when_full=""} 1
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="",lv_dm_path="",lv_full_ancestors="",lv_full_descendants="",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_lockargs="",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="swap",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="lGs7Tn-1Fyv-jMHN-aniN-r8qk-duEI-B9Xl9e",lv_vdo_compression_state="",lv_vdo_index_state="",lv_vdo_operating_mode="",lv_when_full=""} 1
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="",lv_dm_path="",lv_full_ancestors="",lv_full_descendants="",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_lockargs="",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="vpool0",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="dylifl-81AF-n2mG-kFKo-Ntxe-mnNQ-3eB7fF",lv_vdo_compression_state="online",lv_vdo_index_state="online",lv_vdo_operating_mode="normal",lv_when_full=""} 1
# HELP lvm_lv_vdo_saving_percent For vdo pools, percentage of saved space
# TYPE lvm_lv_vdo_saving_percent gauge
lvm_lv_vdo_saving_percent{lv_uuid="dylifl-81AF-n2mG-kFKo-Ntxe-mnNQ-3eB7fF"} 55.37
Expand Down
13 changes: 13 additions & 0 deletions testdata/issue30-lockargs.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# HELP lvm_lv_info
# TYPE lvm_lv_info gauge
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="",lv_dm_path="",lv_full_ancestors="",lv_full_descendants="",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_lockargs="",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="[lvmlock]",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="PN2YZw-aWgL-O0Rc-Vkbx-Dx09-lvDp-fhpbXe",lv_vdo_compression_state="",lv_vdo_index_state="",lv_vdo_operating_mode="",lv_when_full=""} 1
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="",lv_dm_path="",lv_full_ancestors="",lv_full_descendants="",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_lockargs="1.0.0:570425344",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="alpinetest",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="YvnAc9-CH9k-Fq5F-WfTl-oONA-5njZ-t1ChZm",lv_vdo_compression_state="",lv_vdo_index_state="",lv_vdo_operating_mode="",lv_when_full=""} 1
lvm_lv_info{lv_active="",lv_allocation_policy="",lv_ancestors="",lv_attr="",lv_convert_lv="",lv_convert_lv_uuid="",lv_data_lv="",lv_data_lv_uuid="",lv_descendants="",lv_dm_path="",lv_full_ancestors="",lv_full_descendants="",lv_full_name="",lv_health_status="",lv_host="",lv_kernel_cache_policy="",lv_kernel_cache_settings="",lv_kernel_discards="",lv_kernel_metadata_format="",lv_kernel_read_ahead_bytes="",lv_layout="",lv_lockargs="1.0.0:620756992",lv_metadata_lv="",lv_metadata_lv_uuid="",lv_mirror_log="",lv_mirror_log_uuid="",lv_modules="",lv_move_pv="",lv_move_pv_uuid="",lv_name="lvtest",lv_origin="",lv_origin_uuid="",lv_parent="",lv_path="",lv_permissions="",lv_pool_lv="",lv_pool_lv_uuid="",lv_raid_sync_action="",lv_raidintegritymode="",lv_role="",lv_tags="",lv_uuid="FmOsEf-s4PL-qNOn-KSLb-GAIG-kuuP-ErGbTp",lv_vdo_compression_state="",lv_vdo_index_state="",lv_vdo_operating_mode="",lv_when_full=""} 1
# HELP lvm_unknown_field_count Fields reported by LVM not recognized by exporter
# TYPE lvm_unknown_field_count gauge
lvm_unknown_field_count{details="",group="lv"} 0
lvm_unknown_field_count{details="",group="pv"} 0
lvm_unknown_field_count{details="",group="vg"} 0
# HELP lvm_up Whether scrape was successful
# TYPE lvm_up gauge
lvm_up{status=""} 1
23 changes: 23 additions & 0 deletions testdata/issue30-lockargs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"report": [
{
"lv": [
{
"lv_uuid": "YvnAc9-CH9k-Fq5F-WfTl-oONA-5njZ-t1ChZm",
"lv_name": "alpinetest",
"lv_lockargs": "1.0.0:570425344"
},
{
"lv_uuid": "FmOsEf-s4PL-qNOn-KSLb-GAIG-kuuP-ErGbTp",
"lv_name": "lvtest",
"lv_lockargs": "1.0.0:620756992"
},
{
"lv_uuid": "PN2YZw-aWgL-O0Rc-Vkbx-Dx09-lvDp-fhpbXe",
"lv_name": "[lvmlock]",
"lv_lockargs": ""
}
]
}
]
}

0 comments on commit e501804

Please sign in to comment.