{"id":13487641,"url":"https://github.com/eggjs/egg-opentracing","last_synced_at":"2026-01-23T18:16:19.720Z","repository":{"id":57220637,"uuid":"94412362","full_name":"eggjs/egg-opentracing","owner":"eggjs","description":"Implementation of opentracing in Egg.js","archived":false,"fork":false,"pushed_at":"2022-12-18T01:26:06.000Z","size":44,"stargazers_count":19,"open_issues_count":1,"forks_count":3,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-10-08T00:33:03.565Z","etag":null,"topics":["egg","egg-plugin","eggjs","opentracing"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eggjs.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","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":"2017-06-15T07:29:02.000Z","updated_at":"2023-01-31T16:50:32.000Z","dependencies_parsed_at":"2023-01-29T18:16:24.847Z","dependency_job_id":null,"html_url":"https://github.com/eggjs/egg-opentracing","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/eggjs/egg-opentracing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-opentracing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-opentracing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-opentracing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-opentracing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eggjs","download_url":"https://codeload.github.com/eggjs/egg-opentracing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-opentracing/sbom","scorecard":{"id":368750,"data":{"date":"2025-08-11","repo":{"name":"github.com/eggjs/egg-opentracing","commit":"1473e070726b64415309480dccc5f8832cbb1ece"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.5,"checks":[{"name":"Code-Review","score":3,"reason":"Found 3/9 approved changesets -- score normalized to 3","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":"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":"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":"Token-Permissions","score":9,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql.yml:29","Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql.yml:28","Warn: no topLevel permission defined: .github/workflows/codeql.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":"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":"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/codeql.yml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/eggjs/egg-opentracing/codeql.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/eggjs/egg-opentracing/codeql.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:61: update your workflow using https://app.stepsecurity.io/secureworkflow/eggjs/egg-opentracing/codeql.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:74: update your workflow using https://app.stepsecurity.io/secureworkflow/eggjs/egg-opentracing/codeql.yml/master?enable=pin","Info:   0 out of   4 GitHub-owned 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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: 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":"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":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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":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":"SAST","score":7,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 0 commits out of 4 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-18T12:29:32.585Z","repository_id":57220637,"created_at":"2025-08-18T12:29:32.585Z","updated_at":"2025-08-18T12:29:32.585Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28697428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T17:25:48.045Z","status":"ssl_error","status_checked_at":"2026-01-23T17:25:47.153Z","response_time":59,"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":["egg","egg-plugin","eggjs","opentracing"],"created_at":"2024-07-31T18:01:01.492Z","updated_at":"2026-01-23T18:16:19.702Z","avatar_url":"https://github.com/eggjs.png","language":"JavaScript","funding_links":[],"categories":["仓库"],"sub_categories":["插件"],"readme":"# egg-opentracing\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![David deps][david-image]][david-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/egg-opentracing.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/egg-opentracing\n[travis-image]: https://img.shields.io/travis/eggjs/egg-opentracing.svg?style=flat-square\n[travis-url]: https://travis-ci.org/eggjs/egg-opentracing\n[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg-opentracing.svg?style=flat-square\n[codecov-url]: https://codecov.io/github/eggjs/egg-opentracing?branch=master\n[david-image]: https://img.shields.io/david/eggjs/egg-opentracing.svg?style=flat-square\n[david-url]: https://david-dm.org/eggjs/egg-opentracing\n[snyk-image]: https://snyk.io/test/npm/egg-opentracing/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/egg-opentracing\n[download-image]: https://img.shields.io/npm/dm/egg-opentracing.svg?style=flat-square\n[download-url]: https://npmjs.org/package/egg-opentracing\n\nImplementation of [opentracing](http://opentracing.io/) in Egg.js\n\n- Integrate httpserver and httpclient span\n- Customize carrier\n- Customize collector\n\n## Install\n\n```bash\n$ npm i egg-opentracing --save\n```\n\n## Usage\n\n```js\n// {app_root}/config/plugin.js\nexports.opentracing = {\n  enable: true,\n  package: 'egg-opentracing',\n};\n```\n\n### Configuration\n\nsee [config/config.default.js](config/config.default.js) for more detail.\n\n### Start a span\n\nYou can start a span by `startSpan` with operationName\n\n```js\nconst span = ctx.tracer.startSpan('request_egg');\nawait ctx.curl('https://eggjs.org');\nspan.finish();\n```\n\n**Note: httpclient has been supported by default**\n\n### Customize carrier\n\nCarrier can be [injected](https://github.com/opentracing/specification/blob/master/specification.md#inject-a-spancontext-into-a-carrier) and [extracted](https://github.com/opentracing/specification/blob/master/specification.md#extract-a-spancontext-from-a-carrier), so you can define a class for that.\n\n```js\n// lib/rpc_carrier.js\nclass RPCCarrier {\n  inject(spanContext) {\n    return {};\n  }\n\n  extract(carrier) {\n    return {\n      // traceId,\n      // spanId,\n      // baggage,\n    }\n  }\n}\n```\n\nThen configure it in `config/config.default.js` with a format name.\n\n```js\n// config/config.default.js\nexports.opentracing = {\n  carrier: {\n    RPC: require('../lib/rpc_carrier'),\n  },\n};\n```\n\nAfter that, you can use the format to inject or extract.\n\n```js\n// inject\nconst span = ctx.tracer.startSpan('rpc');\nconst carrier = {};\nctx.tracer.inject(span, 'RPC', carrier);\nawait ctx.rpc.invoke({}, { carrier });\nspan.finish();\n```\n\n### Customize collector\n\nCollector will be triggered when span finished, you can implement it to write logs or report to server.\n\n```js\n// lib/log_collector.js\nclass LogCollector {\n  constructor(app) {\n    this.app = app;\n  }\n\n  collect(span) {\n    this.app.logger.info('%s,%s', span.traceId, span.spanId);\n  }\n}\n```\n\nThen configure it in `config/config.default.js`.\n\n```js\n// config/config.default.js\nexports.opentracing = {\n  collector: {\n    log: require('../lib/log_collector'),\n  },\n};\n```\n\nNote: zipkin collector has been implemented in [egg-zipkin](https://github.com/eggjs/egg-zipkin/).\n\n## API\n\n### Tracer\n\nTracer extends [Tracer of opentracing](https://opentracing-javascript.surge.sh/classes/tracer.html), you can get the instance by `ctx.tracer`.\n\n### Span\n\nSpan extends [Span of opentracing](https://opentracing-javascript.surge.sh/classes/span.html), it's instantiated by `ctx.tracer.startSpan`.\n\n- {String} name: operation name\n- {String} traceId: the traceId of the span\n- {String} spanId: the id of the span\n- {String} parentSpanId: the id of parent span, it will be `''` if there's no parent span.\n- {String} getTag(key): return the value of the specified tag\n- {Object} getTags(): return all tags\n\n### SpanContext\n\nSpanContext extends [SpanContext of opentracing](https://opentracing-javascript.surge.sh/classes/spancontext.html), it's instantiated by `span.context()`.\n\n- {String} traceId: the traceId of the span\n- {String} spanId: the id of the span\n- {Void} setBaggage(key, value): set one baggage\n- {String} getBaggage(key): return the value of the specified baggage\n- {Void} setBaggages(baggages): set multiple baggages\n- {Object} getBaggages(): return all baggages\n\n### Carrier\n\nCarrier is a class that transform between SpanContext and carrier.\n\n- {Object} inject(SpanContext): implement this method that transform SpanContext to carrier object.\n- {Object} extract(carrier): implement this method that transform carrier object to SpanContext, extract must return traceId and spanId.\n\n### Collector\n\n- {Void} collect(span): implement this method that report span.\n\n## Questions \u0026 Suggestions\n\nPlease open an issue [here](https://github.com/eggjs/egg/issues).\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fegg-opentracing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feggjs%2Fegg-opentracing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fegg-opentracing/lists"}