Comments (2)
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.
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)
- Multi Query HOT 1
- Unable to push metrics using kairosdb client HOT 3
- Add support for Filtering aggregator HOT 1
- Add support for Rollups API HOT 5
- Custom HttpClient support HOT 1
- Upgrade Guava dependency to newer version HOT 1
- Upgrade the dependency to Kairos to 1.2.0 HOT 2
- Allow Query setTime and EndTime to be equal HOT 1
- use client in springboot with @Async HOT 3
- It is the bug when I push the string "127.0.0.1" HOT 2
- Cannot create SamplingAggregator with align_end_time HOT 2
- Upgrade to the latest version of the Apache client. HOT 1
- github 上的例子是基于客户端哪个版本的 HOT 1
- bug1 HOT 3
- On Varargs HOT 4
- QueryTagBuilder the range time is not effect bug HOT 3
- Sampling.value bug
- Authentication HOT 1
- Importing the wrong NotImplementedException HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kairosdb-client.