Skip to content

Commit

Permalink
adding 50_percentile to _get_histogram_metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
jonchase committed Feb 2, 2017
1 parent 162980a commit 39bf4e4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions pyformance/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def _get_histogram_metrics(self, key):
"max": histogram.get_max(),
"min": histogram.get_min(),
"std_dev": histogram.get_stddev(),
"50_percentile": snapshot.get_median(),
"75_percentile": snapshot.get_75th_percentile(),
"95_percentile": snapshot.get_95th_percentile(),
"99_percentile": snapshot.get_99th_percentile(),
Expand Down
2 changes: 2 additions & 0 deletions tests/test__carbon_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def test_report_now_plain(self):
'hist.min 1 2',
'hist.95_percentile 512 2',
'hist.75_percentile 160.0 2',
'hist.50_percentile 24.0 2',
'hist.std_dev 164.94851048466947 2' \
if PY3 else 'hist.std_dev 164.948510485 2',
'hist.max 512 2',
Expand Down Expand Up @@ -123,6 +124,7 @@ def test_report_now_pickle(self):
('hist.min', (2, 1)),
('hist.95_percentile', (2, 512.0)),
('hist.75_percentile', (2, 160.0)),
('hist.50_percentile', (2, 24.0)),
('hist.std_dev', (2, 164.94851048466947)),
('hist.max', (2, 512.0)),
('hist.avg', (2, 102.3)),
Expand Down
2 changes: 1 addition & 1 deletion tests/test__opentsdb_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_report_now(self):
c2.dec()
self.clock.add(1)
output = r._collect_metrics(registry=self.registry)
self.assertEqual(len(output), 31)
self.assertEqual(len(output), 32)
for data in output:
assert data['metric'].startswith("prefix.")

Expand Down

0 comments on commit 39bf4e4

Please sign in to comment.