WithSampleRate allows setting a sample rate (0-100) for telemetry events. Events recorded with the Unsampled option will be sent regardless of the sample rate. Sampling is based on invocation ID, so an entire invocation will be included or excluded as a whole. This ensures that related events are no
(rate int)
| 162 | // Sampling is based on invocation ID, so an entire invocation will be included or excluded as a whole. This ensures that related events are not split between sampled and unsampled, |
| 163 | // which could lead to incomplete data and incorrect assumptions. |
| 164 | func WithSampleRate(rate int) telemetryServiceOption { |
| 165 | return func(s *telemetryServiceOpts) { |
| 166 | s.sampleRate = rate |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | // LogFlusher returns a flush function that writes telemetry payloads to the provided log writer. This is used for the "log" telemetry mode, which is intended for debugging and development. |
| 171 | // When there are no events to report (for example the command opted out of telemetry, the user is on GHES, or no events were recorded), a "Telemetry payload: none" marker is written so that the absence of events is observable. |
no outgoing calls