MCPcopy Index your code
hub / github.com/1Panel-dev/KubePi / DeleteMetrics

Method DeleteMetrics

internal/api/v1/monitor/monitor.go:162–180  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

160}
161
162func (h *Handler) DeleteMetrics() iris.Handler {
163 return func(ctx *context.Context) {
164 name := ctx.Params().GetString("name")
165 tx, err := server.DB().Begin(true)
166 if err != nil {
167 ctx.StatusCode(iris.StatusInternalServerError)
168 ctx.Values().Set("message", err.Error())
169 return
170 }
171 txOptions := common.DBOptions{DB: tx}
172 if err = h.monitorService.MetricsDelete(name, txOptions); err != nil {
173 ctx.StatusCode(iris.StatusInternalServerError)
174 ctx.Values().Set("message", err.Error())
175 _ = tx.Rollback()
176 return
177 }
178 _ = tx.Commit()
179 }
180}
181
182func (h *Handler) GetMetrics() iris.Handler {
183 return func(ctx *context.Context) {

Callers 1

InstallFunction · 0.95

Calls 4

DBFunction · 0.92
ErrorMethod · 0.80
MetricsDeleteMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected