Skip to content

Commit

Permalink
Introduce client csi metrics
Browse files Browse the repository at this point in the history
- adds new fields to existing RPC message
- these fields are updated in status of corresponding storageconsumer CRs
- the status will be helpful for exporting new metrics

Signed-off-by: Leela Venkaiah G <[email protected]>
  • Loading branch information
leelavg committed Oct 4, 2023
1 parent d290a42 commit bdaea54
Show file tree
Hide file tree
Showing 12 changed files with 204 additions and 86 deletions.
9 changes: 8 additions & 1 deletion api/v1alpha1/storageconsumer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,14 @@ type StorageConsumerStatus struct {
// CephResources provide details of created ceph resources required for external storage
CephResources []*CephResourcesSpec `json:"cephResources,omitempty"`
// Timestamp of last heartbeat received from consumer
LastHeartbeat metav1.Time `json:"lastHeartbeat,omitempty"`
ClientLastHeartbeat metav1.Time `json:"clientLastHeartbeat,omitempty"`
// StorageClient OCP Version
ClientOCPVersion string `json:"clientOCPVersion,omitempty"`
// StorageClient Operator Version
ClientOperatorVersion string `json:"clientOperatorVersion,omitempty"`
// StorageClient phase of consumer, one of
// https://github.com/red-hat-storage/ocs-client-operator/blob/76e58/api/v1alpha1/storageclient_types.go#L25-L38
StorageClientPhase string `json:"storageClientPhase,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion config/crd/bases/ocs.openshift.io_storageconsumers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,22 @@ spec:
type: string
type: object
type: array
lastHeartbeat:
clientLastHeartbeat:
description: Timestamp of last heartbeat received from consumer
format: date-time
type: string
clientOCPVersion:
description: StorageClient OCP Version
type: string
clientOperatorVersion:
description: StorageClient Operator Version
type: string
state:
description: State describes the state of StorageConsumer
type: string
storageClientPhase:
description: StorageClient phase of consumer, one of https://github.com/red-hat-storage/ocs-client-operator/blob/76e58/api/v1alpha1/storageclient_types.go#L25-L38
type: string
type: object
type: object
served: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,22 @@ spec:
type: string
type: object
type: array
lastHeartbeat:
clientLastHeartbeat:
description: Timestamp of last heartbeat received from consumer
format: date-time
type: string
clientOCPVersion:
description: StorageClient OCP Version
type: string
clientOperatorVersion:
description: StorageClient Operator Version
type: string
state:
description: State describes the state of StorageConsumer
type: string
storageClientPhase:
description: StorageClient phase of consumer, one of https://github.com/red-hat-storage/ocs-client-operator/blob/76e58/api/v1alpha1/storageclient_types.go#L25-L38
type: string
type: object
type: object
served: true
Expand Down
11 changes: 10 additions & 1 deletion deploy/ocs-operator/manifests/storageconsumer.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,22 @@ spec:
type: string
type: object
type: array
lastHeartbeat:
clientLastHeartbeat:
description: Timestamp of last heartbeat received from consumer
format: date-time
type: string
clientOCPVersion:
description: StorageClient OCP Version
type: string
clientOperatorVersion:
description: StorageClient Operator Version
type: string
state:
description: State describes the state of StorageConsumer
type: string
storageClientPhase:
description: StorageClient phase of consumer, one of https://github.com/red-hat-storage/ocs-client-operator/blob/76e58/api/v1alpha1/storageclient_types.go#L25-L38
type: string
type: object
type: object
served: true
Expand Down
8 changes: 6 additions & 2 deletions services/provider/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,16 @@ func (cc *OCSProviderClient) GetStorageClassClaimConfig(ctx context.Context, con
return cc.Client.GetStorageClassClaimConfig(apiCtx, req)
}

func (cc *OCSProviderClient) ReportStatus(ctx context.Context, consumerUUID string) (*pb.ReportStatusResponse, error) {
func (cc *OCSProviderClient) ReportStatus(ctx context.Context, consumerUUID,
clientOCPVersion, clientOperatorVersion, storageClientPhase string) (*pb.ReportStatusResponse, error) {
if cc.Client == nil || cc.clientConn == nil {
return nil, fmt.Errorf("Provider client is closed")
}
req := &pb.ReportStatusRequest{
StorageConsumerUUID: consumerUUID,
StorageConsumerUUID: consumerUUID,
ClientOCPVersion: clientOCPVersion,
ClientOperatorVersion: clientOperatorVersion,
StorageClientPhase: storageClientPhase,
}
apiCtx, cancel := context.WithTimeout(ctx, cc.timeout)
defer cancel()
Expand Down
148 changes: 91 additions & 57 deletions services/provider/pb/provider.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions services/provider/proto/provider.proto
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ message StorageClassClaimConfigResponse{

message ReportStatusRequest{
string storageConsumerUUID = 1;
string clientOCPVersion = 2;
string clientOperatorVersion = 3;
string storageClientPhase = 4;
}

message ReportStatusResponse{}
Loading

0 comments on commit bdaea54

Please sign in to comment.