mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 00:49:03 +00:00
relates to #17031 Adds functionality to create manual labels in fleet. - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://fleetdm.com/docs/contributing/committing-changes#changes-files) for more information. - [x] Added/updated tests - [x] M0anual QA for all new/changed functionality --------- Co-authored-by: Martin Angers <martin.n.angers@gmail.com>
24 lines
595 B
Go
24 lines
595 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/fleetdm/fleet/v4/server/fleet"
|
|
)
|
|
|
|
func (mw metricsMiddleware) ModifyLabel(ctx context.Context, id uint, p fleet.ModifyLabelPayload) (*fleet.Label, []uint, error) {
|
|
var (
|
|
lic *fleet.Label
|
|
hids []uint
|
|
err error
|
|
)
|
|
defer func(begin time.Time) {
|
|
lvs := []string{"method", "ModifyLabel", "error", fmt.Sprint(err != nil)}
|
|
mw.requestCount.With(lvs...).Add(1)
|
|
mw.requestLatency.With(lvs...).Observe(time.Since(begin).Seconds())
|
|
}(time.Now())
|
|
lic, hids, err = mw.Service.ModifyLabel(ctx, id, p)
|
|
return lic, hids, err
|
|
}
|