{"id":15062285,"url":"https://github.com/tyldum/mojolicious-plugin-prometheus","last_synced_at":"2025-04-10T14:22:16.268Z","repository":{"id":27688841,"uuid":"114926194","full_name":"tyldum/mojolicious-plugin-prometheus","owner":"tyldum","description":"Prometheus exporter for Mojolicious","archived":false,"fork":false,"pushed_at":"2024-02-20T18:56:17.000Z","size":102,"stargazers_count":6,"open_issues_count":3,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T13:04:26.052Z","etag":null,"topics":["mojolicious","perl","perl5","prometheus","prometheus-exporter"],"latest_commit_sha":null,"homepage":null,"language":"Perl","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/tyldum.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-20T20:01:30.000Z","updated_at":"2023-11-02T10:11:18.000Z","dependencies_parsed_at":"2022-08-07T13:00:57.763Z","dependency_job_id":"e9b138e7-5389-4c5c-9c16-9ce32b01ded6","html_url":"https://github.com/tyldum/mojolicious-plugin-prometheus","commit_stats":{"total_commits":79,"total_committers":6,"mean_commits":"13.166666666666666","dds":"0.20253164556962022","last_synced_commit":"c86835fb2287e68ae354d1561e1e0247ba2ad877"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyldum%2Fmojolicious-plugin-prometheus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyldum%2Fmojolicious-plugin-prometheus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyldum%2Fmojolicious-plugin-prometheus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyldum%2Fmojolicious-plugin-prometheus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tyldum","download_url":"https://codeload.github.com/tyldum/mojolicious-plugin-prometheus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248233935,"owners_count":21069493,"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":["mojolicious","perl","perl5","prometheus","prometheus-exporter"],"created_at":"2024-09-24T23:33:45.820Z","updated_at":"2025-04-10T14:22:16.234Z","avatar_url":"https://github.com/tyldum.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/tyldum/mojolicious-plugin-prometheus.svg?branch=master)](https://travis-ci.org/tyldum/mojolicious-plugin-prometheus) [![MetaCPAN Release](https://badge.fury.io/pl/Mojolicious-Plugin-Prometheus.svg)](https://metacpan.org/release/Mojolicious-Plugin-Prometheus) [![Coverage Status](http://codecov.io/github/tyldum/mojolicious-plugin-prometheus/coverage.svg?branch=master)](https://codecov.io/github/tyldum/mojolicious-plugin-prometheus?branch=master)\n# NAME\n\nMojolicious::Plugin::Prometheus - Mojolicious Plugin\n\n# SYNOPSIS\n\n    # Mojolicious\n    $self-\u003eplugin('Prometheus');\n\n    # Mojolicious::Lite\n    plugin 'Prometheus';\n\n    # Mojolicious::Lite, with custom response buckets (seconds)\n    plugin 'Prometheus' =\u003e { response_buckets =\u003e [qw/4 5 6/] };\n\n    # You can add your own route to do access control\n    my $under = app-\u003eroutes-\u003eunder('/secret' =\u003esub {\n      my $c = shift;\n      return 1 if $c-\u003ereq-\u003eurl-\u003eto_abs-\u003euserinfo eq 'Bender:rocks';\n      $c-\u003eres-\u003eheaders-\u003ewww_authenticate('Basic');\n      $c-\u003erender(text =\u003e 'Authentication required!', status =\u003e 401);\n      return undef;\n    });\n    plugin Prometheus =\u003e {route =\u003e $under};\n\n# DESCRIPTION\n\n[Mojolicious::Plugin::Prometheus](https://metacpan.org/pod/Mojolicious%3A%3APlugin%3A%3APrometheus) is a [Mojolicious](https://metacpan.org/pod/Mojolicious) plugin that exports Prometheus metrics from Mojolicious.\n\nHooks are also installed to measure requests response time and count requests based on method and HTTP return code.\n\n# HELPERS\n\n## prometheus\n\nCreate further instrumentation into your application by using this helper which gives access to the [Net::Prometheus](https://metacpan.org/pod/Net%3A%3APrometheus) object.\nSee [Net::Prometheus](https://metacpan.org/pod/Net%3A%3APrometheus) for usage.\n\n# METHODS\n\n[Mojolicious::Plugin::Prometheus](https://metacpan.org/pod/Mojolicious%3A%3APlugin%3A%3APrometheus) inherits all methods from\n[Mojolicious::Plugin](https://metacpan.org/pod/Mojolicious%3A%3APlugin) and implements the following new ones.\n\n## register\n\n    $plugin-\u003eregister($app, \\%config);\n\nRegister plugin in [Mojolicious](https://metacpan.org/pod/Mojolicious) application.\n\n`%config` can have:\n\n- route\n\n    [Mojolicious::Routes::Route](https://metacpan.org/pod/Mojolicious%3A%3ARoutes%3A%3ARoute) object to attach the metrics to, defaults to generating a new one for '/'.\n\n    Default: /\n\n- path\n\n    The path to mount the exporter.\n\n    Default: /metrics\n\n- prometheus\n\n    Override the [Net::Prometheus](https://metacpan.org/pod/Net%3A%3APrometheus) object. The default is a new singleton instance of [Net::Prometheus](https://metacpan.org/pod/Net%3A%3APrometheus).\n\n- namespace, subsystem\n\n    These will be prefixed to the metrics exported.\n\n- request\\_buckets\n\n    Override buckets for request sizes histogram.\n\n    Default: `(1, 50, 100, 1_000, 10_000, 50_000, 100_000, 500_000, 1_000_000)`\n\n- response\\_buckets\n\n    Override buckets for response sizes histogram.\n\n    Default: `(5, 50, 100, 1_000, 10_000, 50_000, 100_000, 500_000, 1_000_000)`\n\n- duration\\_buckets\n\n    Override buckets for request duration histogram.\n\n    Default: `(0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1.0, 2.5, 5.0, 7.5, 10)` (actually see [Net::Prometheus](https://metacpan.org/source/PEVANS/Net-Prometheus-0.05/lib/Net/Prometheus/Histogram.pm#L19))\n\n- shm\\_key\n\n    Key used for shared memory access between workers, see [$key in IPc::ShareLite](https://metacpan.org/pod/IPC::ShareLite) for details.\n\n# METRICS\n\nIn addition to exposing the default process metrics that [Net::Prometheus](https://metacpan.org/pod/Net%3A%3APrometheus) already expose\nthis plugin will also expose\n\n- `http_requests_total`, request counter partitioned over HTTP method and HTTP response code\n- `http_request_duration_seconds`, request duration histogram partitioned over HTTP method\n- `http_request_size_bytes`, request size histogram partitioned over HTTP method\n- `http_response_size_bytes`, response size histogram partitioned over HTTP method\n\n# AUTHOR\n\nVidar Tyldum\n\n(the IPC::ShareLite parts of this code is shamelessly stolen from [Mojolicious::Plugin::Status](https://metacpan.org/pod/Mojolicious%3A%3APlugin%3A%3AStatus) written by Sebastian Riedel and mangled into something that works for me)\n\n# COPYRIGHT AND LICENSE\n\nCopyright (C) 2018, Vidar Tyldum\n\nThis program is free software, you can redistribute it and/or modify it under\nthe terms of the Artistic License version 2.0.\n\n# SEE ALSO\n\n- [Net::Prometheus](https://metacpan.org/pod/Net%3A%3APrometheus)\n- [Mojolicious::Plugin::Status](https://metacpan.org/pod/Mojolicious%3A%3APlugin%3A%3AStatus)\n- [Mojolicious](https://metacpan.org/pod/Mojolicious)\n- [Mojolicious::Guides](https://metacpan.org/pod/Mojolicious%3A%3AGuides)\n- [http://mojolicious.org](http://mojolicious.org)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyldum%2Fmojolicious-plugin-prometheus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftyldum%2Fmojolicious-plugin-prometheus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyldum%2Fmojolicious-plugin-prometheus/lists"}