trackCreateOutcome reports how the creation flow ended: completed, aborted (with the reason why), or failed.
( ctx context.Context, tracker *telemetry.FlowTracker, result createResult, err error, )
| 117 | // trackCreateOutcome reports how the creation flow ended: completed, aborted |
| 118 | // (with the reason why), or failed. |
| 119 | func trackCreateOutcome( |
| 120 | ctx context.Context, |
| 121 | tracker *telemetry.FlowTracker, |
| 122 | result createResult, |
| 123 | err error, |
| 124 | ) { |
| 125 | switch { |
| 126 | case err == nil && result.created: |
| 127 | telemetry.TrackEvent( |
| 128 | ctx, |
| 129 | telemetry.ApplicationCreateCompleted(result.region, result.plan, tracker), |
| 130 | ) |
| 131 | case err == nil || result.abortReason != "" || cmdutil.IsUserCancellation(err): |
| 132 | // Stopped without creating anything: declined terms, billing wall, |
| 133 | // or user cancellation. |
| 134 | reason := result.abortReason |
| 135 | if reason == "" && cmdutil.IsUserCancellation(err) { |
| 136 | reason = telemetry.AbortReasonCancelled |
| 137 | } |
| 138 | telemetry.TrackEvent(ctx, telemetry.ApplicationCreateAborted(tracker, reason)) |
| 139 | default: |
| 140 | telemetry.TrackEvent(ctx, telemetry.ApplicationCreateFailed(tracker, err)) |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | // printDryRunSummary prints what would be created without sending anything. |
| 145 | func printDryRunSummary(opts *CreateOptions) error { |