telemetry: log duration

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2022-03-10 11:08:55 -08:00
parent c82bc00f87
commit 3679c04be9

View File

@ -98,6 +98,7 @@ func Track(ctx context.Context, eventName string, properties ...*Property) {
"Accept": {"*/*"}, "Accept": {"*/*"},
} }
start := time.Now()
resp, err := http.DefaultClient.Do(req) resp, err := http.DefaultClient.Do(req)
if err != nil { if err != nil {
lg.Trace().Err(err).Msg("failed to send telemetry event") lg.Trace().Err(err).Msg("failed to send telemetry event")
@ -110,7 +111,7 @@ func Track(ctx context.Context, eventName string, properties ...*Property) {
return return
} }
lg.Trace().Msg("telemetry event") lg.Trace().Dur("duration", time.Since(start)).Msg("telemetry event")
} }
type payload struct { type payload struct {