Socket
Socket
Sign inDemoInstall

@vercel/otel

Package Overview
Dependencies
Maintainers
8
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vercel/otel

Vercel wrapper around OpenTelemetry APIs


Version published
Weekly downloads
97K
decreased by-6.31%
Maintainers
8
Weekly downloads
 
Created
Source

🚀 Vercel Otel

npm

Note: This package is experimental. It doesn't follow semver yet. Minors can contain breaking changes.

@vercel/otel is a simple and easy-to-use package that sets up your trace provider and exporter.

💡 Use this package to quickly instrument your applications and get started with OpenTelemetry!

📦 Installation

npm install @vercel/otel

📚 Usage

import { registerOTel } from "@vercel/otel";
import { trace } from "@opentelemetry/api";

// Register the OpenTelemetry provider with an GRPC exporter
registerOTel("your-service-name");

// Now you can use the OpenTelemetry APIs
const span = trace.getTracer("your-component").startSpan("your-operation");

📖 API Reference

registerOTel(serviceName: string)

Registers the OpenTelemetry provider with an OTLP exporter using the given service name. This is all that is needed to trace your app on Vercel or any other platform exposing its own OpenTelemetry Collector.

  • serviceName: The name of your service, used as the app name in many OpenTelemetry backends.

🧪 What exactly is this package doing

This package utilizes the exports API, enabling us to import the OpenTelemetry SDK in Node only. When you import registerOTel in a file intended for the edge, it returns an empty function because OpenTelemetry doesn't support the edge. However, if you import the same function in a file designed for Node, you'll receive a standard function that sets up the OpenTelemetry SDK correctly.

The OpenTelemetry SDK initialization itself is straightforward. For more details, please see the code.

📄 License

MIT


Made with 💖 by Vercel. Happy tracing! 📈

FAQs

Package last updated on 27 Apr 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc