BeginAuthTelemetry starts an auth-state event at full sampling for a login or refresh invocation. It returns nil when recorder is nil or when hostname is a GitHub Enterprise Server host, since enterprise usage is never reported. command is "login" or "refresh" and expiringRequested is the effective
(recorder ghtelemetry.InvocationRecorder, command, hostname string, expiringRequested bool)
| 18 | // recorder is nil or when hostname is a GitHub Enterprise Server host, since enterprise usage is never reported. command |
| 19 | // is "login" or "refresh" and expiringRequested is the effective intent to request an expiring, refreshable token. |
| 20 | func BeginAuthTelemetry(recorder ghtelemetry.InvocationRecorder, command, hostname string, expiringRequested bool) *AuthTelemetryEvent { |
| 21 | if recorder == nil || ghauth.IsEnterprise(hostname) { |
| 22 | return nil |
| 23 | } |
| 24 | |
| 25 | recorder.SetSampleRate(ghtelemetry.SAMPLE_ALL) |
| 26 | pendingEvent := recorder.Begin(ghtelemetry.Event{ |
| 27 | Type: "auth_invocation", |
| 28 | Dimensions: ghtelemetry.Dimensions{ |
| 29 | "auth_command": command, |
| 30 | "expiring_requested": fmt.Sprintf("%v", expiringRequested), |
| 31 | "expiring_setup_cred_helper_cancelled": "false", |
| 32 | "auth_success": "false", |
| 33 | }, |
| 34 | }) |
| 35 | |
| 36 | return &AuthTelemetryEvent{pendingEvent: pendingEvent} |
| 37 | } |
| 38 | |
| 39 | // RecordExpiringSetupCancelled records whether the user cancelled the sign-in at the expiring credential-helper prompt. |
| 40 | // That prompt, and therefore a cancellation, is only reachable on an expiring login. |