-
Notifications
You must be signed in to change notification settings - Fork 175
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 default prometheus metrics to clients #652
Merged
Merged
Changes from 14 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
b1abd9a
add prom metrics to redis client
krav 736fa84
add library prefix
krav 0752e43
add tests for redis, memcached
krav f594785
rename a few things
krav 6153f07
rename
krav 2518a57
rename
krav 47fb50d
redis max_connections refers to max allowed in pool
krav 5660143
use idle/active, unit last
krav d7b398e
thrift pool.size is max before blocking
krav 9cabcbd
sqlalchemy max connections
krav ec5d571
redis max_connections refers to max allowed in pool
krav 6b4eae9
max_size not just size
krav 112744e
redis max not total
krav 429e065
update tests
krav 72997c5
redis max not total
krav 4662d49
select right sample for test
krav File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
del pymemcache | ||
|
||
from baseplate.lib.config import ConfigurationError | ||
from baseplate.clients.memcache import pool_from_config | ||
from baseplate.clients.memcache import pool_from_config, MemcacheContextFactory | ||
from baseplate.clients.memcache import lib as memcache_lib | ||
|
||
|
||
|
@@ -54,6 +54,16 @@ def test_nodelay(self): | |
) | ||
self.assertEqual(pool.no_delay, False) | ||
|
||
def test_metrics(self): | ||
max_pool_size = "123" | ||
ctx = MemcacheContextFactory( | ||
pool_from_config( | ||
{"memcache.endpoint": "localhost:1234", "memcache.max_pool_size": max_pool_size} | ||
) | ||
) | ||
metric = ctx.total_connections_gauge.collect() | ||
self.assertEqual(metric[0].samples[0].value, float(max_pool_size)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would it be useful to assert the labels are set correctly? |
||
|
||
|
||
class SerdeTests(unittest.TestCase): | ||
def test_serialize_str(self): | ||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wonder why this memcache method is
report_memcache_runtime_metrics
but all the other clients the equivalent method isreport_runtime_metrics
. I wonder why the difference.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, this might be a bug unless it's called outside of the baseplate. It's not referenced anywhere, while those with the latter name are called from
baseplate.py/baseplate/__init__.py
Line 525 in 48bcb0b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh https://github.snooguts.net/reddit/reddit-service-post/blob/b0dbc37074a4299fdb916eaddd6b6cb1fe1fd568/post/__init__.py#L132
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol. i see. thanks for the explanation