{"id":18616839,"url":"https://github.com/sile/logi_prometheus","last_synced_at":"2025-08-16T07:14:28.938Z","repository":{"id":57518261,"uuid":"106087495","full_name":"sile/logi_prometheus","owner":"sile","description":"Prometheus metrics collector for logi","archived":false,"fork":false,"pushed_at":"2018-07-01T09:55:28.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-20T14:25:29.994Z","etag":null,"topics":["erlang","logger","prometheus"],"latest_commit_sha":null,"homepage":null,"language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sile.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":"2017-10-07T09:54:57.000Z","updated_at":"2023-07-25T14:11:58.000Z","dependencies_parsed_at":"2022-09-26T16:30:38.015Z","dependency_job_id":null,"html_url":"https://github.com/sile/logi_prometheus","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/sile/logi_prometheus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Flogi_prometheus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Flogi_prometheus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Flogi_prometheus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Flogi_prometheus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sile","download_url":"https://codeload.github.com/sile/logi_prometheus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Flogi_prometheus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270680081,"owners_count":24627120,"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-16T02:00:11.002Z","response_time":91,"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":["erlang","logger","prometheus"],"created_at":"2024-11-07T03:38:01.018Z","updated_at":"2025-08-16T07:14:28.916Z","avatar_url":"https://github.com/sile.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"logi_prometheus\n================\n\n[![hex.pm version](https://img.shields.io/hexpm/v/logi_prometheus.svg)](https://hex.pm/packages/logi_prometheus)\n[![Build Status](https://travis-ci.org/sile/logi_prometheus.svg?branch=master)](https://travis-ci.org/sile/logi_prometheus)\n[![Code Coverage](https://codecov.io/gh/sile/logi_prometheus/branch/master/graph/badge.svg)](https://codecov.io/gh/sile/logi_prometheus/branch/master)\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\n[Prometheus][prometheus] metrics collector for [logi].\n\n[Documentation](https://hexdocs.pm/logi_prometheus/)\n\n`logi_prometheus` provides counters that count the number of log messages as follows:\n\n```\nlogi_messages_total{logger=\"logger_name\",severity=\"info\",application=\"app_name\",module=\"mod_name\"} 1\n```\n\nIt is useful for detecting anomalies of your application by using [alerting rules].\n\n[logi]: https://github.com/sile/logi\n[prometheus]: https://prometheus.io/\n[alerting rules]: https://prometheus.io/docs/alerting/rules/\n\nExamples\n--------\n\nBasic usage.\n\n```erlang\n%% Installs `metrics_sink` to the default channel\n\u003e Sink = logi_prometheus_sink:new(metrics_sink, [{registry, example_registry}]).\n\u003e {ok, _} = logi_channel:install_sink(Sink, info).\n\n%% Logs a message\n\u003e logi:info(\"foo\").\n\n%% Prints metrics\n\u003e io:format(prometheus_text_format:format(example_registry)).\n# TYPE logi_messages_total counter\n# HELP logi_messages_total Messages count\nlogi_messages_total{sink=\"metrics_sink\",severity=\"info\",application=\"stdlib\",module=\"erl_eval\"} 1\n```\n\nBy using [prometheus_httpd], you can easily expose metrics collected by `logi_prometheus_sink`.\n\n[prometheus_httpd]: https://github.com/deadtrickster/prometheus-httpd\n\n```erlang\n%% Installs `metrics_sink` to the default channel\n\u003e Sink = logi_prometheus_sink:new(metrics_sink).\n\u003e {ok, _} = logi_channel:install_sink(Sink, info).\n\n%% Starts metrics exporter (i.e., HTTP server)\n\u003e prometheus_httpd:start().\n\n%% Retrieves current metrics\n\u003e httpc:request(\"http://localhost:8081/metrics\").\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsile%2Flogi_prometheus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsile%2Flogi_prometheus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsile%2Flogi_prometheus/lists"}