Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metric support to Feedback Listener #23

Merged
merged 33 commits into from
Feb 19, 2019

Conversation

mbotarro
Copy link
Contributor

@mbotarro mbotarro commented Feb 19, 2019

This PR:

Adds support to StatsReporter in the Listener, Broker and InvalidTokenHandler.

The Listener periodically flushes the pipeline channels’ size as a gauge metric. The flush interval can be set using the new env variable PUSHER_STATS_FLUSH_S.

The InvalidTokenHandler sends metrics related to the tokens deletion. Its unit tests have been updated using a StatsD mock.

Beyond that, the following modifications have been introduced:

  • A Count method has been added in the Statsd Interface and its mock has been updated since there was a Count field that caused a conflict
  • Two new methods have been introduced to StatsD and StatsReporter interface to send generic Gauge and Count metrics with a game and platform as tags
  • There was en error where the PG mock wasn’t able to return the correct RowsAffected in the result. To solve that, the mock has been updated to put a null character at the end of the query in a way that the NewResult function is now able to correctly parse it.
  • A common.go file was created to manage the reporters initialisation and use
  • The Listener’s Stop method has been removed to prevent from closing the stopChannel twice

Moises Silva added 30 commits February 12, 2019 15:58
…DStatsd; add related tests; update tests to use Counts map instead of Count due to name conflict
…ge to create topics only once; use different consumer groups per test
@cscatolini
Copy link
Contributor

@mbotarro actually the env var is PUSHER_STATS_FLUSH_S since all env vars are prefixed with PUSHER_

Copy link
Contributor

@cscatolini cscatolini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor modifications before we can proceed.

feedback/invalid_token.go Show resolved Hide resolved
@@ -80,13 +93,13 @@ func (l *Listener) configure() error {
}
l.Queue = q

broker, err := NewBroker(l.Logger, l.Config, q.MessagesChannel(), l.Queue.PendingMessagesWaitGroup())
broker, err := NewBroker(l.Logger, l.Config, nil, q.MessagesChannel(), l.Queue.PendingMessagesWaitGroup())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd better send StatsReporters instead of nil in here.

if err != nil {
return fmt.Errorf("error creating new broker: %s", err.Error())
}
l.Broker = broker

handler, err := NewInvalidTokenHandler(l.Logger, l.Config, l.Broker.InvalidTokenOutChan)
handler, err := NewInvalidTokenHandler(l.Logger, l.Config, nil, l.Broker.InvalidTokenOutChan)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Contributor

@cscatolini cscatolini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job! 🥇

@cscatolini cscatolini merged commit a54d346 into master Feb 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants