-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove need for nil checks around statsd metrics
Currently, we have to check if `autographer.stats` is nil anywhere we want to emit a statsd metric. This is error-prone and verbose. Work for AUT-150 (and more) would be easier if we do this here. This patch makes the `autographer.stats` field always non-nil. By default, `autographer`s created with `newAutographer` will have a `statsd.NoOpClient` object for its `stats` and if the autograph config has a statsd server configured, it will be replaced with a real statsd client when `autographer.addStats` is called. That addStats call will now always occur in autograph's main function. This moves the conditional for checking if the statsd server is configured into autographer.addStats. However, it would probably be better in the future for us to have this and the similar `autograph.add*` methods moved into the `newAutographer` contructor. This, though, at least makes the autographer type a lil safer on construction. This means that we use `statds.ClientInterface` instead of `*statsd.Client` everywhere to fit both client types. Along the way, we also have to fix up the main_test.go that was reproducing that conditional from the main inside it. We also fix an signer/xpi test that was depending on a statsd server running but not actually needing it to finish. This patch doesn't remove all of the nil checks. A follow up will be made to do so. Updates AUT-159 Updates AUT-150
- Loading branch information
Showing
5 changed files
with
25 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters