Skip to content

Commit

Permalink
Merge pull request #218 from xmidt-org/remove-metric
Browse files Browse the repository at this point in the history
removed contentTypeCounter metric
  • Loading branch information
schmidtw authored May 21, 2020
2 parents 2614db5 + c5d4f5a commit 9af6fcf
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
- removed contentTypeCounter [#218](https://github.com/xmidt-org/caduceus/pull/218)
- added configuration for which http codes Caduceus should retry on [#219](https://github.com/xmidt-org/caduceus/pull/219)

## [v0.2.8]
Expand Down
5 changes: 0 additions & 5 deletions http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ func TestServerHandlerFixWrp(t *testing.T) {
fakeQueueDepth := new(mockGauge)
fakeQueueDepth.On("Add", mock.AnythingOfType("float64")).Return().Times(2)

fakeIncomingContentTypeCount := new(mockCounter)
fakeIncomingContentTypeCount.On("With", []string{"content_type", "application/msgpack"}).Return(fakeIncomingContentTypeCount)
fakeIncomingContentTypeCount.On("With", []string{"content_type", ""}).Return(fakeIncomingContentTypeCount)
fakeIncomingContentTypeCount.On("Add", 1.0).Return()

serverWrapper := &ServerHandler{
Logger: logger,
caduceusHandler: fakeHandler,
Expand Down
8 changes: 0 additions & 8 deletions metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const (
SlowConsumerDroppedMsgCounter = "slow_consumer_dropped_message_count"
SlowConsumerCounter = "slow_consumer_cut_off_count"
IncomingQueueDepth = "incoming_queue_depth"
IncomingContentTypeCounter = "incoming_content_type_count"
IncomingEventTypeCounter = "incoming_event_type_count"
DropsDueToInvalidPayload = "drops_due_to_invalid_payload"
OutgoingQueueDepth = "outgoing_queue_depths"
Expand Down Expand Up @@ -47,12 +46,6 @@ func Metrics() []xmetrics.Metric {
Help: "Dropped messages due to invalid payloads.",
Type: "counter",
},
{
Name: IncomingContentTypeCounter,
Help: "Count of the content type processed.",
Type: "counter",
LabelNames: []string{"content_type"},
},
{
Name: DeliveryRetryCounter,
Help: "Number of delivery retries made",
Expand Down Expand Up @@ -148,7 +141,6 @@ func CreateOutbounderMetrics(m CaduceusMetricsRegistry, c *CaduceusOutboundSende
c.droppedNetworkErrCounter = m.NewCounter(SlowConsumerDroppedMsgCounter).With("url", c.id, "reason", "network_err")
c.droppedPanic = m.NewCounter(DropsDueToPanic).With("url", c.id)
c.queueDepthGauge = m.NewGauge(OutgoingQueueDepth).With("url", c.id)
c.contentTypeCounter = m.NewCounter(IncomingContentTypeCounter)
c.renewalTimeGauge = m.NewGauge(ConsumerRenewalTimeGauge).With("url", c.id)
c.deliverUntilGauge = m.NewGauge(ConsumerDeliverUntilGauge).With("url", c.id)
c.dropUntilGauge = m.NewGauge(ConsumerDropUntilGauge).With("url", c.id)
Expand Down
5 changes: 0 additions & 5 deletions outboundSender.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ type CaduceusOutboundSender struct {
droppedInvalidConfig metrics.Counter
droppedPanic metrics.Counter
cutOffCounter metrics.Counter
contentTypeCounter metrics.Counter
queueDepthGauge metrics.Gauge
renewalTimeGauge metrics.Gauge
deliverUntilGauge metrics.Gauge
Expand Down Expand Up @@ -547,8 +546,6 @@ func (obs *CaduceusOutboundSender) send(urls *ring.Ring, secret, acceptType stri
body := payload
var payloadReader *bytes.Reader

obs.contentTypeCounter.With("content_type", strings.TrimLeft(msg.ContentType, "application/")).Add(1.0)

// Use the internal content type unless the accept type is wrp
contentType := msg.ContentType
switch acceptType {
Expand Down Expand Up @@ -703,8 +700,6 @@ func (obs *CaduceusOutboundSender) queueOverflow() {
req.Header.Set("X-Webpa-Signature", sig)
}

// record content type, json.
obs.contentTypeCounter.With("content_type", "json").Add(1.0)
resp, err := obs.sender(req)
if nil != err {
// Failure
Expand Down
1 change: 0 additions & 1 deletion outboundSender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ func simpleFactorySetup(trans *transport, cutOffPeriod time.Duration, matcher []
fakeRegistry.On("NewCounter", OutgoingQueueDepth).Return(fakeDC)
fakeRegistry.On("NewCounter", SlowConsumerCounter).Return(fakeSlow)
fakeRegistry.On("NewCounter", SlowConsumerDroppedMsgCounter).Return(fakeDroppedSlow)
fakeRegistry.On("NewCounter", IncomingContentTypeCounter).Return(fakeContentType)
fakeRegistry.On("NewCounter", DropsDueToPanic).Return(fakePanicDrop)
fakeRegistry.On("NewGauge", OutgoingQueueDepth).Return(fakeQdepth)
fakeRegistry.On("NewGauge", DeliveryRetryMaxGauge).Return(fakeQdepth)
Expand Down
1 change: 0 additions & 1 deletion senderWrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ func getFakeFactory() *SenderWrapperFactory {
fakeRegistry.On("NewCounter", DeliveryCounter).Return(fakeIgnore)
fakeRegistry.On("NewCounter", SlowConsumerCounter).Return(fakeIgnore)
fakeRegistry.On("NewCounter", SlowConsumerDroppedMsgCounter).Return(fakeIgnore)
fakeRegistry.On("NewCounter", IncomingContentTypeCounter).Return(fakeIgnore)
fakeRegistry.On("NewCounter", IncomingEventTypeCounter).Return(fakeIgnore)
fakeRegistry.On("NewCounter", DropsDueToPanic).Return(fakeIgnore)
fakeRegistry.On("NewGauge", OutgoingQueueDepth).Return(fakeGauge)
Expand Down

0 comments on commit 9af6fcf

Please sign in to comment.