scarchik / opentsdb-py Goto Github PK
View Code? Open in Web Editor NEWPython client for OpenTSDB
License: MIT License
Python client for OpenTSDB
License: MIT License
Hi,
First, thank you for your work.
You need to know that I'm not familiar with OpenTSDB, but anyway I need to make it compatible with my current project and I want to use your library for that. I have a problem with your way to handle timestamp in the send
function.
def send(self, name: str, value, **tags) -> dict:
tags.update(self.static_tags)
if self.host_tag is True and 'host' not in tags:
tags['host'] = socket.gethostname()
self._validate_metric(name, value, tags)
metric = dict(metric=name, timestamp=int(tags.pop('timestamp', time.time())), value=value, tags=tags)
if not self._close_client.is_set():
self._push_metric_to_queue(metric)
return metric
I can see that you are doing a "time.time()", do you think there would be a way to make it configurable ?
Something like that:
def send(self, name: str, value, **tags, timestamp=time.time()) -> dict:
tags.update(self.static_tags)
if self.host_tag is True and 'host' not in tags:
tags['host'] = socket.gethostname()
self._validate_metric(name, value, tags)
metric = dict(metric=name, timestamp=int(tags.pop('timestamp', timestamp)), value=value, tags=tags)
if not self._close_client.is_set():
self._push_metric_to_queue(metric)
return metric
And allow the user to specify the timestamp when using Gauge (for example)
tsdb.ACTIVE_USERS.set(12, timestamp=my_personal_timestamp)
Thank you !
While testing package I noticed that TSDBClient.queue_size() doesn't exceed 12. Therefore metrics are sent too often.
There should be an attribute in TSDBClient (i.e. send_metrics_batch_min - minimal metrics batch size) and supported in HTTPPushThread or other changes in order to be able to collect metrics into batches big enough to lower network traffic and increase performance of the server which is monitored
I have OpenTSDB inside a krb5 environment. I am starting a research to know how supporting krb5 with your lib.
Did you have do it before? Thanks.
I can't use your potsdb package to get opentsdb data . I want use your potsdb client to read data from opentsdb ,then use python for data model
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.