{"id":37029660,"url":"https://github.com/eulery/opentsdb-java-sdk","last_synced_at":"2026-01-14T03:34:24.137Z","repository":{"id":45535093,"uuid":"172463189","full_name":"eulery/opentsdb-java-sdk","owner":"eulery","description":"用Java语言封装了openTSDB的http api","archived":false,"fork":false,"pushed_at":"2022-11-16T11:36:10.000Z","size":69,"stargazers_count":34,"open_issues_count":7,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-22T23:59:08.526Z","etag":null,"topics":["java","opentsdb-http"],"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/eulery.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}},"created_at":"2019-02-25T08:15:56.000Z","updated_at":"2025-05-19T06:31:53.000Z","dependencies_parsed_at":"2022-09-13T12:50:52.650Z","dependency_job_id":null,"html_url":"https://github.com/eulery/opentsdb-java-sdk","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eulery/opentsdb-java-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eulery%2Fopentsdb-java-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eulery%2Fopentsdb-java-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eulery%2Fopentsdb-java-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eulery%2Fopentsdb-java-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eulery","download_url":"https://codeload.github.com/eulery/opentsdb-java-sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eulery%2Fopentsdb-java-sdk/sbom","scorecard":{"id":384916,"data":{"date":"2025-08-11","repo":{"name":"github.com/eulery/opentsdb-java-sdk","commit":"debf97bd433e352f357ce16524d6e9be473730ad"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"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":"Code-Review","score":0,"reason":"Found 0/22 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":"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":"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":"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":"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":"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":"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":"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":0,"reason":"60 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-h46c-h94j-95f3","Warn: Project is vulnerable to: GHSA-wf8f-6423-gfxg","Warn: Project is vulnerable to: GHSA-27xj-rqx5-2255","Warn: Project is vulnerable to: GHSA-288c-cq4h-88gq","Warn: Project is vulnerable to: GHSA-4w82-r329-3q67","Warn: Project is vulnerable to: GHSA-57j2-w4cx-62h2","Warn: Project is vulnerable to: GHSA-58pp-9c76-5625","Warn: Project is vulnerable to: GHSA-5949-rw7g-wx7w","Warn: Project is vulnerable to: GHSA-5p34-5m6p-p58g","Warn: Project is vulnerable to: GHSA-5r5r-6hpj-8gg9","Warn: Project is vulnerable to: GHSA-5ww9-j83m-q7qx","Warn: Project is vulnerable to: GHSA-6fpp-rgj9-8rwc","Warn: Project is vulnerable to: GHSA-758m-v56v-grj4","Warn: Project is vulnerable to: GHSA-85cw-hj65-qqv9","Warn: Project is vulnerable to: GHSA-89qr-369f-5m5x","Warn: Project is vulnerable to: GHSA-8c4j-34r4-xr8g","Warn: Project is vulnerable to: GHSA-8w26-6f25-cm9x","Warn: Project is vulnerable to: GHSA-95cm-88f5-f2c7","Warn: Project is vulnerable to: GHSA-9gph-22xh-8x98","Warn: Project is vulnerable to: GHSA-9m6f-7xcq-8vf8","Warn: Project is vulnerable to: GHSA-9vvp-fxw6-jcxr","Warn: Project is vulnerable to: GHSA-c265-37vj-cwcc","Warn: Project is vulnerable to: GHSA-c2q3-4qrh-fm48","Warn: Project is vulnerable to: GHSA-cf6r-3wgc-h863","Warn: Project is vulnerable to: GHSA-cmfg-87vq-g5g4","Warn: Project is vulnerable to: GHSA-cvm9-fjm9-3572","Warn: Project is vulnerable to: GHSA-f3j5-rmmp-3fc5","Warn: Project is vulnerable to: GHSA-f9xh-2qgp-cq57","Warn: Project is vulnerable to: GHSA-fmmc-742q-jg75","Warn: Project is vulnerable to: GHSA-fqwf-pjwf-7vqv","Warn: Project is vulnerable to: GHSA-gjmw-vf9h-g25v","Warn: Project is vulnerable to: GHSA-gwp4-hfv6-p7hw","Warn: Project is vulnerable to: GHSA-gww7-p5w4-wrfv","Warn: Project is vulnerable to: GHSA-h3cw-g4mq-c5x2","Warn: Project is vulnerable to: GHSA-h4rc-386g-6m85","Warn: Project is vulnerable to: GHSA-h822-r4r5-v8jg","Warn: Project is vulnerable to: GHSA-j823-4qch-3rgm","Warn: Project is vulnerable to: GHSA-jjjh-jjxp-wpff","Warn: Project is vulnerable to: GHSA-m6x4-97wx-4q27","Warn: Project is vulnerable to: GHSA-mc6h-4qgp-37qh","Warn: Project is vulnerable to: GHSA-mph4-vhrx-mv67","Warn: Project is vulnerable to: GHSA-mx7p-6679-8g3q","Warn: Project is vulnerable to: GHSA-p43x-xfjf-5jhr","Warn: Project is vulnerable to: GHSA-q93h-jc49-78gg","Warn: Project is vulnerable to: GHSA-qjw2-hr98-qgfh","Warn: Project is vulnerable to: GHSA-qmqc-x3r4-6v39","Warn: Project is vulnerable to: GHSA-r3gr-cxrf-hg25","Warn: Project is vulnerable to: GHSA-r695-7vr9-jgc2","Warn: Project is vulnerable to: GHSA-rf6r-2c4q-2vwg","Warn: Project is vulnerable to: GHSA-rgv9-q543-rqg4","Warn: Project is vulnerable to: GHSA-rpr3-cw39-3pxh","Warn: Project is vulnerable to: GHSA-v3xw-c963-f5hc","Warn: Project is vulnerable to: GHSA-v585-23hc-c647","Warn: Project is vulnerable to: GHSA-vfqx-33qm-g869","Warn: Project is vulnerable to: GHSA-wh8g-3j2c-rqj5","Warn: Project is vulnerable to: GHSA-5mg8-w23w-74h3","Warn: Project is vulnerable to: GHSA-7g45-4rm6-3mm3","Warn: Project is vulnerable to: GHSA-mvr2-9pj6-7w5j","Warn: Project is vulnerable to: GHSA-j288-q9x7-2f5v","Warn: Project is vulnerable to: GHSA-7r82-7xv7-xcpj"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T16:22:30.436Z","repository_id":45535093,"created_at":"2025-08-18T16:22:30.436Z","updated_at":"2025-08-18T16:22:30.436Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408843,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"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":["java","opentsdb-http"],"created_at":"2026-01-14T03:34:23.688Z","updated_at":"2026-01-14T03:34:24.129Z","avatar_url":"https://github.com/eulery.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# opentsdb-java-sdk\n[http api地址](http://opentsdb.net/docs/build/html/api_http/index.html#api-endpoints)\n\n# 目前实现的功能\n* 查询数据，支持同步和异步\n* 写入数据，支持异步回调\n* 删除数据\n* 查询最新数据\n* 查询metric、tag_key和tag_value，支持auto_complete\n\u003cbr\u003e\n`源码中CrudTest类提供了一些使用说明和测试，包括并发查询测试和并发写入测试`\n\n# 快速开始\n## Maven依赖\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.eulery\u003c/groupId\u003e\n    \u003cartifactId\u003eopentsdb-java-sdk\u003c/artifactId\u003e\n    \u003cversion\u003e1.1.6\u003c/version\u003e\n\u003c/dependency\u003e\n```\n## 创建连接\n```java\nOpenTSDBConfig config = OpenTSDBConfig.address(host, port)\n                                              .config();\nOpenTSDBClient client = OpenTSDBClientFactory.connect(config);\n\n// 优雅关闭连接，会等待所有异步操作完成\nclient.gracefulClose();\n```\n```java\nOpenTSDBConfig.address(host, port)\n              // http连接池大小，默认100\n              .httpConnectionPool(100)\n              // http请求超时时间，默认100s\n              .httpConnectTimeout(100)\n              // 异步写入数据时，每次http提交的数据条数，默认50\n              .batchPutSize(50)\n              // 异步写入数据中，内部有一个队列，默认队列大小20000\n              .batchPutBufferSize(20000)\n              // 异步写入等待时间，如果距离上一次请求超多300ms，且有数据，则直接提交\n              .batchPutTimeLimit(300)\n              // 当确认这个client只用于查询时设置，可不创建内部队列从而提高效率\n              .readonly()\n              // 每批数据提交完成后回调\n              .batchPutCallBack(new BatchPutHttpResponseCallback.BatchPutCallBack() {\n                  @Override\n                  public void response(List\u003cPoint\u003e points, DetailResult result) {\n                      // 在请求完成并且response code成功时回调\n                  }\n\n                  @Override\n                  public void responseError(List\u003cPoint\u003e points, DetailResult result) {\n                      // 在response code失败时回调\n                  }\n\n                  @Override\n                  public void failed(List\u003cPoint\u003e points, Exception e) {\n                      // 在发生错误是回调\n                  }\n              })\n\n```\n## 查询数据 \n具体参数使用说明查看[http api](http://opentsdb.net/docs/build/html/api_http/query/index.html)\n```java\nQuery query = Query.begin(\"7d-ago\")\n                   .sub(SubQuery.metric(\"metric.test\")\n                                .aggregator(SubQuery.Aggregator.NONE)\n                                .build())\n                   .build();\n// 同步查询\nList\u003cQueryResult\u003e resultList = client.query(query);\n\n// 异步查询\nclient.query(query, new QueryHttpResponseCallback.QueryCallback() {\n    @Override\n    public void response(Query query, List\u003cQueryResult\u003e queryResults) {\n        // 在请求完成并且response code成功时回调\n    }\n\n    @Override\n    public void responseError(Query query, HttpException e) {\n        // 在response code失败时回调\n    }\n\n    @Override\n    public void failed(Query query, Exception e) {\n        // 在发生错误是回调\n    }\n});\n```\n## 写入数据\n具体参数使用说明查看[http api](http://opentsdb.net/docs/build/html/api_http/put.html)\n```java\nPoint point = Point.metric(\"point\")\n                  .tag(\"testTag\", \"test\")\n                  .value(timestamp, 1.0)\n                  .build();\nclient.put(point);\n```\n## 查询最新数据\n具体参数使用说明查看[http api](http://opentsdb.net/docs/build/html/api_http/query/last.html)\n```java\nLastPointQuery query = LastPointQuery.sub(LastPointSubQuery.metric(\"point\")\n                                                           .tag(\"testTag\", \"test_1\")\n                                                           .build())\n                                     // baskScan表示查询最多向前推进多少小时\n                                     // 比如在5小时前写入过数据\n                                     // 那么backScan(6)可以查出数据，但backScan(4)则不行\n                                     .backScan(1000)\n                                     .build();\nList\u003cLastPointQueryResult\u003e lastPointQueryResults = client.queryLast(query);\n```\n\n## 删除数据\n删除数据和查询数据使用同一个Query，查询命中的数据将会被删除\n```java\nQuery query = Query.begin(\"7d-ago\")\n                   .sub(SubQuery.metric(\"metric.test\")\n                                .aggregator(SubQuery.Aggregator.NONE)\n                                .build())\n                   .build();\nclient.delete(query);\n```\n## 查询metrics、tagk、tagv\n具体参数使用说明查看[http api](http://opentsdb.net/docs/build/html/api_http/suggest.html)\n```java\nSuggestQuery query = SuggestQuery.type(SuggestQuery.Type.METRICS)\n                                 .build();\nList\u003cString\u003e suggests = client.querySuggest(query);\n```\n\n## ttl\n如果想为数据设置ttl(time to live)，opentsdb没有直接提供这方面的api，只能通过底层hbase的ttl来完成\n```shell\nhbase\u003e describe 'tsdb'\nTable tsdb is ENABLED\ntsdb, {NAME =\u003e 't', VERSIONS =\u003e 1, COMPRESSION =\u003e 'NONE', TTL =\u003e 'FOREVER'}\n\nhbase\u003e alter ‘tsdb′, NAME =\u003e ‘t′, TTL =\u003e 8640000\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feulery%2Fopentsdb-java-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feulery%2Fopentsdb-java-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feulery%2Fopentsdb-java-sdk/lists"}