{"id":36427069,"url":"https://github.com/peetzen/dropwizard-metrics-prometheus-servlet-bundle","last_synced_at":"2026-01-11T18:01:23.957Z","repository":{"id":50099022,"uuid":"237838187","full_name":"peetzen/dropwizard-metrics-prometheus-servlet-bundle","owner":"peetzen","description":"Configurable Prometheus Servlet Bundle for Dropwizard","archived":false,"fork":false,"pushed_at":"2023-07-31T10:51:26.000Z","size":156,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2023-10-20T22:18:09.517Z","etag":null,"topics":["dropwizard","dropwizard-bundle","dropwizard-metrics","java","prometheus","prometheus-client-library","prometheus-exporter"],"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/peetzen.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":"2020-02-02T21:17:31.000Z","updated_at":"2023-10-20T22:18:11.703Z","dependencies_parsed_at":"2022-09-26T22:01:37.388Z","dependency_job_id":"8cc5ffbe-b77b-4308-9204-32c9be0b52e7","html_url":"https://github.com/peetzen/dropwizard-metrics-prometheus-servlet-bundle","commit_stats":null,"previous_names":[],"tags_count":10,"template":null,"template_full_name":null,"purl":"pkg:github/peetzen/dropwizard-metrics-prometheus-servlet-bundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peetzen%2Fdropwizard-metrics-prometheus-servlet-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peetzen%2Fdropwizard-metrics-prometheus-servlet-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peetzen%2Fdropwizard-metrics-prometheus-servlet-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peetzen%2Fdropwizard-metrics-prometheus-servlet-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peetzen","download_url":"https://codeload.github.com/peetzen/dropwizard-metrics-prometheus-servlet-bundle/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peetzen%2Fdropwizard-metrics-prometheus-servlet-bundle/sbom","scorecard":{"id":726539,"data":{"date":"2025-08-11","repo":{"name":"github.com/peetzen/dropwizard-metrics-prometheus-servlet-bundle","commit":"6f58fedf95cc439e17aa112c09f21dd7481ead29"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.9,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/23 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":"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":"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":"Binary-Artifacts","score":9,"reason":"binaries present in source code","details":["Warn: binary detected: gradle/wrapper/gradle-wrapper.jar:1"],"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":"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":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"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 'main'"],"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"}}]},"last_synced_at":"2025-08-22T12:58:59.514Z","repository_id":50099022,"created_at":"2025-08-22T12:58:59.514Z","updated_at":"2025-08-22T12:58:59.514Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28316964,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T14:58:17.114Z","status":"ssl_error","status_checked_at":"2026-01-11T14:55:53.580Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["dropwizard","dropwizard-bundle","dropwizard-metrics","java","prometheus","prometheus-client-library","prometheus-exporter"],"created_at":"2026-01-11T18:01:08.996Z","updated_at":"2026-01-11T18:01:23.901Z","avatar_url":"https://github.com/peetzen.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Configurable Prometheus Servlet Bundle for Dropwizard\n\n[![CircleCI](https://img.shields.io/circleci/build/gh/peetzen/dropwizard-metrics-prometheus-servlet-bundle)](https://circleci.com/gh/peetzen/dropwizard-metrics-prometheus-servlet-bundle)\n[![Maven Central](https://img.shields.io/maven-central/v/de.peetzen.dropwizard/dropwizard-metrics-prometheus-servlet-bundle)](https://search.maven.org/artifact/de.peetzen.dropwizard/dropwizard-metrics-prometheus-servlet-bundle)\n[![License](https://img.shields.io/github/license/peetzen/dropwizard-metrics-prometheus-servlet-bundle)](http://www.apache.org/licenses/LICENSE-2.0.html)\n\n[![Dropwizard](https://img.shields.io/badge/dropwizard-v1.x-green)](https://github.com/dropwizard/dropwizard)\n[![Dropwizard](https://img.shields.io/badge/dropwizard-v1.3.x-green)](https://github.com/dropwizard/dropwizard)\n[![Dropwizard](https://img.shields.io/badge/dropwizard-v2.x-green)](https://github.com/dropwizard/dropwizard)\n[![Dropwizard](https://img.shields.io/badge/dropwizard-v3.x-green)](https://github.com/dropwizard/dropwizard)\n[![Dropwizard](https://img.shields.io/badge/dropwizard-v4.x-green)](https://github.com/dropwizard/dropwizard)\n\nAdds support for exposing Dropwizard metrics as Prometheus compatible metrics through a dedicated servlet.\n\nUsing your Dropwizard applications configuration file it is easy to customize metrics and map metric names to a more user-friendly version including support for labels.\n\n## Documentation\n\nThis bundle exposes metrics from a Dropwizard application in a Prometheus compatible format. Through the applications configuration file the name of the exposed metrics can be modified and labels can be added for each metric independently.\n\nInternally the official [Prometheus JVM Client](https://github.com/prometheus/client_java) implementation is being used to map the Dropwizard metrics as well as to expose the metrics through a dedicated servlet accessible via the admin connector\nusing context path `/prometheusMetrics`.\n\nInformation regarding the sanitizing of dropwizard metric names can be found at the [Prometheus DropwizardExports Collector](https://github.com/prometheus/client_java#dropwizardexports-collector) section.\n\nGeneral information regarding the [Prometheus Data Model](https://prometheus.io/docs/concepts/data_model/).\n\n## Getting started\n\nThe artifacts including source and binaries are available on the central Maven repositories.\n\nFor maven:\n\n```xml\n\n\u003cdependency\u003e\n    \u003cgroupId\u003ede.peetzen.dropwizard\u003c/groupId\u003e\n    \u003cartifactId\u003edropwizard-metrics-prometheus-servlet-bundle\u003c/artifactId\u003e\n    \u003cversion\u003e4.0.2\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nFor gradle:\n\n```yaml\nimplementation group: 'de.peetzen.dropwizard', name: 'dropwizard-metrics-prometheus-servlet-bundle', version: '4.0.2'\n```\n\n### Dropwizard compatibility\n\nDue to breaking changes between Dropwizard versions different versions of this library are provided:\n\n| Dropwizard Version | Library Version | Comment                        |\n|--------------------|-----------------|--------------------------------|\n| `v4.x`             | `4.0.2`         | For latest Dropwizard version. |\n| `v3.x`             | `3.0.2`         |                                |\n| `v1.x` \u0026 `v2.x`    | `1.0.0`         |                                |\n\n### Bundle loading\n\nYour main configuration class needs to implement the _PrometheusMetricsServletBundle_ interface:\n\n```java\npublic class MyConfiguration extends Configuration implements PrometheusMetricsServletBundleConfiguration {\n\n    // the interface defines a default implementation for getPrometheusMetricsServletConfiguration()\n}\n```\n\nAdd the _PrometheusMetricsServletBundle_ bundle to your application:\n\n```java\npublic class MyApplication extends Application\u003cMyConfiguration\u003e {\n\n    @Override\n    public void initialize(Bootstrap\u003cMyConfiguration\u003e bootstrap) {\n        // Add bundle to serv metrics in prometheus compatible format at /prometheusMetrics\n        bootstrap.addBundle(new PrometheusMetricsServletBundle());\n\n        super.initialize(bootstrap);\n    }\n\n    @Override\n    public void run(MyConfiguration configuration, Environment environment) {\n        // your existing logic\n    }\n}\n```\n\n### Configuration\n\nIn order to expose all metrics from the Dropwizard default metric registry with the default sample mapping under `/prometheusMetrics`, it is enough to include the bundle in your classpath and adjust your application code as shown above.\nOptional code and configuration changes allow you to control the behaviour.\n\n#### Built-in configuration options\n\nTo change the default behaviour, the suggested approach is through the Dropwizard application configuration file.\nYou can add a section to your Dropwizard applications configuration file with the following control options:\n\n```yaml\nprometheusMetrics:\n  path: /prometheusMetrics\n  sampleBuilder:\n    type: default\n    extractDynamicLabels: true\n  excludes: (none)\n  includes: (all)\n  useRegexFilters: false\n  useSubstringMatching: false\n```\n\nThe root key _prometheusMetrics_ depends on the _JsonProperty_ name in your application _Configuration_ implementation and can be changed.\n\nTo allow loading the values from the configuration file the main `Configuration` class needs to extend the _PrometheusMetricsServletBundle_ interface and the _getPrometheusMetricsServletConfiguration()_\nmust be overridden in a way that the actual configuration is loaded from the application configuration file:\n\n```java\npublic class MyConfiguration extends Configuration implements PrometheusMetricsServletBundleConfiguration {\n\n    @Valid\n    @NotNull\n    @JsonProperty\n    private PrometheusMetricsServletConfiguration prometheusMetrics;\n\n    @Override\n    public PrometheusMetricsServletConfiguration getPrometheusMetricsServletConfiguration() {\n        return prometheusMetrics;\n    }\n}\n```\n\n### Configuration Options\n\nThe following general options are available. The sample builder specific options are documented further below.\n\n| Name                               | Default            | Description                                                                                                                   |\n|------------------------------------|--------------------|-------------------------------------------------------------------------------------------------------------------------------|\n| path                               | /prometheusMetrics | Web context used to expose the metrics in the Prometheus format.                                                              |\n| sampleBuilder.type                 | default            | The sample builder type. Provided are `default`, `simple-mapping`, `custom-mapping`. Extendable with your own implementation. |\n| sampleBuilder.extractDynamicLabels | true               | Controls if labels should be extracted from the metric name. Available for all built-in types.                                |\n| excludes                           | (none)             | Metrics to exclude by name. When defined, matching metrics will not show up.                                                  |\n| includes                           | (all)              | Metrics to include by name. When defined, only these metrics will be reported.                                                |\n| useRegexFilters                    | false              | Indicates whether the values of the 'includes' and 'excludes' fields should be treated as regular expressions or not.         |\n| useSubstringMatching               | false              | Uses a substring matching strategy to determine whether a metric should be processed.                                         |\n\nThe inclusion and exclusion rules are defined as:\n\n* If **includes** is empty, then all metrics are included;\n* If **includes** is not empty, only metrics from this list are included;\n* If **excludes** is empty, no metrics are excluded;\n* If **excludes** is not empty, then exclusion rules take precedence over inclusion rules. Thus, if a name matches the exclusion rules it will not be included in reports even if it also matches the inclusion rules.\n\nWhen neither **useRegexFilters** nor **useSubstringMatching** are enabled, a default exact matching strategy will be used to determine whether a metric should be processed.\nIn case both **useRegexFilters** and **useSubstringMatching** are set, **useRegexFilters** takes precedence over **useSubstringMatching**.\n\n#### Dynamic Label Sample Builders\n\nBy default, dynamic labels are being extracted from the dropwizard metric name. Labels can be encoded in the metric name as _my.metric.something\\[label1:value1,label2:value2]_ and are automatically parsed and added to the mapped prometheus metric.\nThe prometheus metric name becomes _my.metric.something_.\n\nThe extraction of dynamic labels can be disabled through the configuration option `sampleBuilder.extractDynamicLabels` for all built-in implementations.\n\n#### Default Sample Builder\n\nMaps Dropwizard metric names to Prometheus names using standard rules.\n\n```yaml\nprometheusMetrics:\n  sampleBuilder:\n    type: default\n    extractDynamicLabels: true\n```\n\n| Name                 | Default  | Description                                                  |\n|----------------------|----------|--------------------------------------------------------------|\n| type                 | REQUIRED | The sample builder type. Must be `console`                   |\n| extractDynamicLabels | true     | Controls if labels should be extracted from the metric name. |\n\n#### Simple Mapping Sample Builder\n\nReplaces Dropwizard metric names, if they start with a specified string.\n\n```yaml\nprometheusMetrics:\n  sampleBuilder:\n    type: simple-mapping\n    extractDynamicLabels: true\n    mappings:\n      some.metric.one: new.name1\n      some.metric.two: new.name2\n```\n\n| Name                 | Default  | Description                                                                                                     |\n|----------------------|----------|-----------------------------------------------------------------------------------------------------------------|\n| type                 | REQUIRED | The sample builder type. Must be `simple-mapping`                                                               | \n| extractDynamicLabels | true     | Controls if labels should be extracted from the metric name.                                                    |\n| mappings             | REQUIRED | Explicit mappings defined as _key: value_ pairs. The matched part `key` is replaced using the provided `value`. |\n\n#### Advanced Mapping Sample Builder\n\nReplaces Dropwizard metric names, if they match a specified pattern.\n\nSupports * as a wildcard character to match, and keywords $0, $1, .. to reference the matched value.\nThe references can be used within the mapped metric name as well as to add dynamic label values.\n\n```yaml\nprometheusMetrics:\n  sampleBuilder:\n    type: custom-mapping\n    extractDynamicLabels: true\n    mappings:\n      some.metric.*: new.name.$0\n      other.metric.*:\n        name: new.name.$0\n        labels:\n          - my_label:some_value\n          - second_label:other_value\n      my.metric.*.*:\n        name: new.name.$1\n        labels:\n          - my_label:$0\n```\n\nMappings can be defined in two formats, a _key: value_ syntax to define the _pattern_ and the _name_ value that should be used instead.\nThe other option is to provide an object with a _name_ attribute and an optional list of labels, each label expressed as a single string using the format _label:value_.\n\n| Name                 | Default  | Description                                                                                                      |\n|----------------------|----------|------------------------------------------------------------------------------------------------------------------|\n| type                 | REQUIRED | The sample builder type. Must be `custom-mapping`                                                                |\n| extractDynamicLabels | true     | Controls if labels should be extracted from the metric name.                                                     |\n| mappings             | REQUIRED | Mapping configurations (both forms are acceptable).                                                              |\n| mappings[].name      | REQUIRED | The name value that should be used instead of the matched pattern. Only required if the object notation is used. |\n| mappings[].labels    | (none)   | List of labels to add to the exposed Prometheus metric.                                                          |\n\n## Template for Dropwizard's built-in metrics\n\nDropwizard comes with several instrumented classes by default and those metrics can easily be mapped to a more user-friendly format.\n\nHere is a template for some of the core metrics:\n\n```yaml\nprometheusMetrics:\n  sampleBuilder:\n    type: custom-mapping\n    mappings:\n      # Dropwizard default instrumented classes\n      io.dropwizard.jetty.MutableServletContextHandler.*-requests:\n        name: servlet.requests\n        labels:\n          - method:$0\n      io.dropwizard.jetty.MutableServletContextHandler.*-responses:\n        name: servlet.responses\n        labels:\n          - code:$0\n      io.dropwizard.jetty.MutableServletContextHandler.percent-*-*:\n        name: servlet.responses.percent\n        labels:\n          - code:$0\n          - timeframe:$1\n      io.dropwizard.jetty.MutableServletContextHandler.*-*: servlet.$1.$0\n      io.dropwizard.jetty.MutableServletContextHandler.*: servlet.$0\n      ch.qos.logback.core.Appender.*:\n        name: logger\n        labels:\n          - level:$0\n      org.apache.http.client.HttpClient.*.*-requests:\n        name: client.http.requests\n        labels:\n          - name:$0\n          - method:$1\n      org.apache.http.conn.HttpClientConnectionManager.*.*-connections:\n        name: client.http.connections.$1\n        labels:\n          - name:$0\n      org.eclipse.jetty.server.HttpConnectionFactory.*.connections:\n        name: server.connections\n        labels:\n          - port:$0\n      org.eclipse.jetty.util.thread.QueuedThreadPool.*.*:\n        name: server.threadpools.$1\n        labels:\n          - name:$0\n```\n\n## Metric filtering\n\nThe exposed metrics can be limited through the configuration options stated above. The metric name matching happens on the unmapped Dropwizard metrics names.\nIf more flexibility is required, the `PrometheusMetricsServletConfiguration#getDefaultFilter()` method can be overridden as needed.\n\nIn some scenarios you might want to use the exact same filter for the standard [Dropwizard Metric Servlet](https://metrics.dropwizard.io/4.2.0/manual/servlets.html) and this _Prometheus Metric Bundle_.\nTo support this, the same Servlet Context configuration approach exists. An instance of `MetricFilter` can be provided via the servlet context using the name `de.peetzen.dropwizard.metrics.prometheus.PrometheusMetricsServletBundle.metricFilter`.\nIf preferred, you can subclass `PrometheusMetricsServletBundle.ContextListener`, which will add a specific `MetricFilter` to the servlet context.\n\n```java\npublic class MyApplication extends Application\u003cMyConfiguration\u003e {\n\n    @Override\n    public void initialize(Bootstrap\u003cMyConfiguration\u003e bootstrap) {\n        // add bundle\n    }\n\n    @Override\n    public void run(MyConfiguration configuration, Environment environment) {\n        // programmatically set servlet context attributes\n        var filter = MetricFilter.startsWith(\"org\");\n        environment.getAdminContext().setAttribute(MetricsServlet.METRIC_FILTER, filter);\n        environment.getAdminContext().setAttribute(PrometheusMetricsServletBundle.METRIC_FILTER, filter);\n    }\n}\n```\n\nFurthermore, the internally used Prometheus `Exporter` supports basic filtering.\nThe filter can be configured through the MetricServlet's initialization parameters. See implementation of the `io.prometheus.client.servlet.common.exporter.Exporter` class for details.\nThe filtering is done on the mapped metric names.\n\n```java\npublic class MyApplication extends Application\u003cMyConfiguration\u003e {\n\n    @Override\n    public void initialize(Bootstrap\u003cMyConfiguration\u003e bootstrap) {\n        // add bundle\n    }\n\n    @Override\n    public void run(MyConfiguration configuration, Environment environment) {\n        // programmatically set init parameters of the internally used metric servlet\n        environment.getAdminContext().getServletHandler()\n            .getServlet(PrometheusMetricsServletBundle.DEFAULT_SERVLET_NAME)\n            .setInitParameter(\"name-must-be-equal-to\", \"org_eclipse_jetty_util_thread_QueuedThreadPool_dw_admin_jobs\");\n    }\n}\n```\n\n## Extension Support\n\nThe supported functionality is not enough, you want a more customized mapping solution or a different configuration structure?\n\nDo not hesitate to extend _PrometheusSampleBuilderFactory_ and provide your own custom implementation.\n\n## Development notes\n\n- The configuration options for metric filtering and the implementation are based on the [Dropwizard Metrics Reporters](https://www.dropwizard.io/en/latest/manual/configuration.html#all-reporters).\n- The used `io.prometheus.client.dropwizard.DropwizardExports` implementation does not support filtering of metric attributes.\n- Due to an [open issue](https://github.com/prometheus/client_java/issues/518) with the Prometheus Client a few classes have been copied over and altered to allow more flexible match patterns.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeetzen%2Fdropwizard-metrics-prometheus-servlet-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeetzen%2Fdropwizard-metrics-prometheus-servlet-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeetzen%2Fdropwizard-metrics-prometheus-servlet-bundle/lists"}