{"_id":"@ducnvx/nestjs-observe-telemetry-stash","_rev":"3-0e299578ef58a6c03cd6dcee3c80cb6f","name":"@ducnvx/nestjs-observe-telemetry-stash","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@ducnvx/nestjs-observe-telemetry-stash","version":"1.0.0","_id":"@ducnvx/nestjs-observe-telemetry-stash@1.0.0","maintainers":[{"name":"ducnvx","email":"ngovanxuanduc@gmail.com"}],"bin":{"telemetry-stash-replay":"dist/bin/replay-cli.js"},"dist":{"shasum":"d09f4812b4c6c2155e15b3edc8c8f612eb16aeff","tarball":"https://registry.npmjs.org/@ducnvx/nestjs-observe-telemetry-stash/-/nestjs-observe-telemetry-stash-1.0.0.tgz","fileCount":32,"integrity":"sha512-FsqfoRFCLpqwsBTzhzpryO6O1efaZxuNdxPdI3fwsix4O7qnRXEeUtY6VKOBJLc7eJOHqfALoBPQQcBGcUMeWA==","signatures":[{"sig":"MEQCIDmcRIVK1wMHr73HzyUp1zRAPkG2vDjBHCXAX443fSaLAiAdYLhFs1864ENPWxXuvZSY3HayVJD5xsUDUmpW3PnvRA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":37909},"main":"dist/src/index.js","types":"dist/src/index.d.ts","gitHead":"d4bb132abf642226222f89f8f8b051f9efe6d710","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"ducnvx","email":"ngovanxuanduc@gmail.com"},"_npmVersion":"10.9.8","description":"Local Gzip File Sink & Offline Stash for NestJS Observe Telemetry","directories":{},"_nodeVersion":"22.22.3","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nestjs-observe-telemetry-stash_1.0.0_1788774513738_0.12295927333062417","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@ducnvx/nestjs-observe-telemetry-stash","version":"1.0.1","_id":"@ducnvx/nestjs-observe-telemetry-stash@1.0.1","maintainers":[{"name":"ducnvx","email":"ngovanxuanduc@gmail.com"}],"homepage":"https://github.com/ngovanxuanduc/nestjs-observe-telemetry-stash#readme","bugs":{"url":"https://github.com/ngovanxuanduc/nestjs-observe-telemetry-stash/issues"},"bin":{"telemetry-stash-replay":"dist/bin/replay-cli.js"},"dist":{"shasum":"75f35657c81a0efbfe70a62ed4ee545190a9c935","tarball":"https://registry.npmjs.org/@ducnvx/nestjs-observe-telemetry-stash/-/nestjs-observe-telemetry-stash-1.0.1.tgz","fileCount":32,"integrity":"sha512-N4jZh2GW0t+QQXuE+hzQ7pXfGHFhG30AnCUToNulsU1AuRnPfoUXxpbhu7ZIMo+C5WPZxDYhvvJsEkCMFc+Q2A==","signatures":[{"sig":"MEYCIQDMsjq4KD2geW9MR7sKCqzCszYamWqPDWiZYFIEzBOn3AIhANntEX+e6I1He4GjFVww9sS2v08xJyHHPcBAvkdUCXy5","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQDMuUnXRxrbdUzPfV2+Wbx+0yxSMA/44nGNbt54KSSaWgIhAJZ9i0NUZDrly7aVwgZtvxwXlw1LAoC8Vluk5G7903yz","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":38247},"main":"dist/src/index.js","types":"dist/src/index.d.ts","gitHead":"d4bb132abf642226222f89f8f8b051f9efe6d710","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"ducnvx","email":"ngovanxuanduc@gmail.com"},"repository":{"url":"git+https://github.com/ngovanxuanduc/nestjs-observe-telemetry-stash.git","type":"git"},"_npmVersion":"10.9.8","description":"Local Gzip File Sink & Offline Stash for NestJS Observe Telemetry","directories":{},"_nodeVersion":"22.22.3","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nestjs-observe-telemetry-stash_1.0.1_1788774743650_0.5431942830560141","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"_id":"@ducnvx/nestjs-observe-telemetry-stash@1.1.0","bin":{"telemetry-stash-replay":"dist/bin/replay-cli.js"},"bugs":{"url":"https://github.com/ngovanxuanduc/nestjs-observe-telemetry-stash/issues"},"dist":{"shasum":"6c368001e7fff81b74348d1f033a496048c26303","tarball":"https://registry.npmjs.org/@ducnvx/nestjs-observe-telemetry-stash/-/nestjs-observe-telemetry-stash-1.1.0.tgz","fileCount":34,"integrity":"sha512-AEJhXyZTtwACtwIVEvuptC0TZ9G2etJziMdVvRCndv25TzaCfIKD1bZ1VsPPF1MJkiL43DzoTxAdqEvMsxrk/g==","signatures":[{"sig":"MEUCIQCRf95i550H7uIk/sBJSEwHJ057FULfbSyHYNpA6O5tngIgCkGtHw9QmVtl8QYQF6qHmXnQg8QDPC7AFtGGrrCTqQ0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC7x51a/He41Wq9DUFnvsYdyatFK139xZKIIx4tOeEmggIhAMSBJqHqBGH48LtQHUZKfhSejE7sTPw7zjC8XYasiDd3"}],"unpackedSize":47624},"main":"dist/src/index.js","name":"@ducnvx/nestjs-observe-telemetry-stash","types":"dist/src/index.d.ts","gitHead":"14c9e0ed97e3f75722b8da174fe9e5d93ee9ced1","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"version":"1.1.0","_npmUser":{"name":"ducnvx","email":"ngovanxuanduc@gmail.com"},"homepage":"https://github.com/ngovanxuanduc/nestjs-observe-telemetry-stash#readme","repository":{"url":"git+https://github.com/ngovanxuanduc/nestjs-observe-telemetry-stash.git","type":"git"},"_npmVersion":"10.9.8","description":"Local Gzip File Sink & Offline Stash for NestJS Observe Telemetry","directories":{},"maintainers":[{"name":"ducnvx","email":"ngovanxuanduc@gmail.com"}],"_nodeVersion":"22.22.3","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nestjs-observe-telemetry-stash_1.1.0_1788939024539_0.5957975479778823"}}},"time":{"created":"2026-09-07T09:48:33.520Z","modified":"2026-09-09T07:30:24.789Z","1.0.0":"2026-09-07T09:48:33.871Z","1.0.1":"2026-09-07T09:52:23.729Z","1.1.0":"2026-09-09T07:30:24.630Z"},"bugs":{"url":"https://github.com/ngovanxuanduc/nestjs-observe-telemetry-stash/issues"},"homepage":"https://github.com/ngovanxuanduc/nestjs-observe-telemetry-stash#readme","repository":{"url":"git+https://github.com/ngovanxuanduc/nestjs-observe-telemetry-stash.git","type":"git"},"description":"Local Gzip File Sink & Offline Stash for NestJS Observe Telemetry","maintainers":[{"name":"ducnvx","email":"ngovanxuanduc@gmail.com"}],"readme":"# nestjs-observe-telemetry-stash\n\nZero-config offline telemetry stash and compressed file sink for `nestjs-observe`.\n\nGiúp ứng dụng NestJS tự mở HTTP Receiver local để chặn triệt để lỗi `ECONNREFUSED` từ `ObserveAgentWorker`, lưu trữ nén Gzip (`.jsonl.gz`) tối ưu đĩa/CPU và hỗ trợ CLI Replay dữ liệu lên SigNoz / OpenTelemetry Collector khi cần.\n\n---\n\n## 🚀 Quick Start (Zero-Config)\n\nChỉ cần import thư viện ở **dòng đầu tiên** của file `src/main.ts`:\n\n```typescript\nimport \"nestjs-observe-telemetry-stash\"; // 👈 Bắt buộc ở dòng 1 (trước tất cả import khác)\n\nimport { NestFactory } from \"@nestjs/core\";\nimport { AppModule } from \"./app.module\";\n\nasync function bootstrap() {\n  const app = await NestFactory.create(AppModule);\n  await app.listen(3000);\n}\nbootstrap();\n```\n\n---\n\n## ⚙️ Custom Configuration\n\nNếu không muốn dùng cổng `3301` hoặc đường dẫn lưu trữ mặc định, bạn có thể gọi hàm `configureStash()` để tùy chỉnh:\n\n```typescript\nimport { configureStash } from \"nestjs-observe-telemetry-stash\";\n\nconfigureStash({\n  port: 3301, // Port HTTP Receiver (Mặc định: 3301)\n  storageDir: \"./telemetry-stash\", // Thư mục lưu file (Mặc định: ./telemetry-storage)\n  raw: true, // Bật lưu nén .jsonl.gz để replay (Mặc định: true)\n  readable: true, // Bật xuất OTLP JSON thô để debug local (Mặc định: false)\n});\n```\n\n### Environment Variables\n\nBạn cũng có thể cấu hình nhanh thông qua file `.env` mà không cần sửa code:\n\n| Biến môi trường         | Mặc định              | Mô tả                                               |\n| ----------------------- | --------------------- | --------------------------------------------------- |\n| `TELEMETRY_PORT`        | `3301`                | Cổng HTTP Receiver hứng telemetry từ Observe Worker |\n| `TELEMETRY_STORAGE_DIR` | `./telemetry-storage` | Thư mục đĩa dùng để ghi file stash                  |\n\n---\n\n## 🔄 CLI Replay Tool\n\nSử dụng lệnh `telemetry-stash-replay` (hoặc `npx telemetry-stash-replay`) để đọc file nén và đẩy ngược dữ liệu lên SigNoz / OTLP Collector.\n\n### Danh sách Tham số CLI Flags\n\n| Flag                   | Mặc định                           | Mô tả                           |\n| ---------------------- | ---------------------------------- | ------------------------------- |\n| `--date=YYYY-MM-DD`    | Ngày hiện tại                      | Ngày của thư mục log cần replay |\n| `--dir=PATH`           | `./telemetry-storage`              | Thư mục lưu trữ telemetry       |\n| `--target-traces=URL`  | `http://localhost:4318/v1/traces`  | OTLP Traces Receiver Endpoint   |\n| `--target-logs=URL`    | `http://localhost:4318/v1/logs`    | OTLP Logs Receiver Endpoint     |\n| `--target-metrics=URL` | `http://localhost:4318/v1/metrics` | OTLP Metrics Receiver Endpoint  |\n\n### Ví dụ lệnh chạy thực tế\n\n**1. Replay dữ liệu hôm nay về SigNoz Local:**\n\n```bash\nnpx telemetry-stash-replay\n\n```\n\n**2. Replay dữ liệu theo ngày chỉ định:**\n\n```bash\nnpx telemetry-stash-replay --date=2026-09-04\n\n```\n\n**3. Replay từ thư mục đĩa tùy chỉnh:**\n\n```bash\nnpx telemetry-stash-replay --dir=./my-stash-folder --date=2026-09-04\n\n```\n\n**4. Replay lên SigNoz Server từ xa:**\n\n```bash\nnpx telemetry-stash-replay \\\n  --date=2026-09-04 \\\n  --target-traces=[http://192.168.1.100:4318/v1/traces](http://192.168.1.100:4318/v1/traces) \\\n  --target-logs=[http://192.168.1.100:4318/v1/logs](http://192.168.1.100:4318/v1/logs) \\\n  --target-metrics=[http://192.168.1.100:4318/v1/metrics](http://192.168.1.100:4318/v1/metrics)\n\n```\n\n---\n\n## 📁 Cấu trúc lưu trữ dữ liệu\n\nDữ liệu sẽ tự động phân loại theo từng ngày:\n\n```text\ntelemetry-storage/\n└── 2026-09-04/\n    ├── raw-payloads.jsonl.gz    # Dữ liệu Gzip thô siêu nhẹ (dùng để Replay)\n    ├── readable-traces.jsonl    # (Nếu bật readable: true) Dữ liệu OTLP Traces\n    ├── readable-logs.jsonl      # (Nếu bật readable: true) Dữ liệu OTLP Logs\n    └── readable-metrics.jsonl   # (Nếu bật readable: true) Dữ liệu OTLP Metrics\n\n```\n","readmeFilename":"README.md"}