{"id":48229821,"url":"https://github.com/stainless-api/xray-emitter-js","last_synced_at":"2026-04-04T19:30:26.585Z","repository":{"id":339470345,"uuid":"1156545001","full_name":"stainless-api/xray-emitter-js","owner":"stainless-api","description":"X-ray emitter for Node/Typescript","archived":false,"fork":false,"pushed_at":"2026-03-12T23:11:28.000Z","size":174,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-13T00:05:35.355Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stainless-api.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-02-12T19:14:15.000Z","updated_at":"2026-03-12T23:05:14.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/stainless-api/xray-emitter-js","commit_stats":null,"previous_names":["stainless-api/xray-emitter-js"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/stainless-api/xray-emitter-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stainless-api%2Fxray-emitter-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stainless-api%2Fxray-emitter-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stainless-api%2Fxray-emitter-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stainless-api%2Fxray-emitter-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stainless-api","download_url":"https://codeload.github.com/stainless-api/xray-emitter-js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stainless-api%2Fxray-emitter-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31410747,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T19:29:44.979Z","status":"ssl_error","status_checked_at":"2026-04-04T19:29:11.535Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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-04-04T19:30:25.928Z","updated_at":"2026-04-04T19:30:26.577Z","avatar_url":"https://github.com/stainless-api.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# X-ray emitter\n\nNode and Typescript SDKs to emit request logs to Stainless X-ray.\n\n## Getting started\n\n```sh\nnpm add @stainlessdev/xray-emitter\n```\n\nThen using it in Express, for example:\n\n```ts\nimport express from 'express';\nimport { createEmitter } from '@stainlessdev/xray-emitter/express';\nimport { getXrayContext } from '@stainlessdev/xray-emitter/node';\n\nconst app = express();\n\nconst xray = createEmitter({ serviceName: 'my-service' });\n\napp.use(xray);\n\napp.use((req, _res, next) =\u003e {\n  const ctx = getXrayContext(req);\n  ctx?.setActor('tenant-123', 'user-123');\n  next();\n});\n\napp.get('/', (_req, res) =\u003e {\n  res.send('ok');\n});\n```\n\n## Supported frameworks\n\n| Framework | Import | Docs | Example |\n|-----------|--------|------|---------|\n| Express | `@stainlessdev/xray-emitter/express` | [README](src/express/README.md) | [example](examples/express) |\n| Fastify | `@stainlessdev/xray-emitter/fastify` | [README](src/fastify/README.md) | [example](examples/fastify) |\n| Hono | `@stainlessdev/xray-emitter/hono` | [README](src/hono/README.md) | [example](examples/hono) |\n| Next.js | `@stainlessdev/xray-emitter/next` | [README](src/next/README.md) | [example](examples/next-app) |\n| Remix | `@stainlessdev/xray-emitter/remix` | [README](src/remix/README.md) | [example](examples/remix-app) |\n| Effect | `@stainlessdev/xray-emitter/effect` | [README](src/effect/README.md) | [example](examples/effect) |\n\nLower-level adapters:\n\n| Adapter | Import | Docs | Example |\n|---------|--------|------|---------|\n| Node.js (`node:http`) | `@stainlessdev/xray-emitter/node` | [README](src/node/README.md) | [example](examples/node-http) |\n| Fetch / Edge | `@stainlessdev/xray-emitter/fetch` | [README](src/fetch/README.md) | [example](examples/edge) |\n| Core | `@stainlessdev/xray-emitter` | [README](src/core/README.md) | — |\n\n## Configuration\n\nX-ray does not read standard OTEL environment variables. Configure an endpoint by passing\n`endpointUrl` or setting `STAINLESS_XRAY_ENDPOINT_URL`. If both are set, `endpointUrl` wins. An\nerror is thrown if no endpoint is configured.\n\nThe core module (`@stainlessdev/xray-emitter`) is runtime-agnostic; use it only if you supply a\ncustom exporter instance to `createEmitter`.\n\n### Request IDs\n\nX-ray resolves request IDs from **response headers** when the span is closed. Configure the header name with `requestId.header` (default: `request-id`, emitted as `Request-Id`). Resolution order is: explicit `requestId` on the normalized request → response header lookup → UUIDv7 when missing.\n\nIf the configured response header is missing when the response is finalized, X-ray will set it (using the explicit ID when provided, otherwise a generated UUIDv7). Existing response headers are not overwritten.\n\n### Fetch wrappers\n\n`wrapFetch` may replace the request/response objects while capturing bodies. `wrapFetchPreserve` keeps the original request/response whenever possible, but it may replace the response if it needs to inject a missing `Request-Id` header.\n\n## Development\n\n```sh\npnpm install\npnpm build\npnpm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstainless-api%2Fxray-emitter-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstainless-api%2Fxray-emitter-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstainless-api%2Fxray-emitter-js/lists"}