{"id":20476673,"url":"https://github.com/rabbitmq/sysmon-handler","last_synced_at":"2025-04-13T12:44:48.687Z","repository":{"id":57555423,"uuid":"162838377","full_name":"rabbitmq/sysmon-handler","owner":"rabbitmq","description":"Simple OTP app for managing Erlang VM system_monitor event messages","archived":false,"fork":false,"pushed_at":"2022-04-29T21:51:45.000Z","size":658,"stargazers_count":3,"open_issues_count":0,"forks_count":4,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-03-27T03:51:15.446Z","etag":null,"topics":["erlang","metrics","monitoring","observability","plugin","rabbitmq"],"latest_commit_sha":null,"homepage":null,"language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rabbitmq.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-22T19:43:22.000Z","updated_at":"2024-03-08T15:28:10.000Z","dependencies_parsed_at":"2022-09-14T11:01:31.059Z","dependency_job_id":null,"html_url":"https://github.com/rabbitmq/sysmon-handler","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabbitmq%2Fsysmon-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabbitmq%2Fsysmon-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabbitmq%2Fsysmon-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabbitmq%2Fsysmon-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rabbitmq","download_url":"https://codeload.github.com/rabbitmq/sysmon-handler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248717241,"owners_count":21150387,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["erlang","metrics","monitoring","observability","plugin","rabbitmq"],"created_at":"2024-11-15T15:22:13.396Z","updated_at":"2025-04-13T12:44:48.663Z","avatar_url":"https://github.com/rabbitmq.png","language":"Erlang","readme":"sysmon_handler\n==============\n\n[![Build Status](https://travis-ci.com/rabbitmq/sysmon-handler.svg?branch=master)](https://travis-ci.com/rabbitmq/sysmon-handler)\n[![Hex version](https://img.shields.io/hexpm/v/sysmon_handler.svg \"Hex version\")](https://hex.pm/packages/sysmon_handler)\n\n`sysmon_handler` is an Erlang/OTP application that manages the event messages\nthat can be generated by the Erlang virtual machine's `system_monitor` BIF\n(Built-In Function). These messages can notify a central data-gathering\nprocess about the following events:\n\n* Processes that have their private heaps grow beyond a certain size.\n* Processes whose private heap garbage collection ops take too long\n* Ports that are busy, e.g., blocking file \u0026 socket I/O\n* Network distribution ports are busy, e.g., lots of communication\n  with a slow peer Erlang node.\n\nThe problem with `system_monitor` events is that there isn't a mechanism within\nthe Erlang virtual machine that limits the rate at which the events are\ngenerated. A busy VM can easily create many hundreds of these messages per\nsecond. Some kind of rate-limiting filter is required to avoid further\noverloading a system that may already be overloaded.\n\nThis app will use two processes for `system_monitor` message handling.\n\n1. A `gen_server` process to provide a rate-limiting filter.\n1. A `gen_event` server to allow flexible, user-defined functions to\nrespond to `system_monitor` events that pass through the first stage\nfilter.\n\nThere can be only one `system_monitor` process\n----------------------------------------------\n\nThe Erlang/OTP documentation is pretty clear on this point: only one process\ncan receive `system_monitor` messages. But using the `sysmon_handler` OTP app,\nif multiple parties are interested in receiving `system_monitor` events, each\nparty can add an event handler to the `sysmon_handler` event handler.\n\nThe event handler process in this application uses the registered name\n`sysmon_handler`. To add your handler, use something like:\n`gen_event:add_sup_handler(sysmon_handler, yourModuleName,\nYourInitialArgs)`.\n\nSee the [`gen_event` documentation for\n`add_sup_event/3`](https://www.erlang.org/doc/man/gen_event.html#add_sup_handler-3)\nfor API details. See the example event handler module in the source repository,\n`src/sysmon_handler_example_handler.erl`, for example usage.\n\nEvents sent to custom event handlers\n------------------------------------\n\nThe following events can be sent from the `sysmon_handler`\nfiltering/rate-limiting process (a.k.a. `sysmon_handler_filter`) to the\nevent handler process (a.k.a. `sysmon_handler`).\n\n* `{monitor, pid(), atom(), term()}` ... These are\n  `system_monitor` messages as they are received verbatim by the\n  `sysmon_handler_filter` process. See the reference documentation for\n  `erlang:system_monitor/2` for details.\n* `{suppressed, proc_events | port_events, Num::integer()}` ... These\n  messages inform your event handler that `Num` events of a certain type\n  (`proc_events` or `port_events`) were suppressed in the last second\n  (i.e. their arrival rate exceeded the configured rate limit).\n\nChange Log\n----------\n\n| Version  | Changes\n|----------|-----------------------------------------------------------\n| `v1.2.0` | Do not report an error if Erlang distribution is stopped. Require Erlang 21.x.\n| `v1.1.0` | Change the `heap_size` cuttlefish default to be 80MiB on 64-bit systems, which is in line with the default word count limit. Cuttlefish default for `garbage_collect` is changed to `50ms` which is in line with the default if unset. Cuttlefish default for `scheduled_execution` also changed to `50ms`, also in line with the default if unset\n| `v1.0.0` | Initial release.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frabbitmq%2Fsysmon-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frabbitmq%2Fsysmon-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frabbitmq%2Fsysmon-handler/lists"}