Giter Club home page Giter Club logo

data_daemon's People

Contributors

ianluites avatar punchcafe avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

data_daemon's Issues

Run time configuration

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.

High idle CPU/scheduler usage due to :timer.apply_after calls

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

:timer.apply_after(next_check, __MODULE__, :host_check!, [self(), host, port, ip, refresh])
and tracing this function call, shows it's called a ton of times, trace below:

(<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).

Default tags cannot be set at runtime

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.

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.