@arizeai/openinference-instrumentation-bedrock

中文文档
0.5.6发布于 2026/10/30Apache-2.0TypeScriptESM + CJS构建来源已验证近 30 天下载 1.2万

OpenInference instrumentation for AWS Bedrock

原始使用文档
文档目录5 节
  1. Installation
  2. Usage
  3. Examples
  4. Using a Custom Tracer Provider
  5. Compatibility

OpenInference Instrumentation for AWS Bedrock JS SDK

npm version

This module provides automatic instrumentation for AWS Bedrock Runtime, which may be used in conjunction with @opentelemetry/sdk-trace-node.

Installation

npm install --save @arizeai/openinference-instrumentation-bedrock

Usage

To load the Bedrock instrumentation, specify it in the registerInstrumentations call along with any additional instrumentation you wish to enable.

const { NodeTracerProvider } = require("@opentelemetry/sdk-trace-node");
const { BedrockInstrumentation } = require("@arizeai/openinference-instrumentation-bedrock");
const { registerInstrumentations } = require("@opentelemetry/instrumentation");

const provider = new NodeTracerProvider();
provider.register();

registerInstrumentations({
  instrumentations: [new BedrockInstrumentation()],
});

Examples

To run an example, run the following commands:

cd js/packages/openinference-instrumentation-bedrock
pnpm install
pnpm -r build
npx tsx scripts/validate-invoke-model.ts # or validate-converse-comprehensive.ts

For more information on OpenTelemetry Node.js SDK, see the OpenTelemetry Node.js SDK documentation.

Using a Custom Tracer Provider

You can specify a custom tracer provider when creating the Bedrock instrumentation. This is useful when you want to use a non-global tracer provider or have more control over the tracing configuration.

import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
import { Resource } from "@opentelemetry/resources";
import { SEMRESATTRS_PROJECT_NAME } from "@arizeai/openinference-semantic-conventions";
import { BedrockInstrumentation } from "@arizeai/openinference-instrumentation-bedrock";
import { registerInstrumentations } from "@opentelemetry/instrumentation";

// Create a custom tracer provider
const customTracerProvider = new NodeTracerProvider({
  resource: new Resource({
    [SEMRESATTRS_PROJECT_NAME]: "my-bedrock-project",
  }),
});

// Pass the custom tracer provider to the instrumentation
const bedrockInstrumentation = new BedrockInstrumentation({
  tracerProvider: customTracerProvider,
});

// Register the instrumentation with the custom tracer provider
registerInstrumentations({
  instrumentations: [bedrockInstrumentation],
  tracerProvider: customTracerProvider,
});

Alternatively, you can set the tracer provider after creating the instrumentation:

const bedrockInstrumentation = new BedrockInstrumentation();
bedrockInstrumentation.setTracerProvider(customTracerProvider);

Compatibility

@arizeai/openinference-instrumentation-bedrock is compatible with the following versions of the @aws-sdk/client-bedrock-runtime package:

AWS SDK VersionOpenInference Instrumentation Version
^3.0.0^0.2.0

版本与发布记录

@arizeai/openinference-instrumentation-bedrock 共发布 39 个版本,首次发布于 2025/08/06;过去 12 个月发布了 31 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.5.6latest2026/10/309 天前
0.5.52026/10/2414 天前
0.5.42026/10/021 个月前
0.5.32026/10/021 个月前
0.5.22026/10/011 个月前
0.5.12026/09/191 个月前

关于 @arizeai/openinference-instrumentation-bedrock 的常见问题

@arizeai/openinference-instrumentation-bedrock 是什么?

OpenInference instrumentation for AWS Bedrock

如何安装 @arizeai/openinference-instrumentation-bedrock?

在项目目录运行 npm install @arizeai/openinference-instrumentation-bedrock,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@aws-sdk/client-bedrock-runtime(^3.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@arizeai/openinference-instrumentation-bedrock 支持 TypeScript 吗?

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

@arizeai/openinference-instrumentation-bedrock 支持 ESM 还是 CommonJS?

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

@arizeai/openinference-instrumentation-bedrock 可以商用吗?

@arizeai/openinference-instrumentation-bedrock 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@arizeai/openinference-instrumentation-bedrock 的下载量有多少?

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

@arizeai/openinference-instrumentation-bedrock 还在维护吗?

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