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

Method SetSampleRate

internal/telemetry/telemetry.go:308–317  ·  view source on GitHub ↗

SetSampleRate selects the sampling policy for the whole invocation. Changes after Finish have no effect.

(rate int)

Source from the content-addressed store, hash-verified

306// SetSampleRate selects the sampling policy for the whole invocation.
307// Changes after Finish have no effect.
308func (s *service) SetSampleRate(rate int) {
309 s.mu.Lock()
310 defer s.mu.Unlock()
311
312 if s.finished {
313 return
314 }
315 s.sampleRate = rate
316 s.commonDimensions["sample_rate"] = strconv.Itoa(rate)
317}
318
319// Finish snapshots the recorded events once and sends their payload after releasing the lock.
320// Sampling and telemetry eligibility apply to immediate and pending events alike.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected