{"id":37016529,"url":"https://github.com/adobe/metrics-client-for-java","last_synced_at":"2026-01-14T01:52:18.928Z","repository":{"id":57716534,"uuid":"123960848","full_name":"adobe/metrics-client-for-java","owner":"adobe","description":" An application metrics client for Java integrated with Graphite/OpenTSDB","archived":false,"fork":false,"pushed_at":"2024-04-08T12:49:13.000Z","size":175,"stargazers_count":8,"open_issues_count":2,"forks_count":10,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-15T03:27:00.557Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/adobe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-05T18:27:55.000Z","updated_at":"2022-03-05T15:48:41.000Z","dependencies_parsed_at":"2022-08-26T13:11:55.678Z","dependency_job_id":null,"html_url":"https://github.com/adobe/metrics-client-for-java","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/adobe/metrics-client-for-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adobe%2Fmetrics-client-for-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adobe%2Fmetrics-client-for-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adobe%2Fmetrics-client-for-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adobe%2Fmetrics-client-for-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adobe","download_url":"https://codeload.github.com/adobe/metrics-client-for-java/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adobe%2Fmetrics-client-for-java/sbom","scorecard":{"id":167292,"data":{"date":"2025-08-11","repo":{"name":"github.com/adobe/metrics-client-for-java","commit":"b88b3599cecb22bac3ca34a557908a43fb6e595f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.9,"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":"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":"Code-Review","score":1,"reason":"Found 1/9 approved changesets -- score normalized to 1","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":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":"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":"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":"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 '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":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: github.com/adobe/.github/.github/SECURITY.md:1","Info: Found linked content: github.com/adobe/.github/.github/SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/adobe/.github/.github/SECURITY.md:1","Info: Found text in security policy: github.com/adobe/.github/.github/SECURITY.md:1"],"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 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-16T15:15:53.872Z","repository_id":57716534,"created_at":"2025-08-16T15:15:53.872Z","updated_at":"2025-08-16T15:15:53.872Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408692,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T00:40:43.272Z","status":"ssl_error","status_checked_at":"2026-01-14T00:40:42.636Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":[],"created_at":"2026-01-14T01:52:18.408Z","updated_at":"2026-01-14T01:52:18.923Z","avatar_url":"https://github.com/adobe.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Metrics Library for Java\n\n[![Build Status](https://travis-ci.org/adobe/metrics-client-for-java.svg?branch=master)](https://travis-ci.org/adobe/metrics-client-for-java)\n\nAn application metrics client integrated with Graphite/OpenTSDB/more to come.\nOffers the following features:\n- sends the metrics in batch to the backend\n- fail safe (retry + circuit breaker to not overwhelm the backend)\n- send to multiple backends in parallel \n    - useful for migrating to one backend to another\n    - useful for sending a set of metrics to one backend (e.g. a sub-set of importants metrics used for alerts in Prometheus) and another set to another backend (e.g. all metrics to OpenTSDB).\n\n# Usage\n\n## Maven\n```xml\n\u003c!-- https://mvnrepository.com/artifact/com.adobe.aam/metrics-all --\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.adobe.aam\u003c/groupId\u003e\n    \u003cartifactId\u003emetrics-all\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.2\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Gradle\n```\n// https://mvnrepository.com/artifact/com.adobe.aam/metrics-all\ncompile group: 'com.adobe.aam', name: 'metrics-all', version: '1.0.2'\n```\n\n# Sample application\n\nYou can find a demo app in this project: [Sample Application](https://github.com/adobe/metrics-client-for-java/tree/master/metrics-sample)\n\n# Java docs\n\nYou can find here the [Java docs](http://javadoc.io/doc/com.adobe.aam/metrics-core)\n\n# Architecture\n\n![EC2 Shredder diagram](https://user-images.githubusercontent.com/952836/36027791-5fb02010-0da5-11e8-88d7-61fc9bce60f2.png)\n\n# Sample App: How to use the metrics library\n\nSee [metrics-sample](https://github.com/adobe/metrics-client-for-java/tree/master/metrics-sample) app, for a fully fledged demo.\n\n# Create a metric\n\nThere are several metric types available: CounterMetric, AverageMetric, MaxMetric, MinMetric etc.\n\n### Average Metric\n```\n// Create a metric that generates the average of the values.\nMetric metric = Metric.newInstance(\"request.time\", Metric.Type.AVG);\n\nmetric.track(10);\nmetric.track(20);\n\nmetric.get(); // returns (10 + 20) / 2 = 15\n```\n\n### Counter\n```\nCounterMetric metric = new CounterMetric(\"event.pixel\");\n\nmetric.increment(); // New value is 1\nmetric.increment(); // New value is 2\nmetric.add(10); // New value is 12\n\nmetric.get(); // returns 12\n```\n\n# Send a metric to a backend (e.g. Graphite / OpenTSDB)\n\n### How the metric client manages to publish metrics to the backend\nBy default, the client is able to send metrics to Backend using a retry mechanism guarded by a circuit\nbreaker mechanism. The former ensures metrics are being resent should the initial request fail,\nproviding a way of not losing important metrics. On the other hand, the circuit breaker mechanism\nmakes the client silently aware of a non-responsive Backend backend by discarding all incoming metrics\nuntil the service is up and running again. \n\nNevertheless, one can always switch to a client w/o retry and/or w/o circuit breaker mechanisms depending\non the environment needs. For instance, for a testing environment that does not highly rely on metrics,\nthe metric client can be used without retry and circuit breaker mechanisms.\n\nHowever, there is a great benefit brought by the enablement of both mechanism (via config) - safely\nand effectively (using retry) sending metrics while not polluting with metrics the memory of the\nmetric client when the Backend is non-responsive. The downside of enabling the circuit\nbreaker is the potential impact on aggregated metrics -  each client node might enter into an\nopen circuit at a different time, hence the metrics are prone to inconsistency\n\nReferences:\n- [Circuit Breaker]\n- [Failsafe Library]\n \n[Circuit Breaker]: https://martinfowler.com/bliki/CircuitBreaker.html\n[Failsafe Library]: https://github.com/jhalterman/failsafe\n\n### Create a metric client\n\nThe MetricClientFactory contains a series of methods to create a metric client. It can use either configuration file(s), a Properties object, a typesafe config etc.\n\n```hocon\nmonitor {\n    collectFrequency : 60000ms\n\n    tags {\n        env : prod\n        app_name: mywebapp\n        region: us-east-1\n        cluster: edge1\n        useHostname: true\n    }\n\n    publishers: [ \n        {\n            name: Graphite Primary\n            type: graphite\n            host: graphiterelay.com\n            port: 2003\n            batch_size: 500\n            sendOnlyRecentlyUpdatedMetrics: true\n            resetCounters: true\n            filter.allowList : [\n              // Only these metrics will be sent through this client.\n              \"*\"\n            ]\n        },\n        {\n          name: Prometheus\n          type: prometheus\n          sendOnlyRecentlyUpdatedMetrics: false\n          resetCounters: false\n          filter.allowList : [\n            // Only these metrics will be exposed through this client.\n            \"*\"\n          ]\n          relabel: {\n            // Relabel example. Useful for 3rd party metrics such as those coming from Codahale.\n            // myapp.db.table1.requests -\u003e myapp_db_requests{db_table=\"table1\"}\n            \"db\\\\.([^.]+).*\": [\n              {\n                \"db_table\": \"$1\"\n              }\n            ]\n          }\n        }\n    ]\n}\n```\n\n\n\n```java\n// Create metric client.\nMetricClient metricClient = new MetricClientFactory()\n      .create(config.get(\"monitor.publishers\"));\n```\n\n### Send metrics\n\n```java\nlong timeNow = System.currentTimeMillis() / 1000;\nmetricClient.sendAndReset(metric, timeNow);\nmetricClient.flush();\n```\n\n\n# Using a metric agent to monitor your metrics\nThe metric agent monitors a list of metrics. Every 60 seconds (or other configurable frequency), it sends the current metric values to the specified metric client and resets them to zero.\n\n```java\nList\u003cMetric\u003e metrics = new ArrayList\u003c\u003e();\n// Add metrics to the list\n...\n\nMetricAgentConfig config = ImmutableMetricAgentConfig.builder()\n                .collectFrequency(config.getDuration(\"monitor.collectFrequency\"))\n                .addMetrics(metrics)\n                .tags(MetricAgentConfig.tagsFromConfig(config.getConfig(\"monitor.tags\")))\n                .build();\n\nMetricAgent metricAgent = new MetricAgent(metricClient, config);\n\nmetricAgent.startAsync();\n\n...\n\nmetricAgent.stopAsync();\n```\n\n# Codahale integration\n\nThis metrics library is integrated with codahale. You can add one or more codahale `MetricRegistry` to the metric agent and they will be reported to the backend.\nAdvantages for doing this:\n- sends the metrics in batch to the backend\n- fail safe (retry + circuit breaker)\n- resets the metrics once sent to the backend (useful for Codahale Counters due to https://github.com/dropwizard/metrics/issues/143)\n- send to multiple backends in parallel\n\n\n# Build\n\nTo build this project:\n\n```\n$ git clone git@github.com:adobe/metrics-client-for-java.git\n$ cd metrics-client-for-java/\n$ ./gradlew build\n```\n\n# Bugs and Feedback\n\nFor bugs, questions and discussions please use the [GitHub Issues](https://github.com/adobe/metrics-client-for-java/issues).\n\n# LICENSE\n\nCopyright 2018 Adobe Systems Incorporated\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadobe%2Fmetrics-client-for-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadobe%2Fmetrics-client-for-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadobe%2Fmetrics-client-for-java/lists"}