Skip to content

Add CCKR adaptive log reservoir sampler to Microsoft.Extensions.Telem… - #7676

Draft
evgenyfedorov2 wants to merge 1 commit into
dotnet:mainfrom
evgenyfedorov2:evgenyfedorov2/cckr-log-sampling
Draft

Add CCKR adaptive log reservoir sampler to Microsoft.Extensions.Telem…#7676
evgenyfedorov2 wants to merge 1 commit into
dotnet:mainfrom
evgenyfedorov2:evgenyfedorov2/cckr-log-sampling

Conversation

@evgenyfedorov2

@evgenyfedorov2 evgenyfedorov2 commented Aug 3, 2026

Copy link
Copy Markdown
Member

…etry

Implements the CCKR (Chao-Cohen-Kaplan-Reservoir) adaptive log sampler as implementations of the existing LoggingSampler and LogBuffer seams, so no changes to the logging pipeline are required:

  • Cckr<TCallsite,TPayload>: bottom-(K+1) weighted reservoir with EXP ranks, cross-period inverse-frequency feedback, Chao1 unseen-weight, bounded novelty preserve, and Horvitz-Thompson sampling weights (faithful port of the reference algorithm).

  • CckrLoggingSampler (LoggingSampler): the admit/drop decision. CckrLogBuffer (LogBuffer): holds admitted records per category and emits the kept records carrying the sampling.count weight at each flush, reusing SerializedLogRecord/DeserializedLogRecord/IBufferedLogger.

  • AddCckrLogSampling registers one reservoir instance as both seams. Public API: AddCckrLogSampling, ReservoirSamplingConfig, UnseenWeightMode.

Microsoft Reviewers: Open in CodeFlow

…etry

Implements the CCKR (Chao-Cohen-Kaplan-Reservoir) adaptive log sampler as implementations of the existing LoggingSampler and LogBuffer seams, so no changes to the logging pipeline are required:

- Cckr<TCallsite,TPayload>: bottom-(K+1) weighted reservoir with EXP ranks, cross-period inverse-frequency feedback, Chao1 unseen-weight, bounded novelty preserve, and Horvitz-Thompson sampling weights (faithful port of the reference algorithm).

- CckrLoggingSampler (LoggingSampler): the admit/drop decision. CckrLogBuffer (LogBuffer): holds admitted records per category and emits the kept records carrying the sampling.count weight at each flush, reusing SerializedLogRecord/DeserializedLogRecord/IBufferedLogger.

- AddCckrLogSampling registers one reservoir instance as both seams. Public API: AddCckrLogSampling, ReservoirSamplingConfig, UnseenWeightMode.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant