# @arizeai/openinference-instrumentation-beeai

**JavaScript · Instrumentation**

OpenInference Instrumentation for BeeAI framework

- **Version**: 1.6.6
- **Instruments**: `beeai-framework ^0.1.13`

[npm](https://www.npmjs.com/package/@arizeai/openinference-instrumentation-beeai) · [README](https://github.com/Arize-ai/openinference/blob/main/js/packages/openinference-instrumentation-beeai/README.md) · [Source](https://github.com/Arize-ai/openinference/tree/main/js/packages/openinference-instrumentation-beeai)

## Install

```sh
npm install @arizeai/openinference-instrumentation-beeai
```

## Usage

Register the instrumentation once, at startup, before the library is imported. The [`BeeAIInstrumentation`](https://openinf.dev/js/openinference-instrumentation-beeai.html.md#BeeAIInstrumentation) reference below lists its options.

```ts
import { registerInstrumentations } from "@opentelemetry/instrumentation";
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
import { BeeAIInstrumentation } from "@arizeai/openinference-instrumentation-beeai";

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

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

If the library is imported first (as ES modules often are), patch it directly with [`manuallyInstrument()`](https://openinf.dev/js/openinference-instrumentation-beeai.html.md#BeeAIInstrumentation.manuallyInstrument).

## `@arizeai/openinference-instrumentation-beeai`

### `isPatched`

_function_ · [Source](https://github.com/Arize-ai/openinference/blob/main/js/packages/openinference-instrumentation-beeai/src/instrumentation.ts#L33)

```typescript
function isPatched(): boolean
```

function to check if instrumentation is enabled / disabled

### `BeeAIInstrumentation`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/js/packages/openinference-instrumentation-beeai/src/instrumentation.ts#L37)

```typescript
class BeeAIInstrumentation extends InstrumentationBase
```

**Properties**

| Name | Type |
| - | - |
| [`tracer`](https://openinf.dev/js/openinference-instrumentation-beeai.html.md#BeeAIInstrumentation.tracer) | `Tracer` |

#### `new BeeAIInstrumentation`

_constructor_ · [Source](https://github.com/Arize-ai/openinference/blob/main/js/packages/openinference-instrumentation-beeai/src/instrumentation.ts#L42)

```typescript
new BeeAIInstrumentation(
  options?: {
    instrumentationConfig?: InstrumentationConfig;
    traceConfig?: TraceConfigOptions;
    tracerProvider?: TracerProvider;
  },
): BeeAIInstrumentation
```

**Parameters**

| Name | Type | Description |
| - | - | - |
| `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`

_method_ · [Source](https://github.com/Arize-ai/openinference/blob/main/js/packages/openinference-instrumentation-beeai/src/instrumentation.ts#L89)

```typescript
manuallyInstrument(module: __module): void
```

Manually instruments the BeeAI module. This is needed when the module is not loaded via require (commonjs)

#### `setTracerProvider`

_method_ · [Source](https://github.com/Arize-ai/openinference/blob/main/js/packages/openinference-instrumentation-beeai/src/instrumentation.ts#L109)

```typescript
setTracerProvider(tracerProvider: TracerProvider): void
```

Sets TraceProvider to this plugin
