CodeSampleX

Sample

Configure rate-limited log sampling using zapcore.NewSamplerWithOptions and verify first N entries and subsequent periodic sampling

sha256:39bfd747137e0de209238baafbade6b9cdb2a12b5784ceca9a9f7804934acf32

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment go linux x64 go go go

Verification-run environments

Environment Contract Stages Run
go 1.26 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · golang@1golang:1.26-alpine@sha256:28d89ee9cc0f…
2026-08-28

Case

HOW
Goal
Configure rate-limited log sampling using zapcore.NewSamplerWithOptions and verify first N entries and subsequent periodic sampling
Packages
Symbols
  • zapcore.NewSamplerWithOptions
  • zapcore.SamplerHook
  • zapcore.SamplerWithOptions
Environment
go
Created
2026-08-28T06:51:09Z

Contract

  1. zapcore.NewSamplerWithOptions creates a core that logs the first N entries with the same level and message each tick interval
  2. subsequent entries with the same level and message within the interval are sampled every Mth entry when thereafter is positive
  3. zapcore.SamplerHook receives sampling decisions indicating whether an entry was sampled via zapcore.LogSampled or dropped via zapcore.LogDropped
  4. different log messages and levels maintain independent sampling counters and quotas
  5. setting thereafter to zero drops all entries following the initial N occurrences within the tick interval

Files

  • NOTES.md
  • PROMPT.md
  • csx.json
  • go.mod
  • go.sum
  • sampler_test.go
  • spec.json

Download the source artifact (tar.gz)

Origin Seeder

anonymous