Socket
Book a DemoInstallSign in
Socket

@jahands/otel-cf-workers

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jahands/otel-cf-workers

Re-packaged version of @microlabs/otel-cf-workers bundled with @opentelemetry/api to work around vitest issues

latest
Source
npmnpm
Version
0.1.25
Version published
Maintainers
1
Created
Source

@jahands/otel-cf-workers

A bundled version of @microlabs/otel-cf-workers to work around issues with @cloudflare/vitest-pool-workers

IMPORTANT

Please note that this is primarily intended for my own use. You may want to copy this package to your own repo rather than depending on this library directly.

Usage

Install

# Install using your favorite package manager:
npm install @jahands/otel-cf-workers
pnpm add @jahands/otel-cf-workers
bun add @jahands/otel-cf-workers
yarn add @jahands/otel-cf-workers

Example

import { instrument, ResolveConfigFn, trace } from '@jahands/otel-cf-workers'

export interface Env {
  HONEYCOMB_API_KEY: string
  OTEL_TEST: KVNamespace
}

const handler = {
  async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
    await fetch('https://cloudflare.com')

    const greeting = "G'day World"
    trace.getActiveSpan()?.setAttribute('greeting', greeting)
    ctx.waitUntil(fetch('https://workers.dev'))
    return new Response(`${greeting}!`)
  }
}

const config: ResolveConfigFn = (env: Env, _trigger) => {
  return {
    exporter: {
      url: 'https://api.honeycomb.io/v1/traces',
      headers: { 'x-honeycomb-team': env.HONEYCOMB_API_KEY }
    },
    service: { name: 'greetings' }
  }
}

export default instrument(handler, config)

For more details, refer to documentation in @microlabs/otel-cf-workers

Keywords

cloudflare workers

FAQs

Package last updated on 21 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts