Improves flow handling and adds runtime stats APIs
Refactors TCP and UDP flow managers to enhance analyzer selection and flow binding accuracy, including O(1) UDP stream rebinding by 5-tuple. Introduces runtime stats tracking for engine and ruleset operations, exposing new APIs for granular performance and error metrics. Optimizes GeoMatcher with result caching and supports efficient geosite set matching, reducing redundant computation in ruleset expressions.
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"net"
|
||||
"strconv"
|
||||
"sync/atomic"
|
||||
|
||||
"git.difuse.io/Difuse/Mellaris/analyzer"
|
||||
"git.difuse.io/Difuse/Mellaris/modifier"
|
||||
@@ -95,6 +96,28 @@ type Ruleset interface {
|
||||
Match(StreamInfo) MatchResult
|
||||
}
|
||||
|
||||
type Stats struct {
|
||||
MatchCalls uint64
|
||||
MatchErrors uint64
|
||||
MatchLatencyNanos uint64
|
||||
LookupCalls uint64
|
||||
LookupErrors uint64
|
||||
LookupLatencyNanos uint64
|
||||
}
|
||||
|
||||
type statsCounters struct {
|
||||
MatchCalls atomic.Uint64
|
||||
MatchErrors atomic.Uint64
|
||||
MatchLatencyNanos atomic.Uint64
|
||||
LookupCalls atomic.Uint64
|
||||
LookupErrors atomic.Uint64
|
||||
LookupLatencyNanos atomic.Uint64
|
||||
}
|
||||
|
||||
type StatsProvider interface {
|
||||
Stats() Stats
|
||||
}
|
||||
|
||||
// Logger is the logging interface for the ruleset.
|
||||
type Logger interface {
|
||||
Log(info StreamInfo, name string)
|
||||
|
||||
Reference in New Issue
Block a user