@codefresh-io/cf-telemetry

中文文档
4.6.6发布于 2026/11/09ESM + CJS近 30 天下载 6282

Base utils for monitoring.

原始使用文档
文档目录3 节
  1. Usage
  2. Lifecycle notice
  3. Environment variables

cf-telemetry

Base utils for monitoring.

Includes:

Usage

Add import '@codefresh-io/cf-telemetry/init' statement at the very beginning of the application lifecycle.

Please refer to the separate docs above for further configuration and usage details.

// index.ts
// ↓ Should be imported first
import '@codefresh-io/cf-telemetry/init'
// ↓ Keep one blank line below to prevent automatic import reordering

Lifecycle notice

This library only registers terminate listener beforeExit event to gracefully terminate instrumentation, which may include flushing logs, metrics, and profiles.

[!IMPORTANT] Please ensure calling terminate() method of this library before calling process.exit(), or to include it in your application logic that handles SIGINT/SIGTERM signals, to ensure graceful termination of instrumentation.

import { terminate } from '@codefresh-io/cf-telemetry/init'

// ...your application logic
await terminate();    // Ensure graceful termination of instrumentation
process.exit(0);      // Now it's safe to exit the process
import { terminate } from '@codefresh-io/cf-telemetry/init'

process.on('SIGINT', async () => {
  await terminate();    // Ensure graceful termination of instrumentation
  process.exit(130);    // Now it's safe to exit the process
});
process.on('SIGTERM', async () => {
  await terminate();    // Ensure graceful termination of instrumentation
  process.exit(143);    // Now it's safe to exit the process
});

Environment variables

VariableRequiredDefault valueDescription
CF_SERVICE_NAMEoptionalunknown_service:nodeSets service name for OpenTelemetry, Pyroscope and Prometheus.
CF_SERVICE_VERSIONoptionalunknownSets service version for OpenTelemetry, Pyroscope and Prometheus.

版本与发布记录

@codefresh-io/cf-telemetry 共发布 153 个版本,首次发布于 2025/01/17;过去 12 个月发布了 74 个版本。

版本发布日期距今
4.6.6latest2026/11/09今天
4.6.52026/11/027 天前
4.6.42026/10/2911 天前
4.6.32026/10/2911 天前
4.6.22026/10/1922 天前
4.6.12026/10/1624 天前

关于 @codefresh-io/cf-telemetry 的常见问题

@codefresh-io/cf-telemetry 是什么?

Base utils for monitoring.

如何安装 @codefresh-io/cf-telemetry?

在项目目录运行 npm install @codefresh-io/cf-telemetry,或使用 pnpm add / yarn add / bun add。

@codefresh-io/cf-telemetry 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/codefresh-io__cf-telemetry 是否存在。

@codefresh-io/cf-telemetry 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@codefresh-io/cf-telemetry 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20 <=24。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@codefresh-io/cf-telemetry 可以商用吗?

@codefresh-io/cf-telemetry 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@codefresh-io/cf-telemetry 的下载量有多少?

根据 npm 官方下载统计,@codefresh-io/cf-telemetry 在 2026/10/10 – 2026/11/08 这 30 天内被下载 6,282 次,日均约 209 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@codefresh-io/cf-telemetry 还在维护吗?

最新版本 4.6.6 发布于 2026/11/09(今天);至今共发布 153 个版本,其中过去 12 个月发布了 74 个;首次发布于 2025/01/17。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。