fleet/server/service/metrics_change_email.go
Zachary Wasserman 715d908613 Update go-kit to 0.4.0 (#1411)
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.
2017-03-15 08:55:30 -07:00

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
}