diff --git a/internal/collector/queries.go b/internal/collector/queries.go index 497ef61e6..74ab9f64f 100644 --- a/internal/collector/queries.go +++ b/internal/collector/queries.go @@ -143,6 +143,7 @@ var ( query{ Name: "persistentvolumeclaim-usage-bytes", QueryString: QueryMap["cost:persistentvolumeclaim_usage_bytes"], + MetricKey: staticFields{"node": "node"}, QueryValue: &saveQueryValue{ ValName: "persistentvolumeclaim-usage-bytes", Method: "sum", diff --git a/internal/collector/test_files/expected_reports/cm-openshift-storage-usage-202011.csv b/internal/collector/test_files/expected_reports/cm-openshift-storage-usage-202011.csv index bd9112806..adab0c4d2 100644 --- a/internal/collector/test_files/expected_reports/cm-openshift-storage-usage-202011.csv +++ b/internal/collector/test_files/expected_reports/cm-openshift-storage-usage-202011.csv @@ -1,2 +1,2 @@ -report_period_start,report_period_end,interval_start,interval_end,namespace,pod,persistentvolumeclaim,persistentvolume,storageclass,persistentvolumeclaim_capacity_bytes,persistentvolumeclaim_capacity_byte_seconds,volume_request_storage_byte_seconds,persistentvolumeclaim_usage_byte_seconds,persistentvolume_labels,persistentvolumeclaim_labels -2020-11-01 00:00:00 +0000 UTC,2020-12-01 00:00:00 +0000 UTC,2020-11-06 18:00:00 +0000 UTC,2020-11-06 18:59:59 +0000 UTC,openshift-metering,hive-metastore-0,hive-metastore-db-data,pvc-025604dc-93ff-4801-ac06-316243ccd45a,gp2,5217320960.000000,18782355456000.000000,19327352832000.000000,94858444800.000000,label_failure_domain_beta_kubernetes_io_region:us-east-2|label_failure_domain_beta_kubernetes_io_zone:us-east-2a,label_app:hive-metastore|label_metering_openshift_io_ns_prune:openshift-metering|label_metering_openshift_io_prune:hive-metastore-pvc +report_period_start,report_period_end,interval_start,interval_end,namespace,pod,node,persistentvolumeclaim,persistentvolume,storageclass,persistentvolumeclaim_capacity_bytes,persistentvolumeclaim_capacity_byte_seconds,volume_request_storage_byte_seconds,persistentvolumeclaim_usage_byte_seconds,persistentvolume_labels,persistentvolumeclaim_labels +2020-11-01 00:00:00 +0000 UTC,2020-12-01 00:00:00 +0000 UTC,2020-11-06 18:00:00 +0000 UTC,2020-11-06 18:59:59 +0000 UTC,openshift-metering,hive-metastore-0,ip-10-0-150-20.us-east-2.compute.internal,hive-metastore-db-data,pvc-025604dc-93ff-4801-ac06-316243ccd45a,gp2,5217320960.000000,18782355456000.000000,19327352832000.000000,94858444800.000000,label_failure_domain_beta_kubernetes_io_region:us-east-2|label_failure_domain_beta_kubernetes_io_zone:us-east-2a,label_app:hive-metastore|label_metering_openshift_io_ns_prune:openshift-metering|label_metering_openshift_io_prune:hive-metastore-pvc diff --git a/internal/collector/types.go b/internal/collector/types.go index fb35d92a0..cda0fe886 100644 --- a/internal/collector/types.go +++ b/internal/collector/types.go @@ -199,6 +199,7 @@ type storageRow struct { *dateTimes Namespace string Pod string + Node string `mapstructure:"node"` PersistentVolumeClaim string `mapstructure:"persistentvolumeclaim"` PersistentVolume string `mapstructure:"persistentvolume"` StorageClass string `mapstructure:"storageclass"` @@ -218,6 +219,7 @@ func (storageRow) csvHeader() []string { "interval_end", "namespace", "pod", + "node", "persistentvolumeclaim", "persistentvolume", "storageclass", @@ -237,6 +239,7 @@ func (row storageRow) csvRow() []string { row.IntervalEnd, row.Namespace, row.Pod, + row.Node, row.PersistentVolumeClaim, row.PersistentVolume, row.StorageClass,