Description
Sample enterprise-tier traffic at 100 percent and free-tier at 1 percent, both driven by attributes at span start. Complements tail-based sampling with head-based control.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Relevant code:
internal/tracing/tracing.go
- Use ParentBased(TraceIDRatioBased) with attribute overrides
Suggested execution
- Fork the repo and create a branch
git checkout -b feat/tenant-aware-sampler
- Implement changes
- Add
internal/tracing/sampler.go
- Wire into provider setup
- Metrics for sampled_total by tier
- Validate security and correctness assumptions
Test and commit
- Run tests
go test ./internal/tracing/...
- Cover edge cases
- Missing tier defaults to global ratio
- Include test output and notes
Example commit message
feat: tenant-tier-aware trace sampler
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Description
Sample enterprise-tier traffic at 100 percent and free-tier at 1 percent, both driven by attributes at span start. Complements tail-based sampling with head-based control.
Requirements and context
internal/tracing/tracing.goSuggested execution
git checkout -b feat/tenant-aware-samplerinternal/tracing/sampler.goTest and commit
go test ./internal/tracing/...Example commit message
feat: tenant-tier-aware trace samplerGuidelines