npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ducnvx/nestjs-observe-telemetry-stash

v1.1.0

Published

Local Gzip File Sink & Offline Stash for NestJS Observe Telemetry

Downloads

214

Readme

nestjs-observe-telemetry-stash

Zero-config offline telemetry stash and compressed file sink for nestjs-observe.

Giú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.


🚀 Quick Start (Zero-Config)

Chỉ cần import thư viện ở dòng đầu tiên của file src/main.ts:

import "nestjs-observe-telemetry-stash"; // 👈 Bắt buộc ở dòng 1 (trước tất cả import khác)

import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app.module";

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  await app.listen(3000);
}
bootstrap();

⚙️ Custom Configuration

Nế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:

import { configureStash } from "nestjs-observe-telemetry-stash";

configureStash({
  port: 3301, // Port HTTP Receiver (Mặc định: 3301)
  storageDir: "./telemetry-stash", // Thư mục lưu file (Mặc định: ./telemetry-storage)
  raw: true, // Bật lưu nén .jsonl.gz để replay (Mặc định: true)
  readable: true, // Bật xuất OTLP JSON thô để debug local (Mặc định: false)
});

Environment Variables

Bạn cũng có thể cấu hình nhanh thông qua file .env mà không cần sửa code:

| Biến môi trường | Mặc định | Mô tả | | ----------------------- | --------------------- | --------------------------------------------------- | | TELEMETRY_PORT | 3301 | Cổng HTTP Receiver hứng telemetry từ Observe Worker | | TELEMETRY_STORAGE_DIR | ./telemetry-storage | Thư mục đĩa dùng để ghi file stash |


🔄 CLI Replay Tool

Sử 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.

Danh sách Tham số CLI Flags

| Flag | Mặc định | Mô tả | | ---------------------- | ---------------------------------- | ------------------------------- | | --date=YYYY-MM-DD | Ngày hiện tại | Ngày của thư mục log cần replay | | --dir=PATH | ./telemetry-storage | Thư mục lưu trữ telemetry | | --target-traces=URL | http://localhost:4318/v1/traces | OTLP Traces Receiver Endpoint | | --target-logs=URL | http://localhost:4318/v1/logs | OTLP Logs Receiver Endpoint | | --target-metrics=URL | http://localhost:4318/v1/metrics | OTLP Metrics Receiver Endpoint |

Ví dụ lệnh chạy thực tế

1. Replay dữ liệu hôm nay về SigNoz Local:

npx telemetry-stash-replay

2. Replay dữ liệu theo ngày chỉ định:

npx telemetry-stash-replay --date=2026-09-04

3. Replay từ thư mục đĩa tùy chỉnh:

npx telemetry-stash-replay --dir=./my-stash-folder --date=2026-09-04

4. Replay lên SigNoz Server từ xa:

npx telemetry-stash-replay \
  --date=2026-09-04 \
  --target-traces=[http://192.168.1.100:4318/v1/traces](http://192.168.1.100:4318/v1/traces) \
  --target-logs=[http://192.168.1.100:4318/v1/logs](http://192.168.1.100:4318/v1/logs) \
  --target-metrics=[http://192.168.1.100:4318/v1/metrics](http://192.168.1.100:4318/v1/metrics)

📁 Cấu trúc lưu trữ dữ liệu

Dữ liệu sẽ tự động phân loại theo từng ngày:

telemetry-storage/
└── 2026-09-04/
    ├── raw-payloads.jsonl.gz    # Dữ liệu Gzip thô siêu nhẹ (dùng để Replay)
    ├── readable-traces.jsonl    # (Nếu bật readable: true) Dữ liệu OTLP Traces
    ├── readable-logs.jsonl      # (Nếu bật readable: true) Dữ liệu OTLP Logs
    └── readable-metrics.jsonl   # (Nếu bật readable: true) Dữ liệu OTLP Metrics