{"_id":"@ams3cf/vercel-otel","name":"@ams3cf/vercel-otel","dist-tags":{"latest":"1.10.2"},"versions":{"1.10.2":{"name":"@ams3cf/vercel-otel","version":"1.10.2","private":false,"publishConfig":{"access":"public"},"description":"Vercel wrapper around OpenTelemetry APIs","author":{"name":"Vercel Inc"},"license":"MIT","sideEffects":false,"type":"module","exports":{".":{"edge":{"types":"./dist/types/index.d.ts","default":"./dist/edge/index.js"},"edge-light":{"types":"./dist/types/index.d.ts","default":"./dist/edge/index.js"},"worker":{"types":"./dist/types/index.d.ts","default":"./dist/edge/index.js"},"workerd":{"types":"./dist/types/index.d.ts","default":"./dist/edge/index.js"},"import":{"types":"./dist/types/index.d.ts","default":"./dist/node/index.js"},"node":{"types":"./dist/types/index.d.ts","default":"./dist/node/index.js"},"types":"./dist/types/index.d.ts","default":"./dist/edge/index.js"}},"types":"./dist/types/index.d.ts","engines":{"node":">=18"},"dependencies":{},"devDependencies":{"@opentelemetry/api":"^1.7.0","@opentelemetry/api-logs":"^0.46.0","@opentelemetry/context-async-hooks":"^1.19.0","@opentelemetry/core":"^1.19.0","@opentelemetry/exporter-trace-otlp-http":"^0.46.0","@opentelemetry/instrumentation":"^0.46.0","@opentelemetry/otlp-exporter-base":"^0.46.0","@opentelemetry/otlp-proto-exporter-base":"^0.46.0","@opentelemetry/otlp-transformer":"^0.46.0","@opentelemetry/resources":"^1.19.0","@opentelemetry/sdk-logs":"^0.46.0","@opentelemetry/sdk-metrics":"^1.19.0","@opentelemetry/sdk-trace-base":"^1.19.0","@opentelemetry/semantic-conventions":"^1.19.0","@types/node":"18.15.11","esbuild":"^0.19.4","protobufjs":"^7.2.6","rimraf":"3.0.2","tsx":"^4.6.2","typedoc":"^0.25.8","typescript":"^5","vitest":"0.33.0","eslint-config":"1.0.0","typescript-config":"1.0.0"},"peerDependencies":{"@opentelemetry/api":"^1.7.0","@opentelemetry/api-logs":">=0.46.0 && <1.0.0","@opentelemetry/instrumentation":">=0.46.0 && <1.0.0","@opentelemetry/resources":"^1.19.0","@opentelemetry/sdk-logs":">=0.46.0 && <1.0.0","@opentelemetry/sdk-metrics":"^1.19.0","@opentelemetry/sdk-trace-base":"^1.19.0"},"scripts":{"build":"pnpm clean && pnpm tsx build.ts && pnpm build-types && pnpm build-site","build-only":"pnpm tsx build.ts","build-types":"tsc --noEmit false --declaration --emitDeclarationOnly --stripInternal --declarationDir dist/types src/index.ts","build-site":"pnpm build-typedoc && cp index.html LICENSE CHANGELOG.md dist-site","build-typedoc":"pnpm typedoc src/index.ts","clean":"rimraf dist && rimraf dist-site","eslint":"eslint-runner","eslint-fix":"eslint-runner --fix","type-check":"tsc --noEmit","unit-test":"vitest --run","unit-test-watch":"vitest"},"_id":"@ams3cf/vercel-otel@1.10.2","_integrity":"sha512-bouN4F4EDsB/2e2zF75rZ9VsMSkJarQB3mPMSnvPVGwQDh+T6ZbQDfZd94KBUqsPxhQg4zt9A/Y8wkCnd9n9LQ==","_resolved":"/tmp/fdaaedf01393009f7adab6d6afd2712a/ams3cf-vercel-otel-1.10.2.tgz","_from":"file:ams3cf-vercel-otel-1.10.2.tgz","_nodeVersion":"20.18.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-bouN4F4EDsB/2e2zF75rZ9VsMSkJarQB3mPMSnvPVGwQDh+T6ZbQDfZd94KBUqsPxhQg4zt9A/Y8wkCnd9n9LQ==","shasum":"0174436c9c9b71051127b328b64ba72c6e78bb45","tarball":"https://registry.npmjs.org/@ams3cf/vercel-otel/-/vercel-otel-1.10.2.tgz","fileCount":25,"unpackedSize":2043698,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIErtKmjPBNK4UxVT5mrAAZjf1ba8PdYq/H70+9Pf9CWLAiBjO7QHxO/IkxykYvo1mmnnvvRsh7reXYCSQ1OWApjxYw=="}]},"_npmUser":{"name":"ams3cf","email":"AMS3CF@GMAIL.COM"},"directories":{},"maintainers":[{"name":"ams3cf","email":"AMS3CF@GMAIL.COM"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vercel-otel_1.10.2_1737913457949_0.255763311139656"},"_hasShrinkwrap":false}},"time":{"created":"2025-01-26T17:44:17.847Z","1.10.2":"2025-01-26T17:44:18.229Z","modified":"2025-01-26T17:44:18.545Z"},"maintainers":[{"name":"ams3cf","email":"AMS3CF@GMAIL.COM"}],"description":"Vercel wrapper around OpenTelemetry APIs","author":{"name":"Vercel Inc"},"license":"MIT","readme":"# 🚀 Vercel Otel\n\n[![npm](https://img.shields.io/npm/v/@vercel/otel.svg)](https://www.npmjs.com/package/@vercel/otel)\n\n`@vercel/otel` is a simple and easy-to-use package that sets up your tracing configuration.\n\n💡 Use this package to quickly instrument your applications and get started with OpenTelemetry!\n\n## 📦 Installation\n\n```sh\nnpm install @vercel/otel\n```\n\n## 📚 Usage\n\nTo configure OpenTelemetry SDK, call the `registerOTel` in the `instrumentation.ts`:\n\n```javascript\nimport { registerOTel } from \"@vercel/otel\";\n\nexport function register() {\n  // Register the OpenTelemetry.\n  registerOTel(\"your-service-name\");\n}\n```\n\nTo create custom spans in your code, use the OpenTelemetry API:\n\n```javascript\nimport { trace } from \"@opentelemetry/api\";\n\n// Now you can use the OpenTelemetry APIs\nconst span = trace.getTracer(\"your-component\").startSpan(\"your-operation\");\n```\n\n## 📖 API Reference\n\n### `registerOTel(serviceName: string)`\n\nRegisters the OpenTelemetry SDK with the specified service name and the default configuration.\n\n- `serviceName`: The name of your service, used as the app name in many OpenTelemetry backends.\n\n### `registerOTel(config: Configuration)`\n\nRegisters the OpenTelemetry SDK with the specified configuration. Configuration options include:\n\n- `serviceName`: The name of your service, used as the app name in many OpenTelemetry backends.\n- `attributes`: The resource attributes. By default, `@vercel/otel` configures relevant Vercel attributes based on [the environment](https://vercel.com/docs/projects/environment-variables/system-environment-variables), such as `env`, `vercel.runtime`, `vercel.host`, etc.\n- `instrumentations`: A set of instrumentations. By default, `@vercel/otel` configures \"fetch\" instrumentation.\n- `instrumentationConfig`: Customize configuration for predefined instrumentations:\n  - `fetch`: Customize configuration of the predefined \"fetch\" instrumentation:\n    - `ignoreUrls`: A set of URL matchers (string prefix or regex) that should be ignored from tracing. By default all URLs are traced. Example: `fetch: { ignoreUrls: [/example.com/] }`.\n    - `propagateContextUrls`: A set of URL matchers (string prefix or regex) for which the tracing context should be propagated (see `propagators`). By default the context is propagated _only_ for the [deployment URLs](https://vercel.com/docs/deployments/generated-urls), all other URLs should be enabled explicitly. Example: `fetch: { propagateContextUrls: [ /my.api/ ] }`.\n    - `dontPropagateContextUrls`: A set of URL matchers (string prefix or regex) for which the tracing context should not be propagated (see `propagators`). This allows you to exclude a subset of URLs allowed by the `propagateContextUrls`.\n    - `resourceNameTemplate`: A string for the \"resource.name\" attribute that can include attribute expressions in `{}`. Example: `fetch: { resourceNameTemplate: \"{http.host}\" }`.\n    - The `fetch` instrumentation also allows the caller to pass relevant telemetry parameters via `fetch(..., { opentelemetry: {} })` argument (requires Next 14.1.1 or above), which may include the following fields:\n      - `ignore: boolean`: overrides `ignoreUrls` for this call.\n      - `propagateContext: boolean`: overrides `propagateContextUrls` for this call.\n      - `spanName: string`: overrides the computed span name for this call.\n      - `attributes: Attributes`: overrides the computed attributes for this call.\n- `propagators`: A set of propagators that may extend inbound and outbound contexts. By default, `@vercel/otel` configures [W3C Trace Context](https://www.w3.org/TR/trace-context/) propagator.\n- `traceSampler`: The sampler to be used to decide which requests should be traced. By default, all requests are traced. This option can be changed to, for instance, only trace 1% of all requests.\n- `spanProcessors` and `traceExporter`: The export mechanism for traces. By default, `@vercel/otel` configures the best export mechanism for the environment. For instance, if a [tracing integrations](https://vercel.com/docs/observability/otel-overview) is configured on Vercel, this integration will be automatically used for export; otherwise an [OTLP exporter](https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/#otlp-exporter) can be used if configured in environment variables.\n\nSee [API](https://otel.vercel.sh/api/) for more details.\n\n## 📝 Changelog\n\nSee [CHANGELOG.md](https://otel.vercel.sh/CHANGELOG.md).\n\n## 🔗 References\n\n- [OpenTelemetry Primer](https://opentelemetry.io/docs/concepts/observability-primer/)\n- [OpenTelemetry Environment Variables](https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/)\n- [Next.js OpenTelemetry docs](https://nextjs.org/docs/app/building-your-application/optimizing/open-telemetry)\n- [Vercel OpenTelemetry Collector](https://vercel.com/docs/observability/otel-overview)\n\n## 📄 License\n\n[MIT](https://otel.vercel.sh/LICENSE)\n\n---\n\nMade with 💖 by Vercel. Happy tracing! 📈\n","readmeFilename":"README.md"}