JavaScript APIbedrock-agent-runtime

Core

Instrumentation

Integrations

JavaScript · Instrumentation

@arizeai/openinference-instrumentation-bedrock-agent-runtime

OpenInference instrumentation for AWS Bedrock Agent Runtime

Version
1.2.8
Instruments
@aws-sdk/client-bedrock-agent-runtime ^3.0.0

Install

npm install @arizeai/openinference-instrumentation-bedrock-agent-runtime

Usage

Register the instrumentation once, at startup, before the library is imported. The BedrockAgentInstrumentation reference below lists its options.

import { registerInstrumentations } from "@opentelemetry/instrumentation";
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
import { BedrockAgentInstrumentation } from "@arizeai/openinference-instrumentation-bedrock-agent-runtime";

const provider = new NodeTracerProvider({
  // ...a span processor that exports to Phoenix or any OTLP backend.
});
provider.register();

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

If the library is imported first (as ES modules often are), patch it directly with manuallyInstrument().

@arizeai/openinference-instrumentation-bedrock-agent-runtime

isPatched

functionSource ↗
function isPatched(): boolean

BedrockAgentInstrumentation

classSource ↗
class BedrockAgentInstrumentation extends InstrumentationBase<InstrumentationConfig>

Properties

NameType
tracerTracer

new BedrockAgentInstrumentation

constructorSource ↗
new BedrockAgentInstrumentation(
  options?: {
    instrumentationConfig?: InstrumentationConfig;
    traceConfig?: TraceConfigOptions;
    tracerProvider?: TracerProvider;
  },
): BedrockAgentInstrumentation

Parameters

NameTypeDescription
instrumentationConfig?InstrumentationConfig

The config for the instrumentation

traceConfig?TraceConfigOptions

The OpenInference trace configuration. Can be used to mask or redact sensitive information on spans.

tracerProvider?TracerProvider

An optional custom trace provider to be used for tracing. If not provided, a tracer will be created using the global tracer provider. This is useful if you want to use a non-global tracer provider.

manuallyInstrument

methodSource ↗
manuallyInstrument(module: __module): void

Manually patches the BedrockAgentRuntimeClient, this allows for guaranteed patching of the module when import order is hard to control.

setTracerProvider

methodSource ↗
setTracerProvider(tracerProvider: TracerProvider): void

Sets TraceProvider to this plugin