Skip to content

Commit

Permalink
feat: make drop decision queue size configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
VinozzZ committed Jan 21, 2025
1 parent 4d856c7 commit 1f54e9a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
9 changes: 6 additions & 3 deletions collect/cache/cuckoo.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type CuckooTraceChecker struct {

const (
// This is how many items can be in the Add Queue before we start blocking on Add.
AddQueueDepth = 1000
defaultAddQueueDepth = 1000
// This is how long we'll sleep between possible lock cycles.
AddQueueSleepTime = 100 * time.Microsecond
)
Expand All @@ -50,13 +50,16 @@ var cuckooTraceCheckerMetrics = []metrics.Metadata{
{Name: CurrentLoadFactor, Type: metrics.Gauge, Unit: metrics.Percent, Description: "the fraction of slots occupied in the current cuckoo filter"},
}

func NewCuckooTraceChecker(capacity uint, m metrics.Metrics) *CuckooTraceChecker {
func NewCuckooTraceChecker(capacity uint, addQueueDepth uint, m metrics.Metrics) *CuckooTraceChecker {
if addQueueDepth == 0 {
addQueueDepth = defaultAddQueueDepth
}
c := &CuckooTraceChecker{
capacity: capacity,
current: cuckoo.NewFilter(capacity),
future: nil,
met: m,
addch: make(chan string, AddQueueDepth),
addch: make(chan string, defaultAddQueueDepth),
}
for _, metric := range cuckooTraceCheckerMetrics {
m.Register(metric)
Expand Down
1 change: 1 addition & 0 deletions config/file_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ type GRPCServerParameters struct {
type SampleCacheConfig struct {
KeptSize uint `yaml:"KeptSize" default:"10_000"`
DroppedSize uint `yaml:"DroppedSize" default:"1_000_000"`
DroppedQueueSize uint `yaml:"DroppedQueueSize" default: "1000"`
SizeCheckInterval Duration `yaml:"SizeCheckInterval" default:"10s"`
}

Expand Down
10 changes: 10 additions & 0 deletions config/metadata/configMeta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1774,6 +1774,16 @@ groups:
Changing its size with live reload sets a future limit, but does not
have an immediate effect.
- name: DroppedQueueSize
type: int
valuetype: nondefault
default: 1000
reload: true
summary: is the maximum number of in-flight drop decision allowed before adding to the dropped trace cache.
description: >
The dropped decision queue is used to buffer drop decisions before they are stored in the decision cache.
If this queue fills up, then subsequent drop decisions will be discarded.
- name: SizeCheckInterval
v1group: SampleCacheConfig/SampleCache
v1name: SizeCheckInterval
Expand Down
4 changes: 3 additions & 1 deletion route/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ func (r *Router) SetVersion(ver string) {
var routerMetrics = []metrics.Metadata{
{Name: "_router_proxied", Type: metrics.Counter, Unit: metrics.Dimensionless, Description: "the number of events proxied to another refinery"},
{Name: "_router_event", Type: metrics.Counter, Unit: metrics.Dimensionless, Description: "the number of events received"},
{Name: "_router_batch", Type: metrics.Counter, Unit: metrics.Dimensionless, Description: "the number of batches of events received"},
{Name: "_router_otlp", Type: metrics.Counter, Unit: metrics.Dimensionless, Description: "the number of batches of otlp requests received"},
{Name: "_router_span", Type: metrics.Counter, Unit: metrics.Dimensionless, Description: "the number of spans received"},
{Name: "_router_dropped", Type: metrics.Counter, Unit: metrics.Dimensionless, Description: "the number of events dropped because the channel was full"},
{Name: "_router_nonspan", Type: metrics.Counter, Unit: metrics.Dimensionless, Description: "the number of non-span events received"},
Expand Down Expand Up @@ -535,6 +537,7 @@ func (router *Router) processOTLPRequest(
batches []huskyotlp.Batch,
apiKey string,
incomingUserAgent string) error {
router.Metrics.Increment(router.incomingOrPeer + "_router_otlp")

var requestID types.RequestIDContextKey
apiHost := router.Config.GetHoneycombAPI()
Expand Down Expand Up @@ -608,7 +611,6 @@ func (r *Router) processEvent(ev *types.Event, reqID interface{}) error {
if processed {
if !kept {
return nil

}

// If the span was kept, we want to generate a probe that we'll forward
Expand Down

0 comments on commit 1f54e9a

Please sign in to comment.