{"id":48680714,"url":"https://github.com/Swrve/rate-limited-logger","last_synced_at":"2026-04-26T20:00:42.286Z","repository":{"id":25556297,"uuid":"28989413","full_name":"Swrve/rate-limited-logger","owner":"Swrve","description":"an SLF4J-compatible, simple, fluent API for rate-limited logging in Java","archived":false,"fork":false,"pushed_at":"2021-06-07T16:21:57.000Z","size":380,"stargazers_count":52,"open_issues_count":3,"forks_count":7,"subscribers_count":59,"default_branch":"master","last_synced_at":"2026-01-11T11:41:12.180Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/Swrve/rate-limited-logger/blob/master/README.md","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/Swrve.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-08T22:32:26.000Z","updated_at":"2025-05-04T11:49:57.000Z","dependencies_parsed_at":"2022-08-07T11:15:52.635Z","dependency_job_id":null,"html_url":"https://github.com/Swrve/rate-limited-logger","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/Swrve/rate-limited-logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swrve%2Frate-limited-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swrve%2Frate-limited-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swrve%2Frate-limited-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swrve%2Frate-limited-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Swrve","download_url":"https://codeload.github.com/Swrve/rate-limited-logger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swrve%2Frate-limited-logger/sbom","scorecard":{"id":136409,"data":{"date":"2025-08-11","repo":{"name":"github.com/Swrve/rate-limited-logger","commit":"c6415f879ac71234070d5a1659529f4ac32d723f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.7,"checks":[{"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":"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":"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":"Code-Review","score":1,"reason":"Found 3/16 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":"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":"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":5,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'master'","Info: 'force pushes' disabled on branch 'master'","Info: 'branch protection settings apply to administrators' is required to merge on branch 'master'","Warn: 'stale review dismissal' is disabled on branch 'master'","Warn: required approving review count is 1 on branch 'master'","Warn: codeowners review is not required on branch 'master'","Warn: 'last push approval' is disabled on branch 'master'","Warn: no status checks found to merge onto branch 'master'","Info: PRs are required in order to make changes on 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":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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 23 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-16T06:39:56.057Z","repository_id":25556297,"created_at":"2025-08-16T06:39:56.057Z","updated_at":"2025-08-16T06:39:56.057Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32310804,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T19:15:34.056Z","status":"ssl_error","status_checked_at":"2026-04-26T19:15:15.467Z","response_time":129,"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":[],"created_at":"2026-04-11T01:00:36.056Z","updated_at":"2026-04-26T20:00:42.280Z","avatar_url":"https://github.com/Swrve.png","language":"Java","funding_links":[],"categories":["容错组件"],"sub_categories":["Spring Cloud框架"],"readme":"RateLimitedLogger [![CircleCI badge](https://circleci.com/gh/Swrve/rate-limited-logger.svg?style=svg\u0026circle-token=a2d7a24d30021fc04658b58c24c1758e891e66fc)](https://circleci.com/gh/Swrve/rate-limited-logger)\n========\n\nAn SLF4J-compatible, simple, fluent API for rate-limited logging in Java.\n\nLogging is vital for production-ready, operable code; however, in certain\nsituations, it can be dangerous.  It is easy to wipe out throughput of a\nperformance-critical backend component by several orders of magnitude with disk\nI/O in a performance hotspot, caused by a misplaced log call, or input data\nchanging to something slightly unexpected.\n\nWith RateLimitedLogger, however, this risk is avoided.  A RateLimitedLog object\ntracks the rate of log message emission, imposes an internal rate limit, and\nwill efficiently suppress logging if this is exceeded.  When a log is\nsuppressed, at the end of the limit period, another log message is output\nindicating how many log lines were suppressed.\n\nThis style of rate limiting is the same as the one used by UNIX syslog; this\nmeans it should be comprehensible, easy to predict, and familiar to many users,\nunlike more complex adaptive rate limits.\n\nRateLimitedLogger wraps your existing SLF4J loggers, so should be easy to plug\ninto existing Java code.\n\n\n## Binaries:\n\nThis module is available in the Maven Central repository at\nhttp://search.maven.org/#search%7Cga%7C1%7Ca%3A%22rate-limited-logger%22\n\nWARNING: version 2.0.0 drops support for Java 6 and 7, and is Java 8-only. It\nalso requires (minor) code changes to use the java.time classes instead of\nJoda-Time.  If you still need support for Java 6 or 7, use version 1.1.0 or\nearlier.\n\nMaven:\n\n```\n  \u003cdependency\u003e\n      \u003cgroupId\u003ecom.swrve\u003c/groupId\u003e\n      \u003cartifactId\u003erate-limited-logger\u003c/artifactId\u003e\n      \u003cversion\u003e2.0.2\u003c/version\u003e\n  \u003c/dependency\u003e\n```\n\nGradle:\n\n```\n  compile group: 'com.swrve', name: 'rate-limited-logger', version: '2.0.2'\n```\n\nSample code:\n\n```\n  private static final Logger logger = LoggerFactory.getLogger(getClass());\n\n  private static final RateLimitedLog rateLimitedLog = RateLimitedLog\n            .withRateLimit(logger)\n            .maxRate(5).every(Duration.ofSeconds(10))\n            .build();\n```\n\nThis will wrap an existing SLF4J Logger object, allowing a max of 5 messages\nto be output every 10 seconds, suppressing any more than that.\n\n\n## More documentation\n\nJavadoc can be found at http://swrve.github.io/rate-limited-logger/javadoc/2.0.2/\n\n\n## Sample output\n\n```\n  22:16:03.584 [main] INFO Demo - message 1\n  22:16:03.604 [main] INFO Demo - message 2\n  22:16:03.634 [main] INFO Demo - message 3\n  22:16:04.986 [RateLimitedLogRegistry-0] INFO Demo - (suppressed 39 logs similar to 'message {}' in PT1.0S)\n```\n\n## Interpolation\n\nEach log message has its own internal rate-limiting AtomicLong counter.  In\nother words, if you have 2 log messages, you can safely reuse the same\nRateLimitedLog object to log both, and a high rate of one will not cause the\nother to be suppressed as a side effect.\n\nHowever, this means that if you wish to include dynamic, variable data in the\nlog output, you will need to use SLF4J-style templates, instead of (\"foo \" +\nbar + \" baz\") string interpolation. For example:\n\n```\n  rateLimitedLog.info(\"Just saw an event of type {}: {}\", event.getType(), event);\n```\n\n\"{}\" will implicitly invoke an object's toString() method, so toString() does\nnot need to be called explicitly when logging.  (This has obvious performance\nbenefits, in that those toString() methods will not be called at all once the\nrate limits have been exceeded or if the log-level threshold isn't reached.)\n\nA RateLimitedLog object has a limited capacity for the number of log messages\nit'll hold; if over 1000 different strings are used as the message template for\na single RateLimitedLog object, it is assumed that the caller is accidentally\nusing an already-interpolated string containing variable data in place of the\ntemplate, and the current set of logs will be flushed in order to avoid an\nOutOfMemory condition.  This has a performance impact, but at least it won't\nlose data!\n\n\n## Performance\n\nIn tests using JMH with Java 7 on a 2012 Macbook Pro, using RateLimitedLog with\nlogger.info(\"string\") ran in, on average, 73 nanoseconds per op, with a P99.99\nof 2000 ns/op and a P99.999 of 12000 ns/op, once the rate limit was exceeded.\n\nWhere performance is critical, note that you can obtain a reference to the\nLogWithPatternAndLevel object for an individual log template and level, which will\nthen avoid a ConcurrentHashMap and AtomicReferenceArray lookup:\n\n```\n  ref = logger.get(\"string\", Level.INFO)\n  ref.log()\n```\n\nUsing this approach, the average post-ratelimit time dropped to 56 nanoseconds\nper op, with a P99.99 of 1000 ns/op and a P99.999 of 8992 ns/op.\n\nMore details: https://github.com/Swrve/rate-limited-logger/tree/master/jmh-tests\n\n\n## Thread-Safety\n\nThe RateLimitedLogger library is thread-safe.  Under heavy load, though, it is\npossible for more log messages to be exceeded than the limit specifies, for a\nshort period after the limit is exceeded (typically on the order of a duration\nof a few milliseconds).\n\n\n## Dependencies\n\nAll versions are minimum versions -- later versions should also work fine.\n\n- Java 8\n- SLF4J API 1.7.7\n- Findbugs Annotations 1.0.0\n- Findbugs JSR-305 Annotations 2.0.2\n\nversion 1.1.0 of RateLimitedLogger supports Java 7, but requires Guava 15.0 and\nJoda-Time 2.3 in addition to the above.\n\n\n## License\n\n(c) Copyright 2014-2018 Swrve Mobile Inc or its licensors.\nDistributed under version 2.0 of the Apache License, see \"LICENSE\".\n\n\n## Building\n\nBuild all JARs, test, measure coverage:\n\n```\n  ./gradlew all\n```\n\n\n## Credits\n\n- The Swrve team: http://www.swrve.com/\n    - Our dev blog: http://swrveengineering.wordpress.com/\n\n- Fabien Comte \u003ccomtef at gmail.com\u003e, for Java 8 support\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSwrve%2Frate-limited-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSwrve%2Frate-limited-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSwrve%2Frate-limited-logger/lists"}