GithubHelp home page GithubHelp logo

beam-telemetry / telemetry_poller Goto Github PK

View Code? Open in Web Editor NEW
123.0 10.0 17.0 133 KB

Periodically gather measurements and publish them as Telemetry events

Home Page: https://hexdocs.pm/telemetry_poller

License: Apache License 2.0

Erlang 100.00%
elixir metrics instrumentation events

telemetry_poller's People

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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

telemetry_poller's Issues

Allow telemetry 0.4?

Hi!

Is there a particular reason why telemetry 1.0 is required? AFAIK there were no API changes compared to 0.4.

The reason I'm asking is because we're currently in a weird transition moment, where many packages still depend on telemetry 0.4 without allowing 1.0, so if some packages (like this one) don't allow 0.4, we're forced to specify 1.0 with an override. In my project this succeeds on mix deps.get dependency resolution, but unfortunately, other tasks like mix test etc fail to start (I'm not exactly sure why but other people may also be hitting this problem).

I think it could be good to specify ~> 0.4 or ~> 1.0, at least for some time

[Feature Request] Include process count as built-in and default measurement

As Fred Herbert wrote in Stuff Goes Bad: Erlang In Anger: "Tracking [process count] over time can be extremely helpful to try and characterize load or detect process leaks..."

Adding an additional measurement to Telemetry.Poller to report the process count at periodic intervals could be very useful.

If we agree this is useful and someone wants to take this on, I would greatly appreciate it as I am personally not incredibly adept at writing Erlang. If no one is available to take it on, I'll probably give it a try, but it may take me some time ๐Ÿ˜„

Bonus feature: I'm also thinking it would be very neat to be able to poll for a top-list of processes based on reds or memory, similar to :etop, but I understand if this is more niche and maybe not appropriate as a default for this lib.

Support for dynamically created processes

My team is creating long-living dynamically created GenServer instances (created with a DynamicSupervisor) when our assets connect to our servers. Looking at the code, and as far as I understand, it is currently not possible to dynamically use telemetry_poller to measure such processes.

Which approach is the best in this case and would that make sense to extend telemetry_poller for this use case? It seems to me that adding an add_measurement call in telemetry_poller.erl would be enough.

Edit: probably not enough since process_info/3 takes a name, so this would not work on unnamed process but you get the idea

`default` option should be set on initializing

A default poller is started with telemetry_poller responsible for emitting
measurements for memory and total_run_queue_lengths. You can customize
the behaviour of the default poller by setting the default key under the
telemetry_poller application environment. Setting it to false disables
the poller.

This makes it pretty hard to use multiple instances of :telemetry_poller (which is currently required to use multiple periods). I think a good approach would be to move it to :telemetry_poller startup options. This would also fit with the "avoid config files" approach which is more flexible.

Add a process_info built-in measurement

Now that we have standardized telemetry events to include multiple measurements, I think it becomes a bit more straight-forward to provide an API that provides general process information. In particular, I would like to include process_info (with perhaps port_info and ets_info) coming in the future. My biggest question is how we are going to expose this to users.

One option is to have a Telemetry.Poller.Measurements module and have users do something like this:

{Telemetry.Poller.Measurements, :process_info, [process_name, [:message_queue_len], [:my_app, :event]]}

I do find this API too verbose though. So my other proposal is something like this:

{:process_info, name: MyApp.Foo, event: [:my_app, :process_data], measurements: [:message_queue_len, :memory]}

Then I would unify vm_measurements and measurements, into a single key like this:

          :memory
          | :total_run_queue_lengths
          | {:process_info, keyword()}
          | {module(), function :: atom(), args :: list()}

And we would replace vm_measurements: :default by measurements: :default.

@arkgil thoughts?

Include limits

For atoms, ets, ports and processes. We need to discuss about alarms though, because the value in itself is not enough.

Convert to Erlang?

Wondering if this library shouldn't also be Erlang since telemetry is and this is something that will definitely be written again if telemetry catches on with Erlang.

I may ask the same regarding metrics but after discussing more today I'm not sure its use is what I was thinking, so need to think about that one some more.

Automatically start a poller when telemetry starts

It should be configurable like this:

config :telemetry_poller,
  vm_measurements: :default, # :default | [:foo, :bar] | :all
  period: ...

The default values for this poller are:

Keyword.merge([name: Telemetry.Poller, vm_measurements: :default], Application.get_all_env(:telemetry_poller))

We should change start_link to have the vm_measurements function so we unify the APIs. The vm_measuremets function that exists should be removed.

The sampling name is incorrectly used

@fishcakez brought to my attention that the name sampling is confusing, especially in regards to the OpenCensus nomenclature.

To be more precise, the confusion arises because this library provides a "sampling rate", which is a very specific case of sampling, compared to sampling in general.

One option is to rename this library, but we could not come up with a good name. Maybe telemetry_timer. In any case, we thought we could raise the topic for debate.

atom_count missing on macOS Catalina

When using telemetry_poller on OTP-22 + macOS Catalina, I would expect atom_count to be included in the system_counts event, but it's missing:

[Telemetry.Metrics.ConsoleReporter] Got new event!
Event name: vm.system_counts
All measurements: %{port_count: 18, process_count: 310}
All metadata: %{}

I suspect the problem is in rebar.config:

{erl_opts, [{platform_define, "19", 'OTP19'}, debug_info]}.

When the platform happens to contain a 19, for instance 22.0-x86_64-apple-darwin19.3.0, then this matches because the regex isn't constrained to the start of the line. See: erlang/rebar3#2105 (comment)

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.