{"id":20564347,"url":"https://github.com/tarantool/cartridge-metrics-role","last_synced_at":"2025-08-02T07:39:29.665Z","repository":{"id":166834293,"uuid":"641977733","full_name":"tarantool/cartridge-metrics-role","owner":"tarantool","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-05T09:50:30.000Z","size":30,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-03-28T04:03:33.590Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","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/tarantool.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-17T14:55:10.000Z","updated_at":"2025-02-05T09:50:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"f2223ad9-c596-47cd-8a99-0f01dd91463e","html_url":"https://github.com/tarantool/cartridge-metrics-role","commit_stats":null,"previous_names":["tarantool/cartridge-metrics-role"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarantool%2Fcartridge-metrics-role","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarantool%2Fcartridge-metrics-role/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarantool%2Fcartridge-metrics-role/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tarantool%2Fcartridge-metrics-role/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tarantool","download_url":"https://codeload.github.com/tarantool/cartridge-metrics-role/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248904640,"owners_count":21180835,"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":[],"created_at":"2024-11-16T04:25:53.193Z","updated_at":"2025-04-14T15:11:00.958Z","avatar_url":"https://github.com/tarantool.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://github.com/tarantool/cartridge-metrics-role/workflows/Tests/badge.svg?branch=master)](https://github.com/tarantool/cartridge-metrics-role/actions)\n\n# Cartridge Metrics Role\n\n`cartridge.roles.metrics` is a role for\n[tarantool/cartridge](https://github.com/tarantool/cartridge).\nIt allows to use default metrics in a Cartridge application and manage them\nvia configuration.\n\n### Usage\n\n1. Add the `cartridge-metrics-role` package to dependencies in the `.rockspec` file.\n\n   ```lua\n   dependencies = {\n       ...\n       'cartridge-metrics-role == 0.1.0-1',\n       ...\n   }\n   ```\n\n2. Add `cartridge.roles.metrics` to the roles list in `cartridge.cfg`\n   in your entry-point file (e.g. `init.lua`).\n   ```lua\n   local ok, err = cartridge.cfg({\n       ...\n       roles = {\n           ...\n           'cartridge.roles.metrics',\n           ...\n       },\n   })\n   ```\n\n3. To view metrics via API endpoints, use `set_export`.\n   **NOTE** that `set_export` has lower priority than clusterwide config and could be overriden by the metrics config.\n\n   ```lua\n   local metrics = require('cartridge.roles.metrics')\n   metrics.set_export({\n       {\n           path = '/path_for_json_metrics',\n           format = 'json'\n       },\n       {\n           path = '/path_for_prometheus_metrics',\n           format = 'prometheus'\n       },\n       {\n           path = '/health',\n           format = 'health'\n       }\n   })\n   ```\n   You can add several entry points of the same format by different paths,\n   like this:\n\n   ```lua\n   metrics.set_export({\n      {\n          path = '/path_for_json_metrics',\n          format = 'json'\n      },\n      {\n          path = '/another_path_for_json_metrics',\n          format = 'json'\n      },\n   })\n   ```\n   The metrics will be available on the path specified in `path` in the format\n   specified in `format`.\n\n4. After role initialization, default metrics will be enabled and the global\n   label 'alias' will be set. If you need to use the functionality of any metrics\n   package, you may get it as a Cartridge service and use it like a regular\n   package after `require`:\n   ```lua\n   local cartridge = require('cartridge')\n   local metrics = cartridge.service_get('metrics')\n   ```\n\n5. There is an ability in Tarantool Cartridge \u003e= '2.4.0' to set a zone for each\n   server in a cluster. If a zone was set for the server 'zone' label will be added\n   for all metrics on this server.\n\nThis repository is a former part of\n[metrics](https://github.com/tarantool/metrics) repository.\n\nMetrics is a library to collect and expose [Tarantool](https://tarantool.io)-based applications metrics.\nYou can see related documentation [here](https://www.tarantool.io/en/doc/latest/book/monitoring/).\n\n## Contacts\n\nIf you have questions, please ask it on [StackOverflow](https://stackoverflow.com/questions/tagged/tarantool) or contact us in Telegram:\n\n- [Russian-speaking chat](https://t.me/tarantoolru)\n- [English-speaking chat](https://t.me/tarantool)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarantool%2Fcartridge-metrics-role","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftarantool%2Fcartridge-metrics-role","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarantool%2Fcartridge-metrics-role/lists"}