Merge pull request #1757 from aluzzardi/telemetry-log-duration

telemetry: log duration
This commit is contained in:
Andrea Luzzardi 2022-03-10 11:18:38 -08:00 committed by GitHub
commit 26fe2630b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 {