{"id":25870687,"url":"https://github.com/prometheus-erl/prometheus-plugs","last_synced_at":"2025-12-12T00:30:46.613Z","repository":{"id":55090278,"uuid":"58969380","full_name":"prometheus-erl/prometheus-plugs","owner":"prometheus-erl","description":"Prometheus.erl Elixir Plugs","archived":false,"fork":false,"pushed_at":"2022-11-23T08:21:27.000Z","size":100,"stargazers_count":54,"open_issues_count":15,"forks_count":35,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-07T23:15:48.514Z","etag":null,"topics":["collector","elixir","instrumentation","monitoring","plug","prometheus"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prometheus-erl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-16T21:33:47.000Z","updated_at":"2025-02-25T10:12:51.000Z","dependencies_parsed_at":"2023-01-22T06:19:14.604Z","dependency_job_id":null,"html_url":"https://github.com/prometheus-erl/prometheus-plugs","commit_stats":null,"previous_names":["prometheus-erl/prometheus-plugs","deadtrickster/prometheus-plugs"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/prometheus-erl/prometheus-plugs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prometheus-erl%2Fprometheus-plugs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prometheus-erl%2Fprometheus-plugs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prometheus-erl%2Fprometheus-plugs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prometheus-erl%2Fprometheus-plugs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prometheus-erl","download_url":"https://codeload.github.com/prometheus-erl/prometheus-plugs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prometheus-erl%2Fprometheus-plugs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272800965,"owners_count":24995185,"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","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["collector","elixir","instrumentation","monitoring","plug","prometheus"],"created_at":"2025-03-02T06:12:56.017Z","updated_at":"2025-10-25T14:42:45.063Z","avatar_url":"https://github.com/prometheus-erl.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Prometheus.io Plugs Instrumenter/Exporter\n\n[![Build Status](https://travis-ci.org/deadtrickster/prometheus-plugs.svg?branch=master)](https://travis-ci.org/deadtrickster/prometheus-plugs)\n[![Module version](https://img.shields.io/hexpm/v/prometheus_plugs.svg?maxAge=2592000?style=plastic)](https://hex.pm/packages/prometheus_plugs)\n[![Documentation](https://img.shields.io/badge/hex-docs-green.svg)](https://hexdocs.pm/prometheus_plugs/)\n[![Total Download](https://img.shields.io/hexpm/dt/prometheus_plugs.svg?maxAge=2592000)](https://hex.pm/packages/prometheus_plugs)\n[![License](https://img.shields.io/hexpm/l/prometheus_plugs.svg?maxAge=259200)](https://github.com/deadtrickster/prometheus-plugs/blob/master/LICENSE)\n[![Last Updated](https://img.shields.io/github/last-commit/deadtrickster/prometheus-plugs.svg)](https://github.com/deadtrickster/prometheus-plugs/commits/master)\n\nElixir Plug integration for [prometheus.ex](https://github.com/deadtrickster/prometheus.ex)\n\nQuick introduction by [**@skosch**](https://github.com/skosch): [Monitoring Elixir apps in 2016: Prometheus/Grafana Step-by-Step Guide](https://aldusleaf.org/2016-09-30-monitoring-elixir-apps-in-2016-prometheus-and-grafana.html)\n\n - IRC: #elixir-lang on Freenode;\n - [Slack](https://elixir-slackin.herokuapp.com/): #prometheus channel - [Browser](https://elixir-lang.slack.com/messages/prometheus) or App(slack://elixir-lang.slack.com/messages/prometheus).\n\n## Instrumentation\n\nTo instrument whole plug pipeline use `Prometheus.PlugPipelineInstrumenter`:\n\n```elixir\ndefmodule MyApp.Endpoint.PipelineInstrumenter do\n  use Prometheus.PlugPipelineInstrumenter\nend\n```\n\nTo instrument just a single plug use `Prometheus.PlugInstrumenter`:\n\n```elixir\ndefmodule MyApp.CoolPlugInstrumenter do\n  use Prometheus.PlugInstrumenter, [plug: Guardian.Plug.EnsureAuthenticated,\n                                    counter: :guardian_ensure_authenticated_total,\n                                    histogram: :guardian_ensure_authenticated_duration_microseconds,\n                                    labels: [:authenticated]]\nend\n```\n\nBoth modules implement plug interface and `Prometheus.PlugInstrumenter` generates proxy for specified plug so you'll need to replace instrumented plug with your instrumenter in pipeline.\n\nInstrumenters configured via `:prometheus` app environment. Please consult respective modules documentation on\nwhat options are available.\n\n## Exporting\n\nTo export metric we first have to create a plug that will serve scraping requests.\n\n```elixir\ndefmodule MyApp.MetricsExporter do\n  use Prometheus.PlugExporter\nend\n```\n\nCall the `MyApp.MetricsExporter.setup/0` function when the application starts.\n\n```elixir\n# e.g. in `application.ex`\nMyApp.MetricsExporter.setup()\n```\n\nThen we add exporter to MyApp pipeline:\n\n```elixir\nplug MyApp.MetricsExporter\n```\n\nYou can configure path, export format and Prometheus registry via `:prometheus` app environment.\nFor more information please see `Prometheus.PlugExporter` module documentation.\n\nExport endpoint can be secured using HTTP Basic Authentication:\n\n```elixir\n  auth: {:basic, \"username\", \"password\"}\n```\n\n## Integrations / Collectors / Instrumenters\n\n - [Ecto collector](https://github.com/deadtrickster/prometheus-ecto)\n - [Plugs Instrumenter/Exporter](https://github.com/deadtrickster/prometheus-plugs)\n - [Elli middleware](https://github.com/elli-lib/elli_prometheus)\n - [Fuse plugin](https://github.com/jlouis/fuse#fuse_stats_prometheus)\n - [Phoenix instrumenter](https://github.com/deadtrickster/prometheus-phoenix)\n - [Process Info Collector](https://github.com/deadtrickster/prometheus_process_collector.erl)\n - [RabbitMQ Exporter](https://github.com/deadtrickster/prometheus_rabbitmq_exporter)\n\n## Installation\n\nThe package can be installed as:\n\n1.  Add `:prometheus_plug` to your list of dependencies in `mix.exs`:\n    ```elixir\n    def deps do\n      [{:prometheus_plugs, \"~\u003e 1.1.1\"}]\n    end\n    ```\n\n2.  Ensure prometheus is started before your application:\n    ``` elixir\n    def application do\n      [applications: [:prometheus_plugs]]\n    end\n    ```\n\n## License\n\nThis project is licensed under the MIT license. Copyright (c) 2016-present, Ilya Khaprov.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprometheus-erl%2Fprometheus-plugs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprometheus-erl%2Fprometheus-plugs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprometheus-erl%2Fprometheus-plugs/lists"}