MCPcopy Create free account
hub / github.com/algolia/cli / trackCreateOutcome

Function trackCreateOutcome

pkg/cmd/application/create/create.go:119–142  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

117// trackCreateOutcome reports how the creation flow ended: completed, aborted
118// (with the reason why), or failed.
119func 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.
145func printDryRunSummary(opts *CreateOptions) error {

Callers 2

TestTrackCreateOutcomeFunction · 0.85
runCreateCmdFunction · 0.85

Calls 5

TrackEventFunction · 0.92
IsUserCancellationFunction · 0.92
ApplicationCreateAbortedFunction · 0.92
ApplicationCreateFailedFunction · 0.92

Tested by 1

TestTrackCreateOutcomeFunction · 0.68