@opentelemetry/sdk-node
NodeSDKConfiguration.defaultAttributes
has been unused and was removed as the concept does not exist in OpenTelemetry anymore- Please use
NodeSDKConfiguration.resource
instead.
- Please use
@opentelemetry/sdk-node
changedawait start()
to now be synchronous@opentelemetry/sdk-node
changedawait detectResources()
to now be synchronous
@opentelemetry/exporter-trace-otlp-http
is now exportingscopeSpans
instead ofinstrumentationLibrarySpans
- this exporter now requires collector version
0.48
and up.
- this exporter now requires collector version
@opentelemetry/exporter-metrics-otlp-http
is now exportingscopeMetrics
instead ofinstrumentationLibraryMetrics
- this exporter now requires collector version
0.48
and up.
- this exporter now requires collector version
- In
@opentelemetry/exporter-trace-otlp-http
,OTLPExporterBase._isShutdown
is replaced with_shutdownOnce
.
Metric and trace exporters are split into separate packages:
@opentelemetry/exporter-otlp-http
=>@opentelemetry/exporter-trace-otlp-http
and@opentelemetry/exporter-metrics-otlp-http
@opentelemetry/exporter-otlp-grpc
=>@opentelemetry/exporter-trace-otlp-grpc
and@opentelemetry/exporter-metrics-otlp-grpc
@opentelemetry/exporter-otlp-proto
=>@opentelemetry/exporter-trace-otlp-proto
and@opentelemetry/exporter-metrics-otlp-proto
Metric types are renamed:
@openetelemetry/api-metrics
Meter
createValueRecorder
=>createHistogram
createValueObserver
=>createObservableGauge
createSumObserver
=>createObservableCounter
createUpDownSumObserver
=>createObservableUpDownCounter
ValueRecorder
=>Histogram
ValueObserver
=>ObservableGauge
SumObserver
=>ObservableCounter
UpDownSumObserver
=>ObservableUpDownCounter
ObserverResult
=>ObservableResult
Observation.observer
=>Observation.observable
@opentelemetry/sdk-metrics-base
MetricKind
VALUE_RECORDER
=>HISTOGRAM
SUM_OBSERVER
=>OBSERVABLE_COUNTER
UP_DOWN_SUM_OBSERVER
=>OBSERVABLE_UP_DOWN_COUNTER
VALUE_OBSERVER
=>OBSERVABLE_GAUGE
Collector exporter packages and types are renamed:
@opentelemetry/exporter-collector
=>@opentelemetry/exporter-otlp-http
CollectorExporterBase
=>OTLPExporterBase
CollectorTraceExporter
=>OTLPTraceExporter
CollectorMetricExporter
=>OTLPMetricExporter
CollectorExporterBrowserBase
=>OTLPExporterBrowserBase
CollectorExporterNodeBase
=>OTLPExporterNodeBase
CollectorExporterConfigBase
=>OTLPExporterConfigBase
CollectorExporterError
=>OTLPExporterError
COLLECTOR_SPAN_KIND_MAPPING
=>OTLP_SPAN_KIND_MAPPING
collectorTypes
=>otlpTypes
@opentelemetry/exporter-collector-grpc
=>@opentelemetry/exporter-otlp-grpc
CollectorTraceExporter
=>OTLPTraceExporter
CollectorMetricExporter
=>OTLPMetricExporter
CollectorExporterConfigNode
=>OTLPExporterConfigNode
@opentelemetry/exporter-collector-proto
=>@opentelemetry/exporter-otlp-proto
CollectorExporterNodeBase
=>OTLPExporterNodeBase
CollectorMetricExporter
=>OTLPMetricExporter
CollectorTraceExporter
=>OTLPTraceExporter
- W3C propagators in @opentelemetry/core were renamed
HttpTraceContextPropagator
->W3CTraceContextPropagator
HttpBaggagePropagator
->W3CBaggagePropagator
- SDKs packages for trace and metrics has been renamed to have a consistent naming schema:
- @opentelemetry/tracing -> @opentelemetry/sdk-trace-base
- @opentelemetry/node -> @opentelemetry/sdk-trace-node
- @opentelemetry/web -> @opentelemetry/sdk-trace-web
- @opentelemetry/metrics -> @opentelemetry/sdk-metrics-base
- @opentelemetry/node-sdk -> @opentelemetry/sdk-node
ResourceAttributes
renamed toSemanticResourceAttributes
in the@opentelemetry/semantic-conventions
package
-
HttpBaggage
renamed toHttpBaggagePropagator
-
HttpTraceContext
renamed toHttpTraceContextPropagator
-
JaegerHttpTracePropagator
renamed toJaegerPropagator
-
serviceName
configuration removed from Collector exporters. Useservice.name
Resource attribute instead. -
Prometheus exporter added suffix
_total
to counter metrics.
-
API is now a peer dependency. This means that users will need to include
@opentelemetry/api
as a dependency of their project in order to use the SDK. NPM version 7+ (Node 15+) should do this automatically. -
All plugins have been removed in favor of instrumentations.
-
The
@opentelemetry/propagator-b3
package previously exported three propagators:B3Propagator
,B3SinglePropagator
, andB3MultiPropagator
, but now only exports theB3Propagator
. It extracts b3 context in single and multi-header encodings, and injects context using the single-header encoding by default, but can be configured to inject context using the multi-header encoding during construction:new B3Propagator({ injectEncoding: B3InjectEncoding.MULTI_HEADER })
. If you were previously using theB3SinglePropagator
orB3MultiPropagator
directly, you should update your code to use theB3Propagator
with the appropriate configuration. See the README for full details and usage. -
Sampling configuration via environment variable has changed. If you were using
OTEL_SAMPLING_PROBABILITY
then you should replace it withOTEL_TRACES_SAMPLER=parentbased_traceidratio
andOTEL_TRACES_SAMPLER_ARG=<number>
where<number>
is a number in the [0..1] range, e.g. "0.25". Default is 1.0 if unset.
diag.setLogLevel
is removed and LogLevel can be set by an optional second parameter tosetLogger
- Breaking change - The resulting resource MUST have all attributes that are on any of the two input resources. If a key exists on both the old and updating resource, the value of the updating resource MUST be picked - previously it was opposite.
PR-1880 feat(diag-logger): introduce a new global level api.diag for internal diagnostic logging
PR-1925 feat(diag-logger): part 2 - breaking changes - remove api.Logger, api.NoopLogger, core.LogLevel, core.ConsoleLogger
- These PR's remove the previous
Logger
andLogLevel
implementations and change the way you should use the replacementDiagLogger
andDiagLogLevel
, below are simple examples of how to change your existing usages.
The new global api.diag
provides the ability to set the global diagnostic logger setLogger()
and logging level setLogLevel()
, it is also a DiagLogger
implementation and should be directly to log diagnostic messages.
All included logger references have been removed in preference to using the global api.diag
directly, so you no longer need to pass around the logger instance via function parameters or included as part of the configuration for a component.
import { diag, DiagConsoleLogger, DiagLogLevel } from "@opentelemetry/api";
// Setting the default Global logger to use the Console
// And optionally change the logging level (Defaults to INFO)
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ERROR)
import { diag } from "@opentelemetry/api";
// Remove or make optional the parameter and don't use it.
export function MyFunction() {
diag.debug("...");
diag.info("...");
diag.warn("...");
diag.error("...");
diag.verbose("..");
}
import { diag } from "@opentelemetry/api";
diag.setLogger();
PR-1855 Use instrumentation loader to load plugins and instrumentations
- Providers do no load the plugins anymore. Also PluginLoader has been removed from providers, use
registerInstrumentations
instead
//Previously in node
const provider = new NodeTracerProvider({
plugins: {
'@grpc/grpc-js': {
enabled: true,
path: '@opentelemetry/plugin-grpc-js',
},
}
});
// Now
const provider = new NodeTracerProvider();
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
registerInstrumentations({
instrumentations: [
{
plugins: {
'@grpc/grpc-js': {
enabled: true,
path: '@opentelemetry/plugin-grpc-js',
},
}
}
],
tracerProvider: provider,
});
// or if you want to load only default instrumentations / plugins
registerInstrumentations({
tracerProvider: provider,
});
//Previously in browser
const provider = new WebTracerProvider({
plugins: [
new DocumentLoad()
]
});
// Now
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const provider = new WebTracerProvider();
registerInstrumentations({
instrumentations: [
new DocumentLoad(),
],
});
registerInstrumentations
supports loading old plugins and instrumentations together. It also supports setting tracer provider and meter provider on instrumentations
PR-1874 More specific API type names
Some types exported from "@opentelemetry/api"
have been changed to be more specific.
AttributeValue
renamed toSpanAttributeValue
Attributes
renamed toSpanAttributes
EntryTtl
renamed toBaggageEntryTtl
EntryValue
renamed toBaggageEntryValue
Status
renamed toSpanStatus
StatusCode
renamed toSpanStatusCode
PR-1863 removed public attributes keepAlive
and httpAgentOptions
from Node.js CollectorTraceExporter
and CollectorMetricExporter
PR-1764 removed some APIs from Tracer
:
Tracer.getCurrentSpan()
: useapi.getSpan(api.context.active())
Tracer.withSpan(span)
: useapi.context.with(api.setSpan(api.context.active(), span))
Tracer.bind(target)
: useapi.context.bind(target)
PR-1797 chore!: split metrics into its own api package:
- Any references to
require("@opentelemetry/api").metrics
will need to be changed torequire("@opentelemetry/api-metrics").metrics
PR-1725 Use new gRPC default port
- The default port used by
@opentelemetry/exporter-collector-grpc
is changed from55680
to4317
PR-1749 chore: improve naming of span related context APIs
- Rename
[gs]etActiveSpan()
to[gs]etSpan()
- Rename
setExtractedSpanContext()
tosetSpanContext()
- Rename
getParentSpanContext()
togetSpanContext()