{"id":18834471,"url":"https://github.com/fgouteroux/promtoolfmt","last_synced_at":"2025-06-10T08:32:10.449Z","repository":{"id":185495372,"uuid":"620277202","full_name":"fgouteroux/promtoolfmt","owner":"fgouteroux","description":"Lint and format prometheus metrics text-based","archived":false,"fork":false,"pushed_at":"2023-03-30T08:47:21.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-29T18:15:08.932Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fgouteroux.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,"governance":null}},"created_at":"2023-03-28T11:24:13.000Z","updated_at":"2023-03-28T11:49:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"576b0890-ae32-4aa3-b0fa-32ac9e71de2f","html_url":"https://github.com/fgouteroux/promtoolfmt","commit_stats":null,"previous_names":["fgouteroux/promtoolfmt"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgouteroux%2Fpromtoolfmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgouteroux%2Fpromtoolfmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgouteroux%2Fpromtoolfmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgouteroux%2Fpromtoolfmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fgouteroux","download_url":"https://codeload.github.com/fgouteroux/promtoolfmt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fgouteroux%2Fpromtoolfmt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259037756,"owners_count":22796482,"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-08T02:12:34.862Z","updated_at":"2025-06-10T08:32:10.419Z","avatar_url":"https://github.com/fgouteroux.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# promtoolfmt\n\npromtoolfmt is made for linting and formating [prometheus metrics in text-based format](https://prometheus.io/docs/instrumenting/exposition_formats/#text-based-format).\n\n\n## How it works\n\npromtoolfmt remove any duplicate metric/comment, performs a linting pass on metrics and format them using [expfmt](https://pkg.go.dev/github.com/prometheus/common/expfmt#MetricFamilyToText).\n\n\n## Usage\n\n```shell\nUsage of promtoolfmt:\n  -silent\n      Silent or quiet mode.\n  -version\n      Show version.\n```\n\n## Run it\n\n```shell\n$ cat testdata/metrics-test.prom | promtoolfmt\n# HELP test_metric_info A metric with a constant '1' value labeled by testlabel.\n# TYPE test_metric_info gauge\ntest_metric_info{testlabel=\"testvalue1\"} 1\ntest_metric_info{testlabel=\"testvalue2\"} 1\n# HELP test_metric_duplicate_info A metric with a constant '1' value labeled by testlabel.\n# TYPE test_metric_duplicate_info gauge\ntest_metric_duplicate_info{testlabel=\"testvalue1\"} 1\n# HELP test_metric_with_spaces_info A metric with a constant '1' value labeled by testlabel.\n# TYPE test_metric_with_spaces_info gauge\ntest_metric_with_spaces_info{testlabel=\"testvalue1\",testanotherlabel=\"testanothervalue1\"} 1\ntest_metric_with_spaces_info{testlabel=\"testvalue2\",testanotherlabel=\"testanothervalue2\"} 1\n\n```\n\n### With silent mode\n\nUse this mode to get exit code only (suppress any output/error)\n\n```shell\n$ cat testdata/metrics-test.prom | promtoolfmt -silent\n```\n\n\n## Errors examples\n\n```shell\n$ cat testdata/invalid-metrics-no-help-text.prom | promtoolfmt\ntest_metric_info no help text\n```\n\n```shell\n$ cat testdata/invalid-metrics-float-value.prom | promtoolfmt\nerror while linting: text format parsing error in line 4: expected float as value, got \"1m\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgouteroux%2Fpromtoolfmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffgouteroux%2Fpromtoolfmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgouteroux%2Fpromtoolfmt/lists"}