{"id":31058433,"url":"https://github.com/marcelmay/assertj-prometheus-metrics","last_synced_at":"2025-09-15T07:51:01.170Z","repository":{"id":57730711,"uuid":"164075893","full_name":"marcelmay/assertj-prometheus-metrics","owner":"marcelmay","description":"Assertj support for Prometheus (MetricFamilySamples) metrics","archived":false,"fork":false,"pushed_at":"2025-08-13T15:41:30.000Z","size":150,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-13T17:39:47.952Z","etag":null,"topics":["assertj","assertj-prometheus","assertj-support","prometheus","prometheus-utility","test-framework","testing"],"latest_commit_sha":null,"homepage":null,"language":"Java","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/marcelmay.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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-01-04T07:49:23.000Z","updated_at":"2025-08-13T15:41:27.000Z","dependencies_parsed_at":"2025-02-25T20:18:51.405Z","dependency_job_id":"96721114-a11a-4e90-9649-b2b1c11b71ce","html_url":"https://github.com/marcelmay/assertj-prometheus-metrics","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/marcelmay/assertj-prometheus-metrics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelmay%2Fassertj-prometheus-metrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelmay%2Fassertj-prometheus-metrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelmay%2Fassertj-prometheus-metrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelmay%2Fassertj-prometheus-metrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcelmay","download_url":"https://codeload.github.com/marcelmay/assertj-prometheus-metrics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelmay%2Fassertj-prometheus-metrics/sbom","scorecard":{"id":617553,"data":{"date":"2025-08-11","repo":{"name":"github.com/marcelmay/assertj-prometheus-metrics","commit":"f6c1a6c8bf4ab67ac0e59cba2e3e39d447a47aac"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/6 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":3,"reason":"4 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-j288-q9x7-2f5v"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 24 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T04:21:48.161Z","repository_id":57730711,"created_at":"2025-08-21T04:21:48.161Z","updated_at":"2025-08-21T04:21:48.161Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275225867,"owners_count":25427000,"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-09-15T02:00:09.272Z","response_time":75,"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":["assertj","assertj-prometheus","assertj-support","prometheus","prometheus-utility","test-framework","testing"],"created_at":"2025-09-15T07:50:57.545Z","updated_at":"2025-09-15T07:51:01.156Z","avatar_url":"https://github.com/marcelmay.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AssertJ support for Prometheus Metrics\n\n[![Maven Central](https://img.shields.io/maven-central/v/de.m3y.prometheus.assertj/assertj-prometheus.svg?style=flat-square)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22de.m3y.prometheus.assertj%22%20AND%20a%3A%22assertj-prometheus%22) [![javadoc](https://javadoc.io/badge2/de.m3y.prometheus.assertj/assertj-prometheus/javadoc.svg)](https://javadoc.io/doc/de.m3y.prometheus.assertj/assertj-prometheus)\n\nThis library provides AssertJ support for [Prometheus Java Client](https://github.com/prometheus/client_java) metrics,\nwhich simplifies testing your own (Java) exporters or own (Java) application natively exposing metrics.\n\n## Download\nAvailable on [Maven Central](https://repo1.maven.org/maven2/de/m3y/prometheus/assertj/assertj-prometheus/)\n(GAV: de.m3y.prometheus.assertj:assertj-prometheus:VERSION):\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ede.m3y.prometheus.assertj\u003c/groupId\u003e\n    \u003cartifactId\u003eassertj-prometheus\u003c/artifactId\u003e\n    \u003cversion\u003eVERSION\u003c/version\u003e\n    \u003cscope\u003etest\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\n## Examples\n\nA basic example for [VersionInfoExports](https://github.com/prometheus/client_java/blob/master/simpleclient_hotspot/src/main/java/io/prometheus/client/hotspot/VersionInfoExports.java):\n```java\nVersionInfoExports versionInfoExports = new VersionInfoExports();\n\n// Verify jvm_info\nMetricFamilySamples mfs = MetricFamilySamplesUtils.getMetricFamilySamples(\n        versionInfoExports.collect(), \"jvm\");\nassertThat(mfs)\n        .hasTypeOfInfo()\n        .hasSampleLabelNames(\"vendor\", \"runtime\", \"version\")\n        .hasSampleValue(\n                labelValues(\n                        System.getProperty(\"java.runtime.name\", \"unknown\"),\n                        System.getProperty(\"java.vm.vendor\", \"unknown\"),\n                        System.getProperty(\"java.runtime.version\", \"unknown\")\n                ));\n```\n\nFor further examples, have a look at the [tests](src/test/java/de/m3y/prometheus/assertj/).\n\n### Helpers\nHelpers for fetching a single MFS:\n```java\nCollector.MetricFamilySamples mfs;\n\n// From default registry CollectorRegistry.defaultRegistry\nmfs = MetricFamilySamplesUtils.getMetricFamilySamples(\"my_metric\");\n\n// From specific registry\nmfs = MetricFamilySamplesUtils.getMetricFamilySamples( CollectorRegistry.defaultRegistry, \"my_metric\");\n\n// From collector aka exporter\nVersionInfoExports versionInfoExports = new VersionInfoExports();\nmfs = MetricFamilySamplesUtils.getMetricFamilySamples(versionInfoExports.collect(), \"jvm\");\n```\n\n### Info\nExample for Info:\n```java\nInfo info = Info.build().name(\"testInfo\").help(\"help\")\n        .labelNames(\"version\", \"vendor\")\n        .create().register();\n...\nCollector.MetricFamilySamples mfs = MetricFamilySamplesUtils.getMetricFamilySamples(\"testInfo\");\nassertThat(mfs)\n        .hasType(INFO)\n        .hasTypeOfInfo()\n        .hasSampleSize(1)\n        .hasSampleValue(\"A\", \"B\"); // Checks if label values exist -\n                                   // typical values are your build info version \n```\n\n### Counter or Gauge\nExample for a Gauge or Counter:\n```java\nCollector.MetricFamilySamples mfs = MetricFamilySamplesUtils.getMetricFamilySamples(\"my_metric\");\nassertThat(mfs)\n        .hasTypeOfGauge() // For a Counter: .hasTypeOfCounter()\n        .hasSampleLabelNames(\"job_type\", \"app_name\", \"status\")\n        .hasSampleValue(\n                labelValues(\"A\", \"B\", \"C\"),\n                10d\n        )\n        .hasSampleValue(\n                labelValues(\"X\", \"Y\", \"Z\"),\n                da -\u003e da.isCloseTo(10.0, withinPercentage(10d)) // AssertJ double asserts with 10% tolerance\n        );\n```\n\n### Summary\nExample for a Summary with sum, count and quantiles:\n```java\nCollector.MetricFamilySamples mfs = MetricFamilySamplesUtils.getMetricFamilySamples(\"my_metric\");\nassertThat(mfs)\n        .hasSampleSize(12)\n        .hasSampleLabelNames(\"label_a\")\n        .hasTypeOfSummary() // Required for following, summary specific asserts\n        .hasSampleCountValue(labelValues(\"value_a\"), 2)\n        .hasSampleSumValue(labelValues(\"value_a\"), 40)\n        .hasSampleValue(0.5 /* Quantile */, 10)\n        .hasSampleValue(0.9 /* Quantile */, 20)\n        ...\n```\n\n### Histogram\nExample for a Histogram with sum, count and buckets:\n```java\nCollector.MetricFamilySamples mfs = MetricFamilySamplesUtils.getMetricFamilySamples(\"my_metric\");\nassertThat(mfs)\n        .hasSampleSize(12)\n        .hasSampleLabelNames(\"label_a\")\n        .hasTypeOfHistogram() // Required for following, histogram specific asserts\n        .hasSampleCountValue(labelValues(\"value_a\"), 2)\n        .hasSampleSumValue(labelValues(\"value_a\"), 40)\n        .hasSampleCountValue(labelValues(\"value_b\"), 2)\n        .hasSampleSumValue(labelValues(\"value_b\"), 40)\n        .hasSampleBucketValue(labelValues(\"value_a\"), 10, 1) // Histogram bucket assertions\n        ...\n        .hasSampleBucketValue(labelValues(\"value_b\"), Double.POSITIVE_INFINITY, 2)\n```\n\n## Building\n```bash\nmvn clean install\n```\n\n## Requirements\n\n* JDK 8+\n\n## License and Copyright\n\nLicensed under [Apache 2.0 License](LICENSE)\n\nCopyright 2018-2024 Marcel May and project contributors.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcelmay%2Fassertj-prometheus-metrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcelmay%2Fassertj-prometheus-metrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcelmay%2Fassertj-prometheus-metrics/lists"}