{"id":15056426,"url":"https://github.com/waisbrot/dogstatsde","last_synced_at":"2025-10-21T18:39:37.392Z","repository":{"id":57491068,"uuid":"125414631","full_name":"waisbrot/dogstatsde","owner":"waisbrot","description":"A StatsD (plus Datadog tag additions) client for Erlang","archived":false,"fork":true,"pushed_at":"2019-01-12T03:18:32.000Z","size":164,"stargazers_count":8,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-29T10:42:11.641Z","etag":null,"topics":["datadog","elixir","erlang","metrics","monitoring"],"latest_commit_sha":null,"homepage":null,"language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"WhoopInc/dogstatsde","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/waisbrot.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-03-15T19:09:32.000Z","updated_at":"2024-06-27T02:14:57.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/waisbrot/dogstatsde","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waisbrot%2Fdogstatsde","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waisbrot%2Fdogstatsde/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waisbrot%2Fdogstatsde/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waisbrot%2Fdogstatsde/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/waisbrot","download_url":"https://codeload.github.com/waisbrot/dogstatsde/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235274289,"owners_count":18963889,"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":["datadog","elixir","erlang","metrics","monitoring"],"created_at":"2024-09-24T21:51:17.114Z","updated_at":"2025-10-04T16:30:48.410Z","avatar_url":"https://github.com/waisbrot.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/waisbrot/dogstatsde.svg?branch=master)](https://travis-ci.org/waisbrot/dogstatsde)\n[![Hex.pm](https://img.shields.io/hexpm/v/dogstatsde.svg)](https://hex.pm/packages/dogstatsde)\n\n# A dogstatsd client for Erlang\n\nDogStatsD is Datadog's extension of StatsD. It adds tags to the metrics.\n\n## Configure\n\nThe defaults assume that you're running a statsd server on localhost (true if the agent is installed locally).\n\nThere are a number of configuration settings. You can either provide them as environment variables in ALL_CAPS\nor in an Erlang config file in all_lowercase.\n\n| name               | type    | default       | info                                                                                  |\n| ------------------ | ------- | ------------- | ------------------------------------------------------------------------------------- |\n| AGENT_ADDRESS      | string  | `\"localhost\"` | Hostname or IP where we can send the StatsD UDP packets                               |\n| AGENT_PORT         | integer | `8125`        | Port that the StatsD agent is listening on                                            |\n| GLOBAL_PREFIX      | string  | `\"\"`          | Prefix to attach before all metric names. The `.` will be inserted for you            |\n| GLOBAL_TAGS        | map     | `#{}`         | Tags to attach to all metrics                                                         |\n| SEND_METRICS       | boolean | `true`        | Set to `false` when you're running tests to disable sending any metrics               |\n| VM_STATS           | boolean | `true`        | Collect stats on the Erlang VM?                                                       |\n| VM_STATS_DELAY     | integer | `60000`       | Time in ms between collection Erlang VM stats                                         |\n| VM_STATS_SCHEDULER | boolean | `true`        | Collect stats on the scheduler?                                                       |\n| VM_STATS_BASE_KEY  | string  | `\"erlang.vm\"` | All the VM stats will begin with this prefix (after the GLOBAL_PREFIX if that is set) |\n\n## Use\n\n### Erlang\n\n1. List dogstatsd in your `rebar.config` file\n\n```erlang\n{dogstatsd, \"\u003cversion\u003e\", {pkg, dogstatsde}}\n```\n\n2. List the dogstatsd application in your *.app.src file\n\n3. Provide configuration as needed when starting up\n\n4. For VM stats, no action is needed -- they'll collect on their own as long as the application is running\n\n5. For custom metrics:\n\n```erlang\ndogstatsd:gauge(\"users.active\", UserCount, #{ shard =\u003e ShardId, version =\u003e Vsn })\n```\n\n6. When pushing a lot of custom metrics, it can be beneficial to push them in chunks for efficiency, for example:\n```erlang\ndogstatsd:gauge([{\"users\", UserTypeCount, #{ user_type =\u003e UserType }}\n                 || {UserTypeCount, UserType} \u003c- UserCounts]).\n```\n\n### Elixir\n\nFor more details, see the example application in (examples/elixir)[examples/elixir]\n\n1. List dogstatsd dependency in your `mix.exs` file\n\n```elixir\n{:dogstatsd, \"~\u003e \u003cversion\u003e\", hex: :dogstatsde}\n```\n\n2. List `:dogstatsd` as an application in your `mix.exs`\n\n3. Provide configuration as needed when starting up\n\n4. For VM stats, no action is needed -- they'll collect on their own as long as the application is running\n\n5. For custom metrics:\n\n```elixir\n:dogstatsd.gauge(\"users.active\", user_count, %{ :shard =\u003e shard_id, :version =\u003e vsn })\n```\n\n### VM Stats\n\nIf `VM_STATS` is not disabled, dogstatsd will periodically run `erlang:statistics/1` and friends and collect data on the VM's performance:\n\n| name                         | erlang call                              | info                                                                               |\n| ----                         | -----------                              | ----                                                                               |\n| `proc_count`                 | `erlang:system_info(process_count)`      |                                                                                    |\n| `proc_limit`                 | `erlang:system_info(process_limit)`      |                                                                                    |\n| `messages_in_queues`         | `process_info(Pid, message_queue_len)`   | over all PIDs                                                                      |\n| `modules`                    | `length(code:all_loaded())`              |                                                                                    |\n| `run_queue`                  | `erlang:statistics(run_queue)`           |                                                                                    |\n| `error_logger_queue_len`     | `process_info(Pid, message_queue_len)`   | where `Pid` belongs to `error_logger`                                              |\n| `memory.total`               | `erlang:memory()`                        |                                                                                    |\n| `memory.procs_userd`         | `erlang:memory()`                        |                                                                                    |\n| `memory.atom_used`           | `erlang:memory()`                        |                                                                                    |\n| `memory.binary`              | `erlang:memory()`                        |                                                                                    |\n| `memory.ets`                 | `erlang:memory()`                        |                                                                                    |\n| `io.bytes_in`                | `erlang:statistics(io)`                  |                                                                                    |\n| `io.bytes_out`               | `erlang:statistics(io)`                  |                                                                                    |\n| `gc.count`                   | `erlang:statistics(garbage_collection)`  |                                                                                    |\n| `gc.words_reclaimed`         | `erlang:statistics(words_reclaimed)`     |                                                                                    |\n| `reductions`                 | `erlang:statistics(reductions)`          |                                                                                    |\n| `scheduler_wall_time.active` | `erlang:statistics(scheduler_wall_time)` | there are multiple schedulers, and the `scheduler` tag differentiates between them |\n| `scheduler_wall_time.total`  | `erlang:statistics(scheduler_wall_time)` | there are multiple schedulers, and the `scheduler` tag differentiates between them |\n\n![screen-shot of VM stats in Datadog](img/erlang-vm-stats.jpg)\n\n## Metric types\n\nAll metrics share the same signature:\n\n```erlang\n-type metric_name() :: iodata().\n-type metric_value() :: number().\n-type metric_sample_rate() :: number().\n-type metric_tags() :: map().\n\n-spec MetricFunction(metric_name(), metric_value(), metric_sample_rate(), metric_tags()) -\u003e ok.\n```\n\nSome metrics have aliases\n\n| name      | alias   |\n| ----      | ------- |\n| gauge     |         |\n| increment | counter |\n| histogram |         |\n| timing    | timer   |\n| set       |         |\n\n* The metric name is a string value with dots to separate levels of namespacing.\n* The sample rate is a number between [0.0,1.0]. This is the probability of sending a particular metric.\n* Tags are given as a map. The keys and values can be atoms, strings, or numbers.\n\n\nMetric name and value are required. Sample rate defaults to 1.0. Tags defaults to an empty tag-set, but the value of `GLOBAL_TAGS` (which also defaults to an empty tag-set) is always merged with the passed tags.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaisbrot%2Fdogstatsde","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwaisbrot%2Fdogstatsde","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaisbrot%2Fdogstatsde/lists"}