mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
715d908613
Notable refactoring: - Use stdlib "context" in place of "golang.org/x/net/context" - Go-kit no longer wraps errors, so we remove the unwrap in transport_error.go - Use MakeHandler when setting up endpoint tests (fixes test bug caught during this refactoring) Closes #1411.
22 lines
513 B
Go
22 lines
513 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
func (mw metricsMiddleware) ChangeUserEmail(ctx context.Context, token string) (string, error) {
|
|
var (
|
|
err error
|
|
newEmail string
|
|
)
|
|
defer func(begin time.Time) {
|
|
lvs := []string{"method", "CommitEmailChange", "error", fmt.Sprint(err != nil)}
|
|
mw.requestCount.With(lvs...).Add(1)
|
|
mw.requestLatency.With(lvs...).Observe(time.Since(begin).Seconds())
|
|
}(time.Now())
|
|
newEmail, err = mw.Service.ChangeUserEmail(ctx, token)
|
|
return newEmail, err
|
|
}
|