Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add PV/PVC Namespace for PowerStore capacity metrics #39

Merged
merged 1 commit into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions internal/service/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ func (mw *MetricsWrapper) RecordSpaceMetrics(ctx context.Context, meta interface
attribute.String("FileSystemID", v.ID),
attribute.String("ArrayID", v.ArrayID),
attribute.String("PersistentVolumeName", v.PersistentVolumeName),
attribute.String("PersistentVolumeClaimName", v.PersistentVolumeClaimName),
attribute.String("Namespace", v.Namespace),
attribute.String("StorageClass", v.StorageClass),
attribute.String("Driver", v.Driver),
attribute.String("Protocol", v.Protocol),
Expand All @@ -246,6 +248,8 @@ func (mw *MetricsWrapper) RecordSpaceMetrics(ctx context.Context, meta interface
attribute.String("VolumeID", v.ID),
attribute.String("ArrayID", v.ArrayID),
attribute.String("PersistentVolumeName", v.PersistentVolumeName),
attribute.String("PersistentVolumeClaimName", v.PersistentVolumeClaimName),
attribute.String("Namespace", v.Namespace),
attribute.String("StorageClass", v.StorageClass),
attribute.String("Driver", v.Driver),
attribute.String("Protocol", v.Protocol),
Expand Down
3 changes: 3 additions & 0 deletions internal/service/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,9 @@ func Test_Space_Metrics_Label_Update(t *testing.T) {

expectedLables := []attribute.KeyValue{
attribute.String("VolumeID", metaSecond.ID),
attribute.String("PersistentVolumeName", metaSecond.PersistentVolumeName),
attribute.String("PersistentVolumeClaimName", metaSecond.PersistentVolumeClaimName),
attribute.String("Namespace", metaSecond.Namespace),
attribute.String("PlotWithMean", "No"),
}

Expand Down
14 changes: 8 additions & 6 deletions internal/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,14 @@ func (s *PowerStoreService) gatherSpaceVolumeMetrics(ctx context.Context, volume
protocol := volumeProperties[2]

spaceMeta := &SpaceVolumeMeta{
ID: volumeID,
PersistentVolumeName: volume.PersistentVolume,
ArrayID: arrayID,
StorageClass: volume.StorageClass,
Driver: volume.Driver,
Protocol: protocol,
ID: volumeID,
PersistentVolumeName: volume.PersistentVolume,
PersistentVolumeClaimName: volume.VolumeClaimName,
Namespace: volume.Namespace,
ArrayID: arrayID,
StorageClass: volume.StorageClass,
Driver: volume.Driver,
Protocol: protocol,
}

goPowerStoreClient, err := s.getPowerStoreClient(ctx, arrayID)
Expand Down
14 changes: 8 additions & 6 deletions internal/service/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ type VolumeMeta struct {

// SpaceVolumeMeta is the details of a volume in an SDC
type SpaceVolumeMeta struct {
ID string
PersistentVolumeName string
ArrayID string
StorageClass string
Driver string
Protocol string
ID string
PersistentVolumeName string
PersistentVolumeClaimName string
Namespace string
ArrayID string
StorageClass string
Driver string
Protocol string
}

// TransportType differentiates different SCSI transport protocols (FC, iSCSI, Auto, None)
Expand Down