@@ -154,7 +154,10 @@ func (c *appTemplateOperator) CreateApp(request *CreateAppRequest) (*CreateAppRe
|
||||
resp, err := c.opClient.CreateApp(openpitrix.ContextWithUsername(request.Username), createAppRequest)
|
||||
if err != nil {
|
||||
klog.Error(err)
|
||||
appTemplateCreationCounter.WithLabelValues(request.Isv, request.Name, "failed").Inc()
|
||||
return nil, err
|
||||
} else {
|
||||
appTemplateCreationCounter.WithLabelValues(request.Isv, request.Name, "success").Inc()
|
||||
}
|
||||
return &CreateAppResponse{
|
||||
AppID: resp.GetAppId().GetValue(),
|
||||
|
||||
25
pkg/models/openpitrix/metric.go
Normal file
25
pkg/models/openpitrix/metric.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package openpitrix
|
||||
|
||||
import (
|
||||
compbasemetrics "k8s.io/component-base/metrics"
|
||||
"kubesphere.io/kubesphere/pkg/utils/metrics"
|
||||
)
|
||||
|
||||
var (
|
||||
appTemplateCreationCounter = compbasemetrics.NewCounterVec(
|
||||
&compbasemetrics.CounterOpts{
|
||||
Name: "application_template_creation",
|
||||
Help: "Counter of application template creation broken out for each workspace, name and create state",
|
||||
StabilityLevel: compbasemetrics.ALPHA,
|
||||
},
|
||||
[]string{"workspace", "name", "state"},
|
||||
)
|
||||
)
|
||||
|
||||
func init() {
|
||||
Register()
|
||||
}
|
||||
|
||||
func Register() {
|
||||
metrics.MustRegister(appTemplateCreationCounter)
|
||||
}
|
||||
Reference in New Issue
Block a user