Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: add row status for policy metric (#5880)
ecmadaofed03dd7eb56
diff --git a/backend/metric/collector/policy_count.go b/backend/metric/collector/policy_count.goindex 9fb261cdbc..27134325bf 100644--- a/backend/metric/collector/policy_count.go+++ b/backend/metric/collector/policy_count.go@@ -49,6 +49,11 @@ func (c *policyCountCollector) Collect(ctx context.Context) ([]*metric.Metric, econtinue}+ rowStatus := api.Normal+ if environment.Deleted {+ rowStatus = api.Archived+ }+switch policy.Type {case api.PolicyTypePipelineApproval:payload, err := api.UnmarshalPipelineApprovalPolicy(policy.Payload)@@ -56,16 +61,16 @@ func (c *policyCountCollector) Collect(ctx context.Context) ([]*metric.Metric, econtinue}value = string(payload.Value)- key = fmt.Sprintf("%s_%s_%s", policy.Type, environment.Title, value)+ key = fmt.Sprintf("%s_%s_%s_%s", policy.Type, environment.Title, value, rowStatus)case api.PolicyTypeBackupPlan:payload, err := api.UnmarshalBackupPlanPolicy(policy.Payload)if err != nil {continue}value = string(payload.Schedule)- key = fmt.Sprintf("%s_%s_%s", policy.Type, environment.Title, value)+ key = fmt.Sprintf("%s_%s_%s_%s", policy.Type, environment.Title, value, rowStatus)case api.PolicyTypeSQLReview:- key = fmt.Sprintf("%s_%s", policy.Type, environment.Title)+ key = fmt.Sprintf("%s_%s_%s", policy.Type, environment.Title, rowStatus)// SQL review policy don't need to set the value.value = ""}@@ -80,6 +85,7 @@ func (c *policyCountCollector) Collect(ctx context.Context) ([]*metric.Metric, eValue: value,EnvironmentName: environment.Title,Count: 0,+ RowStatus: rowStatus,}}policyCountMap[key].Count++@@ -93,6 +99,7 @@ func (c *policyCountCollector) Collect(ctx context.Context) ([]*metric.Metric, e"type": string(policyCountMetric.Type),"environment": policyCountMetric.EnvironmentName,"value": policyCountMetric.Value,+ "status": string(policyCountMetric.RowStatus),},})}diff --git a/backend/metric/metric.go b/backend/metric/metric.goindex 1fb0f670bd..4957997449 100644--- a/backend/metric/metric.go+++ b/backend/metric/metric.go@@ -77,6 +77,7 @@ type PolicyCountMetric struct {Value stringEnvironmentName stringCount int+ RowStatus api.RowStatus}// TaskCountMetric is the API message for task count metric.