{"id":33178958,"url":"https://github.com/Netflix/spectator","last_synced_at":"2025-11-20T21:03:03.226Z","repository":{"id":18780085,"uuid":"21993347","full_name":"Netflix/spectator","owner":"Netflix","description":"Client library for collecting metrics.","archived":false,"fork":false,"pushed_at":"2025-10-14T15:41:53.000Z","size":17393,"stargazers_count":760,"open_issues_count":11,"forks_count":177,"subscribers_count":439,"default_branch":"main","last_synced_at":"2025-11-09T06:03:52.396Z","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/Netflix.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2014-07-18T20:22:53.000Z","updated_at":"2025-11-01T21:48:49.000Z","dependencies_parsed_at":"2023-10-04T21:28:25.454Z","dependency_job_id":"205a571c-32a4-442f-ac90-73f80a58e29c","html_url":"https://github.com/Netflix/spectator","commit_stats":null,"previous_names":[],"tags_count":251,"template":false,"template_full_name":null,"purl":"pkg:github/Netflix/spectator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix%2Fspectator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix%2Fspectator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix%2Fspectator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix%2Fspectator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Netflix","download_url":"https://codeload.github.com/Netflix/spectator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Netflix%2Fspectator/sbom","scorecard":{"id":100353,"data":{"date":"2025-08-11","repo":{"name":"github.com/Netflix/spectator","commit":"e44ed4fcab598dcd953428f25a870e1ad474f0c7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.5,"checks":[{"name":"Maintained","score":10,"reason":"29 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10","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":10,"reason":"no dangerous workflow patterns detected","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":"Code-Review","score":2,"reason":"Found 3/11 approved changesets -- score normalized to 2","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":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/pr.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1","Warn: no topLevel permission defined: .github/workflows/snapshot.yml:1","Info: no jobLevel write permissions found"],"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":"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/Netflix/spectator/pr.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/pr.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/Netflix/spectator/pr.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/Netflix/spectator/pr.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/Netflix/spectator/pr.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/Netflix/spectator/pr.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/Netflix/spectator/pr.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/Netflix/spectator/release.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/Netflix/spectator/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/Netflix/spectator/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/Netflix/spectator/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/Netflix/spectator/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/Netflix/spectator/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/snapshot.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/Netflix/spectator/snapshot.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/snapshot.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/Netflix/spectator/snapshot.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/snapshot.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/Netflix/spectator/snapshot.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/snapshot.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/Netflix/spectator/snapshot.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/snapshot.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/Netflix/spectator/snapshot.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/snapshot.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/Netflix/spectator/snapshot.yml/main?enable=pin","Info:   0 out of  15 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 third-party GitHubAction dependencies pinned"],"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":"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":"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":"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":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'","Warn: branch protection not enabled for branch 'v1.7.x'"],"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":"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 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-15T09:59:52.994Z","repository_id":18780085,"created_at":"2025-08-15T09:59:52.994Z","updated_at":"2025-08-15T09:59:52.994Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":283810094,"owners_count":26898417,"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-11-11T02:00:06.610Z","response_time":65,"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":"2025-11-16T03:00:36.816Z","updated_at":"2025-11-20T21:03:03.215Z","avatar_url":"https://github.com/Netflix.png","language":"Java","funding_links":[],"categories":["指标库"],"sub_categories":[],"readme":"[![Snapshot](https://github.com/Netflix/spectator/actions/workflows/snapshot.yml/badge.svg)](https://github.com/Netflix/spectator/actions/workflows/snapshot.yml)\n[![Release](https://github.com/Netflix/spectator/actions/workflows/release.yml/badge.svg)](https://github.com/Netflix/spectator/actions/workflows/release.yml)\n[![Maven Central](https://img.shields.io/maven-central/v/com.netflix.spectator/spectator-api.svg)](https://search.maven.org/artifact/com.netflix.spectator/spectator-api)\n\n# Spectator\n\nSimple library for instrumenting code to record dimensional time series.\n\n## Requirements\n\n* Java 8 or higher at runtime, Java 17 or higher for building.\n* Java 8 or higher for spectator 1.8.x or earlier.\n* Java 7 or higher for spectator 0.27.x or earlier.\n\n## Documentation\n\n* [Wiki](https://netflix.github.io/atlas-docs/spectator/)\n* [Javadoc](https://www.javadoc.io/doc/com.netflix.spectator/spectator-api/)\n\n## Dependencies\n\nTo instrument your code you need to depend on the api library. This provides the minimal interfaces\nfor you to code against and build test cases. The only dependency is slf4j.\n\n```\ncom.netflix.spectator:spectator-api:${version}\n```\n\nIf running at Netflix with the standard platform, see the\n[Netflix Integration](http://netflix.github.io/spectator/en/latest/intro/netflix/) page on the\nwiki.\n\n## Instrumenting Code\n\nSuppose we have a server and we want to keep track of:\n\n* Number of requests received with dimensions for breaking down by status code, country, and\n  the exception type if the request fails in an unexpected way.\n* Latency for handling requests.\n* Summary of the response sizes.\n* Current number of active connections on the server.\n\nHere is some sample code that does that:\n\n```java\n// In the application initialization setup a registry\nRegistry registry = new DefaultRegistry();\nServer s = new Server(registry);\n\npublic class Server {\n  private final Registry registry;\n  private final Id requestCountId;\n  private final Timer requestLatency;\n  private final DistributionSummary responseSizes;\n\n  @Inject\n  public Server(Registry registry) {\n    this.registry = registry;\n\n    // Create a base id for the request count. The id will get refined with\n    // additional dimensions when we receive a request.\n    requestCountId = registry.createId(\"server.requestCount\");\n\n    // Create a timer for tracking the latency. The reference can be held onto\n    // to avoid additional lookup cost in critical paths.\n    requestLatency = registry.timer(\"server.requestLatency\");\n\n    // Create a distribution summary meter for tracking the response sizes.\n    responseSizes = registry.distributionSummary(\"server.responseSizes\");\n\n    // Gauge type that can be sampled. In this case it will invoke the\n    // specified method via reflection to get the value. The registry will\n    // keep a weak reference to the object passed in so that registration will\n    // not prevent garbage collection of the server object.\n    registry.methodValue(\"server.numConnections\", this, \"getNumConnections\");\n  }\n\n  public Response handle(Request req) {\n    final long s = System.nanoTime();\n    requestLatency.recordRunnable(() -\u003e {\n      try {\n        Response res = doSomething(req);\n\n        // Update the counter id with dimensions based on the request. The\n        // counter will then be looked up in the registry which should be\n        // fairly cheap, such as lookup of id object in a ConcurrentHashMap.\n        // However, it is more expensive than having a local variable set\n        // to the counter.\n        final Id cntId = requestCountId\n          .withTag(\"country\", req.country())\n          .withTag(\"status\", res.status());\n        registry.counter(cntId).increment();\n\n        responseSizes.record(res.body().size());\n\n        return res;\n      } catch (Exception e) {\n        final Id cntId = requestCountId\n          .withTag(\"country\", req.country())\n          .withTag(\"status\", \"exception\")\n          .withTag(\"error\", e.getClass().getSimpleName());\n        registry.counter(cntId).increment();\n        throw e;\n      }\n    });\n  }\n\n  public int getNumConnections() {\n    // however we determine the current number of connections on the server\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNetflix%2Fspectator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNetflix%2Fspectator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNetflix%2Fspectator/lists"}