{"id":17212406,"url":"https://github.com/facetoe/promval","last_synced_at":"2025-10-10T05:13:33.100Z","repository":{"id":38037278,"uuid":"450832514","full_name":"facetoe/promval","owner":"facetoe","description":"PromQL validator written in Python","archived":false,"fork":false,"pushed_at":"2023-06-13T01:38:07.000Z","size":122,"stargazers_count":4,"open_issues_count":1,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-28T07:43:31.994Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/facetoe.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,"roadmap":null,"authors":null}},"created_at":"2022-01-22T13:57:29.000Z","updated_at":"2024-06-23T12:33:54.000Z","dependencies_parsed_at":"2024-01-23T15:08:14.081Z","dependency_job_id":"c9868ad5-682d-4b3f-a480-f18d8e173535","html_url":"https://github.com/facetoe/promval","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/facetoe/promval","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facetoe%2Fpromval","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facetoe%2Fpromval/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facetoe%2Fpromval/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facetoe%2Fpromval/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/facetoe","download_url":"https://codeload.github.com/facetoe/promval/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facetoe%2Fpromval/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002795,"owners_count":26083468,"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-10-10T02:00:06.843Z","response_time":62,"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":[],"created_at":"2024-10-15T02:59:57.845Z","updated_at":"2025-10-10T05:13:33.083Z","avatar_url":"https://github.com/facetoe.png","language":"Python","funding_links":[],"categories":["Other"],"sub_categories":[],"readme":"# promval\n\n`promval` is a PromQL validator written in Python.\n\nIt can be used to validate PromQL expressions are written as expected.\n\n### Examples\n\n#### Validate that we are grouping by certain metrics in by clauses\n\nHere we validate that we are grouping by \"job\" and \"host\":\n```python\npromql = \"\"\"\n    sum by (job) (\n      rate(http_requests_total[5m])\n    )\n\"\"\"\nvalidator = ByGroupValidator(expected={\"job\", \"host\"})\nvalidator.validate(promql)\n```\n\nThis fails with:\n```\npromval.error.ValidationError: 'line: 2:12 'by (job)' - missing required metric names {'host'}\n```\n\n#### Validate that labels containing a certain value are specified in by clause\n\nHere we ensure that if we have a label with a particular value, it is specified in the by clause:\n\n```python\nexpr = \"\"\"\nmax by (require, not_required)(foo_metric{required=~'important', something='else'})\n\"\"\"\nvalidator = ByLabelValueValidator(label_value=\"important\")\nvalidator.validate(expr)\n```\n\nThis fails with:\n```\n'line: 2:4 'by (require, not_required)' - expected label name 'required' in by clause\n```\n\n### Extending promval\n\nIt is easy to write custom validators, simply subclass `promval.validators.Validator` and implement a validating visitor. See examples in `promval.validators` for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacetoe%2Fpromval","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffacetoe%2Fpromval","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacetoe%2Fpromval/lists"}