Skip to content

Commit

Permalink
Caduceus edits (#198)
Browse files Browse the repository at this point in the history
* updated branch with changes

* adding dropped events metrics
  • Loading branch information
gargidb authored Apr 17, 2020
1 parent 8c26728 commit 941b8ad
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]
- pared down logging, especially debugging logs [#196](https://github.com/xmidt-org/caduceus/pull/196)
- added dropped events to metric [#195](https://github.com/xmidt-org/caduceus/issues/195)

## [v0.2.6]
- reduced time from when cutoff is sent to when queue is emptied
Expand Down
5 changes: 3 additions & 2 deletions outboundSender.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2017 Comcast Cable Communications Management, LLC
* Copyright 2020 Comcast Cable Communications Management, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -437,8 +437,9 @@ func (obs *CaduceusOutboundSender) isValidTimeWindow(now, dropUntil, deliverUnti
}

func (obs *CaduceusOutboundSender) Empty() {

cutoffMsgs := obs.queue.Load().(chan *wrp.Message)
obs.queue.Store(make(chan *wrp.Message, obs.queueSize))
obs.droppedCutoffCounter.Add(float64(len(cutoffMsgs)))
obs.queueDepthGauge.Set(0.0)
obs.queueEmpty = true

Expand Down
5 changes: 3 additions & 2 deletions outboundSender_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2017 Comcast Cable Communications Management, LLC
* Copyright 2020 Comcast Cable Communications Management, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,6 +23,7 @@ import (
"github.com/davecgh/go-spew/spew"
"github.com/go-kit/kit/log"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/xmidt-org/webpa-common/webhook"
"github.com/xmidt-org/wrp-go/v2"

Expand Down Expand Up @@ -123,7 +124,7 @@ func simpleFactorySetup(trans *transport, cutOffPeriod time.Duration, matcher []
fakeDroppedSlow.On("With", []string{"url", w.Config.URL, "reason", "expired_before_queueing"}).Return(fakeDroppedSlow)
fakeDroppedSlow.On("With", []string{"url", w.Config.URL, "reason", "invalid_config"}).Return(fakeDroppedSlow)
fakeDroppedSlow.On("With", []string{"url", w.Config.URL, "reason", "network_err"}).Return(fakeDroppedSlow)
fakeDroppedSlow.On("Add", 1.0).Return()
fakeDroppedSlow.On("Add", mock.Anything).Return()

// IncomingContentType cases
fakeContentType := new(mockCounter)
Expand Down

0 comments on commit 941b8ad

Please sign in to comment.