@conduit-client/service-instrumentation

中文文档
3.34.0发布于 2026/11/05SEE LICENSE IN LICENSE.txtTypeScriptESM + CJS近 30 天下载 4.2万

Luvio Instrumentation Service definition

原始使用文档
文档目录5 节
  1. Package Structure
  2. Installation
  3. Usage
  4. No-Op Implementation
  5. Adding to the interface

This software is provided as-is with no support provided.

Luvio Instrumentation Service

This package re-exports the instrumentation service interface types and implementations.

Package Structure

The instrumentation service is divided into the following packages:

This main package (-client/service-instrumentation) re-exports all the types and implementations to maintain backward compatibility.

Installation

npm install -client/service-instrumentation

Usage

// Using the noop implementation
import { buildNoopInstrumentationServiceDescriptor } from '@conduit-client/service-instrumentation/v1';

const noopService = buildNoopInstrumentationServiceDescriptor();

// Using the o11y implementation
import { buildO11yInstrumentationServiceDescriptor } from '@conduit-client/service-instrumentation/v1';
import { logger } from '@conduit-client/logger';

const o11yService = buildO11yInstrumentationServiceDescriptor(logger);

Instrumentation Service

We are about standards around here. OpenTelemetry is the standard. We are also about exposing what makes sense from their API for a library. We want to trace and record metrics. We want to log too, but that component is under development (as of March 2024), so for the sake of stability we will hold off on that.

No-Op Implementation

We provide a no-op implementation OOTB, so things run smoothly when an actual implementation is not provided.

Use buildNoopInstrumentationService when building out your services.

import { buildNoopInstrumentationService } from '@conduit-client/service-instrumentation/v1';

Aside: We originally tried using the no-op implementations provided by the OTel API, but it came with a cost of 7kb, which was a little rich for our taste, especially when this service exposes a relatively small subset of the API. I'm sure there is a way to scope it down, but for now we make due with our own

Adding to the interface

So you realized we have to have DiagAPI as part of the API? (We probably should add it at some point)

The process is pretty simple, albeit tedious (with the handrolling of a No-Op implementation and the unit-testing). What's important is that we are only pulling in the portion of the API that makes sense. For example, with the TraceAPI, setGlobalTracerProvider is the responsibility of the runtime application, and we shouldn't have the power to set it ourselves, so we leave that out. With that in mind, there are only a few steps to take.

  1. Create a type from the OTel API you'd like to include, use Pick<> to select what makes sense
  2. Add it to the service interface
  3. Create a No-Op implementation, along with unit tests to keep our code coverage happy
  4. Update the buildNoopInstrumentationService function we export with the service

Checkout this PR that adds the MetricsAPI to the service interface for guidance.

版本与发布记录

@conduit-client/service-instrumentation 共发布 74 个版本,首次发布于 2025/11/01;过去 12 个月发布了 71 个版本。

版本发布日期距今
3.34.0latest2026/11/055 天前
3.33.02026/10/2912 天前
3.32.12026/10/2219 天前
3.32.02026/10/1526 天前
3.31.02026/10/091 个月前
3.30.12026/10/091 个月前

其他发布通道:patch → 3.26.1-dev3。

关于 @conduit-client/service-instrumentation 的常见问题

@conduit-client/service-instrumentation 是什么?

Luvio Instrumentation Service definition

如何安装 @conduit-client/service-instrumentation?

在项目目录运行 npm install @conduit-client/service-instrumentation,或使用 pnpm add / yarn add / bun add。

@conduit-client/service-instrumentation 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@conduit-client/service-instrumentation 支持 ESM 还是 CommonJS?

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

@conduit-client/service-instrumentation 可以商用吗?

@conduit-client/service-instrumentation 使用 SEE LICENSE IN LICENSE.txt 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@conduit-client/service-instrumentation 的下载量有多少?

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

@conduit-client/service-instrumentation 还在维护吗?

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