Improvement: sample by attribute key, message or any hash
Open
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 119
- Forks
- 5
- Avg merge
- 3m
- Merged PRs (30d)
- 1
Description
Some ideas:
slogsampling.ThresholdSamplingOption{
Rate: 100,
ByHash: func(r *slog.Record) []byte {
return []byte(r.Message)
},
}
slogsampling.ThresholdSamplingOption{
Rate: 100,
ByHash: func(r *slog.Record) []byte {
return BloomFilter([]byte(r.Message))
},
}
slogsampling.ThresholdSamplingOption{
Rate: 100,
ByAttributeKey: []string{"http", "request", "header", "cf-connecting-ip"},
}
slogsampling.ThresholdSamplingOption{
Rate: 100,
BySource: true, // might be very costly to look for stacktrace
}
slogsampling.ThresholdSamplingOption{
Rate: 100,
ByDistance: slogsampling.LevenshteinDistance(xxx), // just brainstorming - definitely a VERY bad idea 😁
}
We have to keep track of hash/keys. A garbage collector must remove old entries in LRU or LFU manner.
The bloom filter could be embedded into the library on behalf of the developer.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing ThresholdSamplingOption and the existing slog.Record sampling flow. Compare the proposed ByHash, ByAttributeKey, BySource, and ByDistance ideas, then determine the intended key-retention and LRU/LFU cleanup behavior. Done should mean an agreed sampling API and implementation scope, including whether bloom-filter support is required.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- observability-sre
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100