I noticed that the `llm.chat.*_tokens` attributes weren't in spans, and it turns out none of the attributes from the wrapped function make it in. only those added synchronously from within `wrapWithSpan` do.
A few things in play here:
1. Switch from `ZoneContextManager` (which doesn't work with native async/await) to `AsyncLocalStorageContextManager` (which does.)
2. (1) requires we use a pnpm patch, since wrangler requires that we import `async_hooks` statically, and the otel code `requires` it, and also requires that it's spelled `node:async_hooks`.
3. encode the payload we try to send _before_ doing the retry loop, so we don't re-encode for each attempt.
4. switch from `startActiveSpan` to `context.with` + `startSpan`. The latter allows us to wrap an async function. the former is for synchronous functions.
Running the prior code in wrangler (but _not_ `npm run dev`) was generating errors during otel initialization. I was ultimately unable to figure out why, or how to fix them:
```
(warn) Initializing OpenTelemetry
(error) Error initializing OpenTelemetry TypeError: Class constructor OTLPExporterBase2 cannot be invoked without 'new'
```
In the end, it was easier to just boil the ocean a little: With claude's help, write a custom otlp exporter and use that. Also use BasicTracerProvider instead of WebTracerProvider.
This version is enough to generate spans from within local wrangler.
add some otel initialization, pointing at honeycomb + a function to wrap other functions with spans. use that function to wrap `callAnthropic` and add some context (number of messages sent, token usage, along with some metadata should we ever support other providers.)
The honeycomb api key/dataset are to be passed via env vars `HONEYCOMB_API_KEY` and `HONEYCOMB_DATASET` respectively.
* feat: Integrate AWS Bedrock with Claude 3.5 Sonnet, Claude 3 Sonnet, and Claude 3.5 Haiku
* update Dockerfile for AWS Bedrock configuration
* feat: add new Bedrock model 'Mistral' and update Haiku to version 3
* feat: add new bedrock model Nova Lite and Nova Pro
* Update README documentation to reflect the latest changes
* Add the icon for aws bedrock
* add support for serialized AWS Bedrock configuration in api key
* fix: updated logger and model caching
* usage token stream issue fix
* minor changes
* updated starter template change to fix the app title
* starter template bigfix
* fixed hydretion errors and raw logs
* removed raw log
* made auto select template false by default
* more cleaner logs and updated logic to call dynamicModels only if not found in static models
* updated starter template instructions
* browser console log improved for firefox
* provider icons fix icons