Skip to content

Commit

Permalink
updated senderWrapper metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
maurafortino committed Jan 16, 2024
1 parent bcdf00c commit dfaf61d
Showing 1 changed file with 30 additions and 17 deletions.
47 changes: 30 additions & 17 deletions senderWrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type CaduceusSenderWrapperIn struct {

Tracing candlelight.Tracing
SenderConfig SenderConfig
Metrics SenderMetricsIn
Metrics SenderMetrics
Logger *zap.Logger
}

Expand All @@ -36,6 +36,11 @@ type SenderMetricsIn struct {
QueryLatency prometheus.HistogramVec `name:"query_duration_histogram_seconds"`
EventType prometheus.CounterVec `name:"incoming_event_type_count"`
}

type SenderMetrics struct {
QueryLatency prometheus.HistogramVec
EventType prometheus.CounterVec
}
type SenderWrapper interface {
// Update([]ancla.InternalWebhook)
Queue(*wrp.Message)
Expand All @@ -45,45 +50,53 @@ type SenderWrapper interface {
// CaduceusSenderWrapper contains no external parameters.
type CaduceusSenderWrapper struct {
// The http client Do() function to share with OutboundSenders.
sender httpClient
sender httpClient
// The number of workers to assign to each OutboundSender created.
numWorkersPerSender int

// The queue size to assign to each OutboundSender created.
queueSizePerSender int
queueSizePerSender int

// Number of delivery retries before giving up
deliveryRetries int
deliveryRetries int

// Time in between delivery retries
deliveryInterval time.Duration
deliveryInterval time.Duration

// The cut off time to assign to each OutboundSender created.
cutOffPeriod time.Duration
cutOffPeriod time.Duration

// The amount of time to let expired OutboundSenders linger before
// shutting them down and cleaning up the resources associated with them.
linger time.Duration
linger time.Duration

// The logger implementation to share with OutboundSenders.
logger *zap.Logger
logger *zap.Logger

mutex *sync.RWMutex
senders map[string]OutboundSender
eventType prometheus.CounterVec
queryLatency prometheus.HistogramVec
wg sync.WaitGroup
shutdown chan struct{}
mutex *sync.RWMutex
senders map[string]OutboundSender
eventType prometheus.CounterVec
queryLatency prometheus.HistogramVec
wg sync.WaitGroup
shutdown chan struct{}

// CustomPIDs is a custom list of allowed PartnerIDs that will be used if a message
// has no partner IDs.
customPIDs []string
customPIDs []string

// DisablePartnerIDs dictates whether or not to enforce the partner ID check.
disablePartnerIDs bool
disablePartnerIDs bool
}

var SenderWrapperModule = fx.Module("caduceusSenderWrapper",
fx.Provide(
func(in SenderMetricsIn) SenderMetrics {
return SenderMetrics{
QueryLatency: in.QueryLatency,
EventType: in.EventType,
}
},

Check warning on line 98 in senderWrapper.go

View check run for this annotation

Codecov / codecov/patch

senderWrapper.go#L93-L98

Added lines #L93 - L98 were not covered by tests
),
fx.Provide(
func(in CaduceusSenderWrapperIn) http.RoundTripper {
return NewRoundTripper(in.SenderConfig, in.Tracing)
Expand Down

0 comments on commit dfaf61d

Please sign in to comment.