MCPcopy Create free account
hub / github.com/cli/cli / Begin

Method Begin

internal/telemetry/telemetry.go:291–304  ·  view source on GitHub ↗

Begin copies an event's initial facts and returns a handle for adding facts until Finish. Events begun after Finish are not recorded.

(event ghtelemetry.Event)

Source from the content-addressed store, hash-verified

289// Begin copies an event's initial facts and returns a handle for adding
290// facts until Finish. Events begun after Finish are not recorded.
291func (s *service) Begin(event ghtelemetry.Event) ghtelemetry.PendingEvent {
292 s.mu.Lock()
293 defer s.mu.Unlock()
294
295 if s.finished {
296 return noOpPendingEvent{}
297 }
298 recorded := &recordedEvent{
299 event: cloneEvent(event),
300 recordedAt: time.Now(),
301 }
302 s.events = append(s.events, recorded)
303 return &pendingEvent{service: s, recorded: recorded}
304}
305
306// SetSampleRate selects the sampling policy for the whole invocation.
307// Changes after Finish have no effect.

Callers

nothing calls this directly

Calls 1

cloneEventFunction · 0.85

Tested by

no test coverage detected