ianluites / data_daemon Goto Github PK
View Code? Open in Web Editor NEWAn Elixir StatsD client made for DataDog.
License: MIT License
An Elixir StatsD client made for DataDog.
License: MIT License
While the use DataDaemon
macro is very handy, it limits any time of run-time configurability, see also #2
My suggestion is being able to configure DataDaemon when it is included in the parent app supervisor tree, example:
# In your application code
defmodule Sample.DataDog do
@moduledoc ~S"My DataDog reporter."
use DataDaemon,
otp_app: :my_app,
extensions: [:datadog]
end
# In parent app supervisor
Sample.DataDog.start_link(url: "statsd+udp://localhost:8125")
Any parameter passed to start_link
overrides any set in the application config file.
I'd like to take a stab at this, but as it'll break the existing API I'll wait for your go-ahead.
We've been noticing an idle 25% CPU scheduler usage in staging, when DataDaemon is active.
Observer shows the process timer_server
using most of the CPU time, which is the gen_server that powers the erlang :timer module. Killing this process restores a 0% idle CPU usage.
There's a call to :timer.apply_after
in
data_daemon/lib/data_daemon/hound.ex
Line 217 in 72e0df0
(<0.22660.1888>) call timer:apply_after(600000,'Elixir.DataDaemon.Hound','host_check!',[<0.22660.1888>,"datadog_agent",8125,{10,0,7,27},ttl])
(<0.23963.1888>) call timer:apply_after(600000,'Elixir.DataDaemon.Hound','host_check!',[<0.23963.1888>,"datadog_agent",8125,{10,0,7,27},ttl])
(<0.23981.1888>) call timer:apply_after(600000,'Elixir.DataDaemon.Hound','host_check!',[<0.23981.1888>,"datadog_agent",8125,{10,0,7,27},ttl])
(<0.22771.1888>) call timer:apply_after(600000,'Elixir.DataDaemon.Hound','host_check!',[<0.22771.1888>,"datadog_agent",8125,{10,0,7,27},ttl])
(<0.23878.1888>) call timer:apply_after(600000,'Elixir.DataDaemon.Hound','host_check!',[<0.23878.1888>,"datadog_agent",8125,{10,0,7,27},ttl])
etc...
All of these are executed at the same time.
I seem to understand the logic between host_check!, but I'm not sure it's worth 25% of the CPU cycles, and it should probably default to disabled TTL refreshing, unless manually configured to do so.
Quoting from http://erlang.org/doc/efficiency_guide/commoncaveats.html
Creating timers using erlang:send_after/3 and erlang:start_timer/3 , is much more efficient than using the timers provided by the timer module in STDLIB. The timer module uses a separate process to manage the timers. That process can easily become overloaded if many processes create and cancel timers frequently (especially when using the SMP emulator).
Though undocumented, it's possible to set some default tags by calling use DataDaemon, tags: [foo: "bar"]
, but they are set at compile time, and it's currently impossible to have a different set of default tags at runtime โ for example, tags derived from environment variables.
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.