Giter Site home page Giter Site logo

opentsdb-py's People

Contributors

fraglab-admin avatar scarchik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

opentsdb-py's Issues

Specify Timestamp instead of forced time.time()

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 !

Too many http requests in case of HTTPPushThread

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

Kerberos environment

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.