Module @opentelemetry/core

OpenTelemetry Core

NPM Published Version Apache License

This package provides default implementations of the OpenTelemetry API for trace and metrics. It's intended for use both on the server and in the browser.

OpenTelemetry provides a text-based approach to propagate context to remote services using the W3C Trace Context HTTP headers.

const api = require("@opentelemetry/api");
const { W3CTraceContextPropagator } = require("@opentelemetry/core");

/* Set Global Propagator */
api.propagation.setGlobalPropagator(new W3CTraceContextPropagator());

Combines multiple propagators into a single propagator.

This is used as a default Propagator

const api = require("@opentelemetry/api");
const { CompositePropagator } = require("@opentelemetry/core");

/* Set Global Propagator */
api.propagation.setGlobalPropagator(new CompositePropagator());

Provides a text-based approach to propagate baggage to remote services using the OpenTelemetry Baggage Propagation HTTP headers.

const api = require("@opentelemetry/api");
const { W3CBaggagePropagator } = require("@opentelemetry/core");

/* Set Global Propagator */
api.propagation.setGlobalPropagator(new W3CBaggagePropagator());

Apache 2.0 - See LICENSE for more information.

Enumerations

ExportResultCode
RPCType

Classes

AnchoredClock
BindOnceFuture
CompositePropagator
TimeoutError
TraceState
W3CBaggagePropagator
W3CTraceContextPropagator

Interfaces

Clock
CompositePropagatorConfig
ExportResult
InstrumentationScope

Type Aliases

ErrorHandler
RPCMetadata

Variables

_globalThis
internal
otperformance
SDK_INFO
TRACE_PARENT_HEADER
TRACE_STATE_HEADER

Functions

addHrTimes
callWithTimeout
deleteRPCMetadata
diagLogLevelFromString
getBooleanFromEnv
getNumberFromEnv
getRPCMetadata
getStringFromEnv
getStringListFromEnv
getTimeOrigin
globalErrorHandler
hrTime
hrTimeDuration
hrTimeToMicroseconds
hrTimeToMilliseconds
hrTimeToNanoseconds
hrTimeToTimeStamp
isAttributeValue
isTimeInput
isTimeInputHrTime
isTracingSuppressed
isUrlIgnored
loggingErrorHandler
merge
millisToHrTime
parseKeyPairsIntoRecord
parseTraceParent
sanitizeAttributes
setGlobalErrorHandler
setRPCMetadata
suppressTracing
timeInputToHrTime
unrefTimer
unsuppressTracing
urlMatches