Socket
Socket
Sign inDemoInstall

@opentelemetry/context-base

Package Overview
Dependencies
Maintainers
4
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/context-base

OpenTelemetry Base Context Manager


Version published
Weekly downloads
105K
decreased by-6.97%
Maintainers
4
Weekly downloads
 
Created

What is @opentelemetry/context-base?

@opentelemetry/context-base is a package that provides a base implementation for context management in OpenTelemetry. It allows for the creation, management, and propagation of context across different parts of an application, which is essential for distributed tracing and telemetry data collection.

What are @opentelemetry/context-base's main functionalities?

Creating a Context

This feature allows you to create a new context instance. Contexts are used to store and propagate data across different parts of an application.

const { BaseContext } = require('@opentelemetry/context-base');
const context = new BaseContext();
console.log(context);

Setting and Getting Values in Context

This feature allows you to set and get values in a context. This is useful for storing data that needs to be accessed across different parts of an application.

const { BaseContext } = require('@opentelemetry/context-base');
const context = new BaseContext();
const key = 'exampleKey';
const value = 'exampleValue';
const updatedContext = context.setValue(key, value);
console.log(updatedContext.getValue(key)); // Outputs: 'exampleValue'

Context Propagation

This feature demonstrates how context can be propagated across different functions or parts of an application. This is essential for maintaining state and data consistency in distributed systems.

const { BaseContext } = require('@opentelemetry/context-base');
const context = new BaseContext();
const key = 'exampleKey';
const value = 'exampleValue';
const updatedContext = context.setValue(key, value);
function someFunction(ctx) {
  console.log(ctx.getValue(key)); // Outputs: 'exampleValue'
}
someFunction(updatedContext);

Other packages similar to @opentelemetry/context-base

Keywords

FAQs

Package last updated on 08 Feb 2021

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc