# @monocle.sh/otel-utils

Shared OpenTelemetry utilities used internally by Monocle packages (`@monocle.sh/adonisjs-agent`, `@monocle.sh/instrumentation-mcp`).

## Installation

```bash
npm install @monocle.sh/otel-utils
```

## What's Included

- **ExceptionReporter** — reports exceptions on OTel spans with serialized error data
- **ErrorSerializer** — converts errors into structured OTel span attributes (type, message, stack)
- **Context Lines** — extracts source code context around stack frames for richer error reports

## Usage

```ts
import { ExceptionReporter } from '@monocle.sh/otel-utils'

const reporter = new ExceptionReporter()

// Report an error on the active span
reporter.reportSync({ span, error, shouldReport: true })
```

## License

ISC
