Giter Club home page Giter Club logo

Comments (2)

jsabin avatar jsabin commented on September 22, 2024

There are really 2 issues here. 1) MetricBuilder is not thread-safe and 2) MetricBuilder is not designed to be reused. Reusing the same MetricBuilder sends the same data points again.

Any reason not to create a MetricBuilder per thread and create a new one each time?

from kairosdb-client.

martin-g avatar martin-g commented on September 22, 2024

Yes, I've figured it already! Now I collect the data in a concurrent data structure and once in a while I create MetricBuilder, copy the data to it and then push it. Any new metrics are collected in a new instance of the concurrent data structure in the meantime. I works nice but maybe it would be better if the library provides this functionality for free. As I said: I doubt anyone would want to send the collected metrics one by one. In addition currently KairosClient uses synchronous HttpClient so I use custom thread pool so the send is asynchronous because I do not want the main functionality in my application to wait for the HTTP call.
Recently Brian sent an email to Kairos mailing list about monitoring library that works as a logging library (log4j2). There I suggested to take a look at micrometer.io. I use kairos-client in a similar way - I have a wrapper around it that might be used everywhere in the application. A monitoring call may happen at any moment in any thread (actually we have few thousands calls per second), so we need to send the data points in batches and asynchronously. This is also the reason why I've asked recently for a release with the compression support in HttpClient.

from kairosdb-client.

Related Issues (20)

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.