added missing stats_metric python binding

This commit is contained in:
arvidn 2018-07-28 20:32:11 +02:00 committed by Arvid Norberg
parent c92f527b60
commit 7980447480
3 changed files with 12 additions and 0 deletions

View File

@ -1,5 +1,6 @@
1.1.9 release
* added missing stats_metric python binding
* uTP connections are no longer exempt from rate limits by default
* fix exporting files from partfile while seeding
* fix potential deadlock on Windows, caused by performing restricted

View File

@ -1091,6 +1091,11 @@ void bind_session()
.def_readonly("type", &stats_metric::type)
;
enum_<stats_metric::metric_type_t>("metric_type_t")
.value("counter", stats_metric::type_counter)
.value("gauge", stats_metric::type_gauge)
;
def("session_stats_metrics", session_stats_metrics);
def("find_metric_idx", find_metric_idx);

View File

@ -9,6 +9,7 @@ import shutil
import binascii
import inspect
import pickle
import sys
class test_create_torrent(unittest.TestCase):
@ -395,6 +396,11 @@ class test_session(unittest.TestCase):
self.assertTrue(isinstance(a.values, dict))
self.assertTrue(len(a.values) > 0)
def test_metrics(self):
metrics = lt.session_stats_metrics()
for m in metrics:
sys.stdout.write('%s %s ' % (m.name, m.type))
def test_post_dht_stats(self):
s = lt.session({'alert_mask': lt.alert.category_t.stats_notification, 'enable_dht': False})
s.post_dht_stats()