MCPcopy Index your code
hub / github.com/jetify-com/devbox / postRun

Method postRun

internal/boxcli/midcobra/telemetry.go:39–68  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string, runErr error)

Source from the content-addressed store, hash-verified

37}
38
39func (m *telemetryMiddleware) postRun(cmd *cobra.Command, args []string, runErr error) {
40 defer trace.StartRegion(cmd.Context(), "telemetryPostRun").End()
41 defer telemetry.Stop()
42
43 meta := telemetry.Metadata{
44 FeatureFlags: featureflag.All(),
45 CloudRegion: os.Getenv(envir.DevboxRegion),
46 CloudCache: os.Getenv(envir.DevboxCache),
47 }
48
49 subcmd, flags, err := getSubcommand(cmd, args)
50 if err != nil {
51 // Ignore invalid commands/flags.
52 return
53 }
54 meta.Command = subcmd.CommandPath()
55 meta.CommandFlags = flags
56
57 meta.Packages, meta.NixpkgsHash = getPackagesAndCommitHash(cmd)
58 meta.InShell = envir.IsDevboxShellEnabled()
59 meta.InBrowser = envir.IsInBrowser()
60 meta.InCloud = envir.IsDevboxCloud()
61
62 if runErr != nil {
63 telemetry.Error(runErr, meta)
64 // TODO: This is skipping event logging of calls that end in error. We probably want to log them.
65 return
66 }
67 telemetry.Event(telemetry.EventCommandSuccess, meta)
68}
69
70func getSubcommand(cmd *cobra.Command, args []string) (subcmd *cobra.Command, flags []string, err error) {
71 if cmd.TraverseChildren {

Callers

nothing calls this directly

Calls 10

StopFunction · 0.92
AllFunction · 0.92
IsDevboxShellEnabledFunction · 0.92
IsInBrowserFunction · 0.92
IsDevboxCloudFunction · 0.92
ErrorFunction · 0.92
EventFunction · 0.92
getSubcommandFunction · 0.85
getPackagesAndCommitHashFunction · 0.85
EndMethod · 0.80

Tested by

no test coverage detected