-
Bug fix: ObservableGauge returns data points recorded since previous collection, despite temporality. Other asynchronous (observable) instruments with Cumulative temporality behave as synchronous ones and return data points on every collection. #2213
-
Feature: Introduced a new feature flag,
experimental_metrics_disable_name_validation
, under theopentelemetry-sdk
, which allows disabling the Instrument Name Validation. This is useful in scenarios where you need to use special characters, Windows Perf Counter Wildcard Path, or similar cases. For more details, check #2543.WARNING: While this feature provides flexibility, be cautious when using it, as platforms like Prometheus impose restrictions on metric names and labels (e.g., no spaces, capital letters, or certain special characters). Using invalid characters may result in compatibility issues or incorrect behavior. Ensure that instrument names comply with the requirements of your target platform to avoid potential problems.
-
Breaking(Affects custom metric exporter authors only)
start_time
andtime
is moved from DataPoints to aggregations (Sum, Gauge, Histogram, ExpoHistogram) see #2377 and #2411, to reduce memory. -
Breaking
start_time
is no longer optional forSum
aggregation, see #2367, but is still optional forGauge
aggregation see #2389. -
Breaking
- SimpleLogProcessor modified to be generic over
LogExporter
to avoid dynamic dispatch to invoke exporter. If you were usingwith_simple_exporter
to addLogExporter
with SimpleLogProcessor, this is a transparent change. #2338 ResourceDetector.detect()
no longer supports timeout option.opentelemetry::global::shutdown_tracer_provider()
removed from the API, should now usetracer_provider.shutdown()
see #2369 for a migration example. "Tracer provider" is cheaply clonable, so users are encouraged to set a clone of it as the global (ex:global::set_tracer_provider(provider.clone()))
, so that instrumentations and other components can obtain tracers fromglobal::tracer()
. The tracer_provider must be kept around to call shutdown on it at the end of application (ex:tracer_provider.shutdown()
)
- SimpleLogProcessor modified to be generic over
-
Feature: Add
ResourceBuilder
for an easy way to create newResource
s -
Breaking: Remove
Resource::{new,empty,from_detectors,new_with_defaults,from_schema_url,merge,default}
from public api. To create Resources you should only useResource::builder()
orResource::builder_empty()
. See #2322 for a migration guide. Example Usage:// old Resource::default().with_attributes([ KeyValue::new("service.name", "test_service"), KeyValue::new("key", "value"), ]); // new Resource::builder() .with_service_name("test_service") .with_attribute(KeyValue::new("key", "value")) .build();
-
Breaking The LogExporter::export() method no longer requires a mutable reference to self.: Before: async fn export(&mut self, batch: LogBatch<'>) -> LogResult<()> After: async fn export(&self, batch: LogBatch<'>) -> LogResult<()> Custom exporters will need to internally synchronize any mutable state, if applicable.
-
Breaking Removed the following deprecated struct:
- logs::LogData - Previously deprecated in version 0.27.1 Migration Guidance: This structure is no longer utilized within the SDK, and users should not have dependencies on it.
-
Breaking Removed the following deprecated methods:
Logger::provider()
: Previously deprecated in version 0.27.1Logger::instrumentation_scope()
: Previously deprecated in version 0.27.1. Migration Guidance: - These methods were intended for log appenders. Keep the clone of the provider handle, instead of depending on above methods.
-
Breaking -
PeriodicReader
UpdatesPeriodicReader
no longer requires an async runtime by default. Instead, it now creates its own background thread for execution. This change allows metrics to be used in environments without async runtimes.For users who prefer the previous behavior of relying on a specific
Runtime
, they can do so by enabling the feature flagexperimental_metrics_periodicreader_with_async_runtime
.Migration Guide:
- Default Implementation, requires no async runtime (Recommended) The new default implementation does not require a runtime argument. Replace the builder method accordingly: Before:
let reader = opentelemetry_sdk::metrics::PeriodicReader::builder(exporter, runtime::Tokio).build(); ``` *After:* ```rust let reader = opentelemetry_sdk::metrics::PeriodicReader::builder(exporter).build();
The new PeriodicReader can be used with OTLP Exporter, and supports following exporter features:
grpc-tonic
: This requiresMeterProvider
to be created within a tokio runtime.reqwest-blocking-client
: Works with a regularmain
ortokio::main
.
In other words, other clients like
reqwest
andhyper
are not supported.
-
Async Runtime Support If your application cannot spin up new threads or you prefer using async runtimes, enable the "experimental_metrics_periodicreader_with_async_runtime" feature flag and adjust code as below.
-
Before:
let reader = opentelemetry_sdk::metrics::PeriodicReader::builder(exporter, runtime::Tokio).build();
-
After:
let reader = opentelemetry_sdk::metrics::periodic_reader_with_async_runtime::PeriodicReader::builder(exporter, runtime::Tokio).build();
Requirements:
- Enable the feature flag:
experimental_metrics_periodicreader_with_async_runtime
. - Continue enabling one of the async runtime feature flags:
rt-tokio
,rt-tokio-current-thread
, orrt-async-std
.
Feature flag "experimental_metrics_periodic_reader_no_runtime" is removed as the PeriodicReader offered under that feature flag is now the default.
-
-
Bump msrv to 1.75.0.
-
Breaking : #2314
- The LogRecord struct has been updated:
- All fields are now pub(crate) instead of pub.
- Getter methods have been introduced to access field values.
This change impacts custom exporter and processor developers by requiring updates to code that directly accessed LogRecord fields. They must now use the provided getter methods (e.g.,
log_record.event_name()
instead oflog_record.event_name
).
- The LogRecord struct has been updated:
-
Upgrade the tracing crate used for internal logging to version 0.1.40 or later. This is necessary because the internal logging macros utilize the name field as metadata, a feature introduced in version 0.1.40. #2418
-
Breaking -
BatchLogProcessor
Updates #2436BatchLogProcessor
no longer requires an async runtime by default. Instead, a dedicated background thread is created to do the batch processing and exporting.For users who prefer the previous behavior of relying on a specific
Runtime
, they can do so by enabling the feature flagexperimental_logs_batch_log_processor_with_async_runtime
.
-
Default Implementation, requires no async runtime (Recommended) The new default implementation does not require a runtime argument. Replace the builder method accordingly:
-
Before:
let logger_provider = LoggerProvider::builder() .with_log_processor(BatchLogProcessor::builder(exporter, runtime::Tokio).build()) .build();
-
After:
let logger_provider = LoggerProvider::builder() .with_log_processor(BatchLogProcessor::builder(exporter).build()) .build();
The new BatchLogProcessor can be used with OTLP Exporter, and supports following exporter features:
grpc-tonic
: This requiresMeterProvider
to be created within a tokio runtime.reqwest-blocking-client
: Works with a regularmain
ortokio::main
.
In other words, other clients like
reqwest
andhyper
are not supported. -
-
Async Runtime Support If your application cannot spin up new threads or you prefer using async runtimes, enable the "experimental_logs_batch_log_processor_with_async_runtime" feature flag and adjust code as below.
-
Before:
let logger_provider = LoggerProvider::builder() .with_log_processor(BatchLogProcessor::builder(exporter, runtime::Tokio).build()) .build();
-
After:
let logger_provider = LoggerProvider::builder() .with_log_processor(log_processor_with_async_runtime::BatchLogProcessor::builder(exporter, runtime::Tokio).build()) .build();
Requirements:
- Enable the feature flag:
experimental_logs_batch_log_processor_with_async_runtime
. - Continue enabling one of the async runtime feature flags:
rt-tokio
,rt-tokio-current-thread
, orrt-async-std
.
-
-
Breaking -
BatchSpanProcessor
Updates #2435BatchSpanProcessor
no longer requires an async runtime by default. Instead, a dedicated background thread is created to do the batch processing and exporting.For users who prefer the previous behavior of relying on a specific
Runtime
, they can do so by enabling the feature flagexperimental_trace_batch_span_processor_with_async_runtime
.
-
Default Implementation, requires no async runtime (Recommended) The new default implementation does not require a runtime argument. Replace the builder method accordingly:
-
Before:
let tracer_provider = TracerProvider::builder() .with_span_processor(BatchSpanProcessor::builder(exporter, runtime::Tokio).build()) .build();
-
After:
let tracer_provider = TracerProvider::builder() .with_span_processor(BatchSpanProcessor::builder(exporter).build()) .build();
This implementation does not support multiple concurrent exports (
with_max_concurrent_exports
is not supported).
The new BatchLogProcessor can be used with OTLP Exporter, and supports following exporter features:
grpc-tonic
: This requiresMeterProvider
to be created within a tokio runtime.reqwest-blocking-client
: Works with a regularmain
ortokio::main
.
In other words, other clients like
reqwest
andhyper
are not supported. -
-
Async Runtime Support If your application cannot spin up new threads or you prefer using async runtimes, enable the "experimental_trace_batch_span_processor_with_async_runtime" feature flag and adjust code as below.
-
Before:
let tracer_provider = TracerProvider::builder() .with_span_processor(BatchSpanProcessor::builder(exporter, runtime::Tokio).build()) .build();
-
After:
let tracer_provider = TracerProvider::builder() .with_span_processor(span_processor_with_async_runtime::BatchSpanProcessor::builder(exporter, runtime::Tokio).build()) .build();
Requirements:
- Enable the feature flag:
experimental_trace_batch_span_processor_with_async_runtime
. - Continue enabling one of the async runtime feature flags:
rt-tokio
,rt-tokio-current-thread
, orrt-async-std
.
-
-
Bug fix: Empty Tracer names are retained as-is instead of replacing with "rust.opentelemetry.io/sdk/tracer" #2486
-
Update
EnvResourceDetector
to allow resource attribute values containing equal signs ("="
). #2120 -
Breaking Introduced
experimental_async_runtime
feature for runtime-specific traits.- Runtime-specific features (
rt-tokio
,rt-tokio-current-thread
, andrt-async-std
) now depend on theexperimental_async_runtime
feature. - For most users, no action is required. Enabling runtime features such as
rt-tokio
,rt-tokio-current-thread
, orrt-async-std
will automatically enable theexperimental_async_runtime
feature. - If you're implementing a custom runtime, you must explicitly enable the experimental_async_runtime
feature in your Cargo.toml and implement the required
Runtime` traits.
- Runtime-specific features (
-
Removed Metrics Cardinality Limit feature. This was originally introduced in #1066 with a hardcoded limit of 2000 and no ability to change it. This feature will be re-introduced in a future date, along with the ability to change the cardinality limit.
-
Breaking Removed unused
opentelemetry_sdk::Error
enum. -
Breaking Resource.get() modified to require reference to Key instead of owned. Replace
get(Key::from_static_str("key"))
withget(&Key::from_static_str("key"))
-
Breaking (Affects custom Exporter authors only) Moved
ExportError
trait fromopentelemetry::export::ExportError
toopentelemetry_sdk::ExportError
-
Breaking (Affects custom SpanExporter, SpanProcessor authors only): Rename namespaces for Span exporter structs/traits before:
opentelemetry_sdk::export::spans::{ExportResult, SpanData, SpanExporter};
now:opentelemetry_sdk::spans::{ExportResult, SpanData, SpanExporter};
-
Breaking (Affects custom LogExporter, LogProcessor authors only): Rename namespaces for Log exporter structs/traits. before:
opentelemetry_sdk::export::logs::{ExportResult, LogBatch, LogExporter};
now:opentelemetry_sdk::logs::{ExportResult, LogBatch, LogExporter};
-
Breaking
opentelemetry_sdk::LogRecord::default()
method is removed. The only way to create log record outside opentelemetry_sdk crate is usingLogger::create_log_record()
method. -
Rename
opentelemetry_sdk::logs::Builder
toopentelemetry_sdk::logs::LoggerProviderBuilder
. -
Rename
opentelemetry_sdk::trace::Builder
toopentelemetry_sdk::trace::SdkTracerProviderBuilder
. -
Breaking: Rename namespaces for InMemoryExporters. (The module is still under "testing" feature flag) before:
opentelemetry_sdk::testing::logs::{InMemoryLogExporter, InMemoryLogExporterBuilder};
opentelemetry_sdk::testing::trace::{InMemorySpanExporter, InMemorySpanExporterBuilder};
opentelemetry_sdk::testing::metrics::{InMemoryMetricExporter, InMemoryMetricExporterBuilder};
now:opentelemetry_sdk::logs::{InMemoryLogExporter, InMemoryLogExporterBuilder};
opentelemetry_sdk::trace::{InMemorySpanExporter, InMemorySpanExporterBuilder};
opentelemetry_sdk::metrics::{InMemoryMetricExporter, InMemoryMetricExporterBuilder};
-
Breaking: The
BatchLogProcessor
no longer supports configuration ofmax_export_timeout
or theOTEL_BLRP_EXPORT_TIMEOUT
environment variable. Timeout handling is now the responsibility of the exporter. For example, in the OTLP Logs exporter, the export timeout can be configured using: -
The environment variables
OTEL_EXPORTER_OTLP_TIMEOUT
orOTEL_EXPORTER_OTLP_LOGS_TIMEOUT
. -
The opentelemetry_otlp API, via
.with_tonic().with_timeout()
or.with_http().with_timeout()
.
Before:
let processor = BatchLogProcessor::builder(exporter)
.with_batch_config(
BatchConfigBuilder::default()
.with_max_queue_size(2048)
.with_max_export_batch_size(512)
.with_scheduled_delay(Duration::from_secs(5))
.with_max_export_timeout(Duration::from_secs(30)) // Previously configurable
.build(),
)
.build();
After:
let processor = BatchLogProcessor::builder(exporter)
.with_batch_config(
BatchConfigBuilder::default()
.with_max_queue_size(2048)
.with_max_export_batch_size(512)
.with_scheduled_delay(Duration::from_secs(5)) // No `max_export_timeout`
.build(),
)
.build();
-
Breaking: The
BatchSpanProcessor
no longer supports configuration ofmax_export_timeout
or theOTEL_BLRP_EXPORT_TIMEOUT
environment variable. Timeout handling is now the responsibility of the exporter. For example, in the OTLP Span exporter, the export timeout can be configured using:- The environment variables
OTEL_EXPORTER_OTLP_TIMEOUT
orOTEL_EXPORTER_OTLP_TRACES_TIMEOUT
. - The opentelemetry_otlp API, via
.with_tonic().with_timeout()
or.with_http().with_timeout()
.
Before:
- The environment variables
let processor = BatchSpanProcessor::builder(exporter)
.with_batch_config(
BatchConfigBuilder::default()
.with_max_queue_size(2048)
.with_max_export_batch_size(512)
.with_scheduled_delay(Duration::from_secs(5))
.with_max_export_timeout(Duration::from_secs(30)) // Previously configurable
.build(),
)
.build();
After:
let processor = BatchSpanProcessor::builder(exporter)
.with_batch_config(
BatchConfigBuilder::default()
.with_max_queue_size(2048)
.with_max_export_batch_size(512)
.with_scheduled_delay(Duration::from_secs(5)) // No `max_export_timeout`
.build(),
)
.build();
-
Breaking: The
PeriodicReader
no longer supports configuration of export timeout usingwith_timeout
API method. Timeout handling is now the responsibility of the exporter.For example, in the OTLP Metrics exporter, the export timeout can be configured using:
- The environment variables
OTEL_EXPORTER_OTLP_TIMEOUT
orOTEL_EXPORTER_OTLP_METRICS_TIMEOUT
. - The
opentelemetry_otlp
API, via.with_tonic().with_timeout()
or.with_http().with_timeout()
.
- The environment variables
-
Breaking
-
The public API changes in the Tracing:
- Before:
fn SpanExporter::export(&mut self, batch: Vec<SpanData>) -> BoxFuture<'static, ExportResult>; fn SpanExporter::shutdown(&mut self); fn SpanExporter::force_flush(&mut self) -> BoxFuture<'static, ExportResult> fn TraerProvider::shutdown(&self) -> TraceResult<()> fn TracerProvider::force_flush(&self) -> Vec<TraceResult<()>>
- After:
fn SpanExporter::export(&mut self, batch: Vec<SpanData>) -> BoxFuture<'static, OTelSdkResult>; fn SpanExporter::shutdown(&mut self) -> OTelSdkResult; fn SpanExporter::force_flush(&mut self) -> BoxFuture<'static, OTelSdkResult> fn TraerProvider::shutdown(&self) -> OTelSdkResult; fn TracerProvider::force_flush(&self) -> OTelSdkResult;
- Before:
-
Breaking Renamed
LoggerProvider
,Logger
andLogRecord' to
SdkLoggerProvider,
SdkLoggerand
SdkLogRecord` respectively to avoid name collision with public API types. #2612 -
Breaking Renamed
TracerProvider
andTracer
toSdkTracerProvider
andSdkTracer
to avoid name collision with public API types.Tracer
is still type-aliased toSdkTracer
to keep back-compat with tracing-opentelemetry. #2614
Released 2024-Nov-27
-
DEPRECATED:
-
trace::Config
methods are moving ontoTracerProvider
Builder to be consistent with other signals. See #2303 for migration guide.trace::Config
is scheduled to be removed from public API inv0.28.0
. example:// old let tracer_provider: TracerProvider = TracerProvider::builder() .with_config(Config::default().with_resource(Resource::empty())) .build(); // new let tracer_provider: TracerProvider = TracerProvider::builder() .with_resource(Resource::empty()) .build();
-
logs::LogData
struct is deprecated, and scheduled to be removed from public API inv0.28.0
. -
Bug fix: Empty Meter names are retained as-is instead of replacing with "rust.opentelemetry.io/sdk/meter" #2334
-
Bug fix: Empty Logger names are retained as-is instead of replacing with "rust.opentelemetry.io/sdk/logger" #2316
-
Logger::provider
: This method is deprecated as of version0.27.1
. To be removed in0.28.0
. -
Logger::instrumentation_scope
: This method is deprecated as of version0.27.1
. To be removed in0.28.0
Migration Guidance: - These methods are intended for log appenders. Keep the clone of the provider handle, instead of depending on above methods. -
Bug Fix: Validates the
with_boundaries
bucket boundaries used in Histograms. The boundaries provided by the user must not containf64::NAN
,f64::INFINITY
orf64::NEG_INFINITY
and must be sorted in strictly increasing order, and contain no duplicates. Instruments will not record measurements if the boundaries are invalid. #2351
-
-
Added
with_periodic_exporter
method toMeterProviderBuilder
, allowing users to easily attach an exporter with a PeriodicReader for automatic metric export. Retained with_reader() for advanced use cases where a custom MetricReader configuration is needed. 2597 Example Usage:SdkMeterProvider::builder() .with_periodic_exporter(exporter) .build();
Using a custom PeriodicReader (advanced use case):
let reader = PeriodicReader::builder(exporter).build(); SdkMeterProvider::builder() .with_reader(reader) .build();
Released 2024-Nov-11
-
Update
opentelemetry
dependency version to 0.27 -
Update
opentelemetry-http
dependency version to 0.27 -
Bump MSRV to 1.70 #2179
-
Implement
LogRecord::set_trace_context
forLogRecord
. Respect any trace context set on aLogRecord
when emitting through aLogger
. -
Improved
LoggerProvider
shutdown handling to prevent redundant shutdown calls whendrop
is invoked. #2195 -
When creating new metric instruments by calling
build()
, SDK would return a no-op instrument if the validation fails (eg: Invalid metric name). #2166 -
BREAKING for Metrics users:
- Replaced
- (#2217): Removed
{Delta,Cumulative}TemporalitySelector::new()
in favor of directly usingTemporality
enum to simplify the configuration of MetricsExporterBuilder with different temporalities.
- (#2217): Removed
- Renamed
- (#2232): The
init
method used to create instruments has been renamed tobuild
. Before:Now:let counter = meter.u64_counter("my_counter").init();
let counter = meter.u64_counter("my_counter").build();
- (#2255): de-pluralize Metric types.
PushMetricsExporter
->PushMetricExporter
InMemoryMetricsExporter
->InMemoryMetricExporter
InMemoryMetricsExporterBuilder
->InMemoryMetricExporterBuilder
- (#2232): The
- Replaced
-
BREAKING: #2220
- Removed
InstrumentationLibrary
re-export and itsScope
alias, useopentelemetry::InstrumentationLibrary
instead. - Unified builders across signals
- Removed deprecated
LoggerProvider::versioned_logger
,TracerProvider::versioned_tracer
- Removed
MeterProvider::versioned_meter
- Replaced these methods with
LoggerProvider::logger_with_scope
,TracerProvider::logger_with_scope
,MeterProvider::meter_with_scope
- Removed deprecated
- Removed
-
- Pin url version to
2.5.2
. The higher version breaks the build refer: servo/rust-url#992. Theurl
crate is used whenjaeger_remote_sampler
feature is enabled.
- Pin url version to
-
BREAKING: #2266
-
Moved
ExportError
trait fromopentelemetry::ExportError
toopentelemetry_sdk::export::ExportError
-
Moved
LogError
enum fromopentelemetry::logs::LogError
toopentelemetry_sdk::logs::LogError
-
Moved
LogResult
type alias fromopentelemetry::logs::LogResult
toopentelemetry_sdk::logs::LogResult
-
Renamed
opentelemetry::metrics::Result
type alias toopentelemetry::metrics::MetricResult
-
Renamed
opentelemetry::metrics::MetricsError
enum toopentelemetry::metrics::MetricError
-
Moved
MetricError
enum fromopentelemetry::metrics::MetricError
toopentelemetry_sdk::metrics::MetricError
-
Moved
MetricResult
type alias fromopentelemetry::metrics::MetricResult
toopentelemetry_sdk::metrics::MetricResult
-
Users calling public APIs that return these constructs (e.g, LoggerProvider::shutdown(), MeterProvider::force_flush()) should now import them from the SDK instead of the API.
-
Developers creating custom exporters should ensure they import these constructs from the SDK, not the API.
-
2291 Rename
logs_level_enabled flag
tospec_unstable_logs_enabled
. Please enable this updated flag if the feature is needed. This flag will be removed once the feature is stabilized in the specifications.
-
-
BREAKING:
Temporality
enum moved fromopentelemetry_sdk::metrics::data::Temporality
toopentelemetry_sdk::metrics::Temporality
. -
BREAKING:
Views
are now an opt-in ONLY feature. Please include the featurespec_unstable_metrics_views
to enableViews
. It will be stabilized post 1.0 stable release of the SDK. #2295 -
Added a new
PeriodicReader
implementation (PeriodicReaderWithOwnThread
) that does not rely on an async runtime, and instead creates own Thread. This is under feature flag "experimental_metrics_periodic_reader_no_runtime". The functionality maybe moved into existing PeriodReader or even removed in the future. As of today, this cannot be used as-is with OTLP Metric Exporter or any exporter that require an async runtime.
Released 2024-Sep-30
-
Update
opentelemetry
dependency version to 0.26 -
BREAKING Public API changes:
-
Update
async-std
dependency version to 1.13 -
Breaking - Remove support for
MetricProducer
which allowed metrics from external sources to be sent through OpenTelemetry. #2105 -
Feature:
SimpleSpanProcessor::new
is now public #2119 -
For Delta Temporality, exporters are not invoked unless there were new measurements since the last collect/export. #2153
-
MeterProvider
modified to not invoke shutdown onDrop
, if user has already calledshutdown()
. #2156
-
Update
opentelemetry
dependency version to 0.25 -
Starting with this version, this crate will align with
opentelemetry
crate on major,minor versions. -
Perf improvements for all metric instruments (except
ExponentialHistogram
) that led to faster metric updates and higher throughput #1740:- Zero allocations when recording measurements: Once a measurement for a given attribute combination is reported, the SDK would not allocate additional memory for subsquent measurements reported for the same combination.
- Minimized thread contention: Threads reporting measurements for the same instrument no longer contest for the same
Mutex
. The internal aggregation data structure now uses a combination ofRwLock
and atomics. Consequently, threads reporting measurements now only have to acquire a read lock. - Lock-free floating point updates: Measurements reported for
f64
based metrics no longer need to acquire aMutex
to update thef64
value. They use a CAS-based loop instead.
-
opentelemetry_sdk::logs::record::LogRecord
andopentelemetry_sdk::logs::record::TraceContext
derive fromPartialEq
to facilitate Unit Testing. -
Fixed an issue causing a panic during shutdown when using the
TokioCurrentThread
in BatchExportProcessor for traces and logs. #1964 #1973 -
Fix BatchExportProcessor for traces and logs to trigger first export at the first interval instead of doing it right away. #1970 #1973
- Breaking #1985
Hide LogRecord attributes Implementation Details from processors and exporters.
The custom exporters and processors can't directly access the
LogData::LogRecord::attributes
, as these are private to opentelemetry-sdk. Instead, they would now use LogRecord::attributes_iter() method to access them.
- Breaking #1985
Hide LogRecord attributes Implementation Details from processors and exporters.
The custom exporters and processors can't directly access the
-
Fixed various Metric aggregation bug related to ObservableCounter,UpDownCounter including #1517. #2004
-
Fixed a bug related to cumulative aggregation of
Gauge
measurements. #1975. #2021 -
Provide default implementation for
event_enabled
method inLogProcessor
trait that returnstrue
always. -
-
The Exporter::export() interface is modified as below: Previous Signature:
async fn export<'a>(&mut self, batch: Vec<Cow<'a, LogData>>) -> LogResult<()>;
Updated Signature:
async fn export(&mut self, batch: LogBatch<'_>) -> LogResult<()>;
where
pub struct LogBatch<'a> { data: &'a [(&'a LogRecord, &'a InstrumentationLibrary)], }
This change enhances performance by reducing unnecessary heap allocations and maintains object safety, allowing for more efficient handling of log records. It also simplifies the processing required by exporters. Exporters no longer need to determine if the LogData is borrowed or owned, as they now work directly with references. As a result, exporters must explicitly create a copy of LogRecord and/or InstrumentationLibrary when needed, as the new interface only provides references to these structures.
-
- Add hidden method to support tracing-opentelemetry
-
Add "metrics", "logs" to default features. With this, default feature list is "trace", "metrics" and "logs".
-
Add
with_resource
on Builder for LoggerProvider, replacing thewith_config
method. Instead of using.with_config(Config::default().with_resource(RESOURCE::default()))
users must now use.with_resource(RESOURCE::default())
to configure Resource on logger provider. -
Removed dependency on
ordered-float
. -
Removed
XrayIdGenerator
, which was marked deprecated since 0.21.3. Useopentelemetry-aws
, version 0.10.0 or newer. -
Performance Improvement - Counter/UpDownCounter instruments internally use
RwLock
instead ofMutex
to reduce contention -
Breaking 1726 Update
LogProcessor::emit()
method to take mutable reference to LogData. This is breaking change for LogProcessor developers. If the processor needs to invoke the exporter asynchronously, it should clone the data to ensure it can be safely processed without lifetime issues. Any changes made to the log data before cloning in this method will be reflected in the next log processor in the chain, as well as to the exporter. -
Breaking 1726 Update
LogExporter::export()
method to accept a batch of log data, which can be either a reference or ownedLogData
. If the exporter needs to process the log data asynchronously, it should clone the log data to ensure it can be safely processed without lifetime issues. -
Clean up public methods in SDK.
- [
TracerProvider::span_processors
] and [TracerProvider::config
] was removed as it's not part of the spec. - Added
non_exhaustive
annotation to [trace::Config
]. Marked [config
] as deprecated since it's only a wrapper forConfig::default
- Removed [
Tracer::tracer_provder
] and [Tracer::instrument_libraries
] as it's not part of the spec.
- [
-
Breaking #1830 [Traces SDK] Improves performance by sending Resource information to processors (and exporters) once, instead of sending with every log. If you are an author of Processor, Exporter, the following are BREAKING changes.
- Implement
set_resource
method in your custom SpanProcessor, which invokes exporter'sset_resource
. - Implement
set_resource
method in your custom SpanExporter. This method should save the resource object in original or serialized format, to be merged with every span event during export. SpanData
doesn't have the resource attributes. TheSpanExporter::export()
method needs to merge it with the earlier preserved resource before export.
- Implement
-
Breaking 1836
SpanProcessor::shutdown
now takes an immutable reference to self. Any reference can call shutdown on the processor. After the first call toshutdown
the processor will not process any new spans. -
Breaking [1850] (#1850)
LoggerProvider::log_processors()
andLoggerProvider::resource()
are not public methods anymore. They are only used within theopentelemetry-sdk
crate. -
1857 Fixed an issue in Metrics SDK which prevented export errors from being send to global error handler. With the fix, errors occurring during export like OTLP Endpoint unresponsive shows up in stderr by default.
-
1869 Added a
target
field toLogRecord
structure, populated byopentelemetry-appender-tracing
andopentelemetry-appender-log
appenders.
async fn export<'a>(&mut self, batch: Vec<Cow<'a, LogData>>) -> LogResult<()>;
where LogRecord
within LogData
now includes:
LogData {
LogRecord {
event_name,
target, // newly added
timestamp,
observed_timestamp,
trace_context,
trace_context,
severity_number,
body,
attributes
}
Instrumentation {
name,
version,
schema_url,
version
}
}
The LogRecord::target
field contains the actual target/component emitting the logs, while the Instrumentation::name
contains the name of the OpenTelemetry appender.
- Breaking #1674 Update to
http
v1 types (viaopentelemetry-http
update) - Update
opentelemetry
dependency version to 0.24 - Update
opentelemetry-http
dependency version to 0.13
- Fix SimpleSpanProcessor to be consistent with log counterpart. Also removed dependency on crossbeam-channel. 1612
- #1422 Fix metrics aggregation bug when using Views to drop attributes.
- #1766 Fix Metrics PeriodicReader to trigger first collect/export at the first interval instead of doing it right away.
- #1623 Add Drop implementation for SdkMeterProvider, which shuts down metricreaders, thereby allowing metrics still in memory to be flushed out.
- Breaking #1624 Remove
OsResourceDetector
andProcessResourceDetector
resource detectors, use theopentelemetry-resource-detector
instead. - #1636 [Logs SDK] Improves performance by sending
Resource information to processors (and exporters) once, instead of sending with every log. If you are an author
of Processor, Exporter, the following are BREAKING changes.
- Implement
set_resource
method in your custom LogProcessor, which invokes exporter'sset_resource
. - Implement
set_resource
method in your custom LogExporter. This method should save the resource object in original or serialized format, to be merged with every log event during export. LogData
doesn't have the resource attributes. TheLogExporter::export()
method needs to merge it with the earlier preserved resource before export.
- Implement
- Baggage propagation error will be reported to global error handler #1640
- Improves
shutdown
behavior ofLoggerProvider
andLogProcessor
#1643.shutdown
can be called by any clone of theLoggerProvider
without the need of waiting on allLogger
drops. Thus,try_shutdown
has been removed.shutdown
methods inLoggerProvider
andLogProcessor
now takes a immutable reference- After
shutdown
,LoggerProvider
will return noopLogger
- After
shutdown
,LogProcessor
will not process any new logs
- Moving LogRecord implementation to the SDK. 1702.
- Relocated
LogRecord
struct to SDK, as an implementation for the trait in the API.
- Relocated
- Breaking #1729
- Update the return type of
TracerProvider.span_processors()
from&Vec<Box<dyn SpanProcessor>>
to&[Box<dyn SpanProcessor>]
. - Update the return type of
LoggerProvider.log_processors()
from&Vec<Box<dyn LogProcessor>>
to&[Box<dyn LogProcessor>]
.
- Update the return type of
- Update
opentelemetry
dependency version to 0.23 - Update
opentelemetry-http
dependency version to 0.12 - Breaking #1750
- Update the return type of
LoggerProvider.shutdown()
fromVec<LogResult<()>>
toLogResult<()>
.
- Update the return type of
- #1576 Fix Span kind is always set to "internal".
- XrayIdGenerator in the opentelemetry-sdk has been deprecated and moved to version 0.10.0 of the opentelemetry-aws crate.
-
#1410 Add experimental synchronous gauge
-
#1471 Configure batch log record processor via
OTEL_BLRP_*
environment variables and viaOtlpLogPipeline::with_batch_config
-
#1503 Make the documentation for In-Memory exporters visible.
-
#1526 Performance Improvement : Creating Spans and LogRecords are now faster, by avoiding expensive cloning of
Resource
for every Span/LogRecord.
-
Breaking #1313 #1350 Changes how Span links/events are stored to achieve performance gains. See below for details:
Behavior Change: When enforcing
max_links_per_span
,max_events_per_span
fromSpanLimits
, links/events are kept in the first-come order. The previous "eviction" based approach is no longer performed.Breaking Change Affecting Exporter authors:
SpanData
now storeslinks
asSpanLinks
instead ofEvictedQueue
whereSpanLinks
is a struct with aVec
of links anddropped_count
.SpanData
now storesevents
asSpanEvents
instead ofEvictedQueue
whereSpanEvents
is a struct with aVec
of events anddropped_count
. -
Breaking Remove
TextMapCompositePropagator
#1373. UseTextMapCompositePropagator
in opentelemetry API. -
#1375 Fix metric collections during PeriodicReader shutdown
-
Breaking #1480 Remove fine grained
BatchConfig
configurations fromBatchLogProcessorBuilder
andBatchSpanProcessorBuilder
. UseBatchConfigBuilder
to construct aBatchConfig
instance and pass it usingBatchLogProcessorBuilder::with_batch_config
orBatchSpanProcessorBuilder::with_batch_config
. -
Breaking #1480 Remove mutating functions from
BatchConfig
, useBatchConfigBuilder
to construct aBatchConfig
instance. -
Breaking #1495 Remove Batch LogRecord&Span Processor configuration via non-standard environment variables. Use the following table to migrate from the no longer supported non-standard environment variables to the standard ones.
No longer supported | Standard equivalent |
---|---|
OTEL_BLRP_SCHEDULE_DELAY_MILLIS | OTEL_BLRP_SCHEDULE_DELAY |
OTEL_BLRP_EXPORT_TIMEOUT_MILLIS | OTEL_BLRP_EXPORT_TIMEOUT |
OTEL_BSP_SCHEDULE_DELAY_MILLIS | OTEL_BSP_SCHEDULE_DELAY |
OTEL_BSP_EXPORT_TIMEOUT_MILLIS | OTEL_BSP_EXPORT_TIMEOUT |
-
Breaking #1455 Make the LoggerProvider Owned
Logger
now takes an Owned Logger instead of aWeak<LoggerProviderInner>
LoggerProviderInner
is no longerpub (crate)
Logger.provider()
now returns&LoggerProvider
instead of anOption<LoggerProvider>
-
#1519 Performance improvements when calling
Counter::add()
andUpDownCounter::add()
with an empty set of attributes (e.g.counter.Add(5, &[])
) -
Breaking Renamed
MeterProvider
andMeter
toSdkMeterProvider
andSdkMeter
respectively to avoid name collision with public API types. #1328
- #1481 Fix error message caused by race condition when using PeriodicReader
- Fix delta aggregation metric reuse. #1434
- Fix
max_scale
validation of exponential histogram configuration. #1452
- Fix metric export corruption if gauges have not received a last value. #1363
- Return consistent
Meter
for a given scope fromMeterProvider
. #1351
- Log warning if two instruments have the same name with different #1266 casing
- Log warning if view is created with empty criteria #1266
- Add exponential histogram support #1267
- Add
opentelemetry::sdk::logs::config()
for parity withopentelemetry::sdk::trace::config()
#1197
-
Bump MSRV to 1.65 #1318
-
Default Resource (the one used when no other Resource is explicitly provided) now includes
TelemetryResourceDetector
, populating "telemetry.sdk.*" attributes. #1194. -
Bump MSRV to 1.64 #1203
-
Add unit/doc tests for MeterProvider #1220
-
Changed dependency from
opentelemetry_api
toopentelemetry
as the latter is now the API crate. #1226 -
Add in memory span exporter #1216
-
Add in memory log exporter #1231
-
Add
Sync
bound to theSpanExporter
andLogExporter
traits #1240 -
Move
MetricsProducer
config to builders to match other config #1266 -
Return error earlier if readers are shut down #1266
-
Add
/
to valid characters for instrument names #1269 -
Increase instrument name maximum length from 63 to 255 #1269
-
Updated crate documentation and examples. #1256
-
Replace regex with glob #1301
-
Breaking #1293 makes few breaking changes with respect to how Span attributes are stored to achieve performance gains. See below for details:
Behavior Change:
SDK will no longer perform de-duplication of Span attribute Keys. Please share feedback here, if you are affected.
Breaking Change Affecting Exporter authors:
SpanData
now storesattributes
asVec<KeyValue>
instead ofEvictedHashMap
.SpanData
now exposedropped_attributes_count
as a separate field.Breaking Change Affecting Sampler authors:
should_sample
changesattributes
fromOrderMap<Key, Value>
toVec<KeyValue>
. -
Breaking Move type argument from
RuntimeChannel<T>
to associated types #1314
- Remove context from Metric force_flush #1245
- Remove
logs::BatchMessage
andtrace::BatchMessage
types #1314
- Fix metric instrument name validation to include
_
#1274
- Implement cardinality limits for metric streams #1066.
- Propagate shutdown calls from
PeriodicReader
to metrics exporter #1138. - Add in memory metrics exporter #1017
- New metrics SDK #1000
- Use
Cow<'static, str>
instead of&'static str
#1018 - Unify trace and logs runtime extensions traits. #1067
- Fix EvictedQueue bug when capacity is set to 0 #1151.
- Samplers no longer has access to
InstrumentationLibrary
as one of parameters toshould_sample
. #1041. - Synchronous instruments no longer accepts
Context
while reporting measurements. #1076. - Don't use CARGO_BIN_NAME for service name #1150
- Wait for exports on the simple span processor's ForceFlush #1030
- Add instrument validation to
InstrumentBuilder
#884. - Add
TelemetryResourceDetector
#899. - Add support for instrumentation scope attributes #1021.
- Update to
opentelemetry_api
v0.19. - Update to
opentelemetry_http
v0.8. - Bump MSRV to 1.57 #953.
- Fix doc in
ShouldSample
trait #951 - Only run
ParentBased
delegate sampler when there is no parent #948. - Improve
SdkProvidedResourceDetector
's doc #964. - Update dependencies and bump MSRV to 1.60 #969.
- Use CARGO_BIN_NAME as default service name #991.
- Remove
in_memory
settings #946.
- Update the Number in the SDK API to support min and max. #989
- BREAKING
struct
s which implementShouldSample
a.k.a Custom Samplers must now implementClone
. This enables (#833) - SDK split from
opentelemetry
crate