opentelemetry_sdk::logs::record::LogRecordandopentelemetry_sdk::logs::record::TraceContextderive fromPartialEqto facilitate Unit Testing.- Fixed an issue causing a panic during shutdown when using the
TokioCurrentThreadin 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
Gaugemeasurements. #1975. #2021 - Provide default implementation for
event_enabledmethod inLogProcessortrait that returnstruealways. - Breaking : The
LogDatastructure used in theExporter::exporterinterface has been modified to introduce lifetime parameters. This change affects the export method signature and the LogData struct itself. #1965 Earlier:
pub trait LogExporter: Send + Sync + Debug {
async fn export<'a>(&mut self, batch: Vec<Cow<'a, LogData>>) -> LogResult<()>;
}
#[derive(Clone, Debug)]
pub struct LogData {
/// Log record
pub record: LogRecord,
/// Instrumentation details for the emitter who produced this `LogEvent`.
pub instrumentation: InstrumentationLibrary,
} After:
pub trait LogExporter: Send + Sync + Debug {
async fn export<'a>(&mut self, batch: Vec<Cow<'a, LogData<'a>>>) -> LogResult<()>;
}
#[derive(Clone, Debug)]
pub struct LogData<'a> {
/// Log record, which can be borrowed or owned.
pub record: Cow<'a, LogRecord>,
/// Instrumentation details for the emitter who produced this `LogEvent`.
pub instrumentation: Cow<'a, InstrumentationLibrary>,
}- Impact: This change introduces lifetime parameters to LogData, allowing for more flexible ownership and borrowing of LogRecord and InstrumentationLibrary instances. However, this change breaks compatibility with existing implementations of the LogExporter trait.
- Upgrade Instructions : To adapt to this change, update your LogExporter implementations
to accommodate the new lifetime parameters in the
LogDatastruct and theexportmethod signature.
- 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_resourceon Builder for LoggerProvider, replacing thewith_configmethod. 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
RwLockinstead ofMutexto 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_exhaustiveannotation 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_resourcemethod in your custom SpanProcessor, which invokes exporter'sset_resource. - Implement
set_resourcemethod 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. SpanDatadoesn't have the resource attributes. TheSpanExporter::export()method needs to merge it with the earlier preserved resource before export.
- Implement
-
Breaking 1836
SpanProcessor::shutdownnow takes an immutable reference to self. Any reference can call shutdown on the processor. After the first call toshutdownthe processor will not process any new spans. -
Breaking [1850] (open-telemetry#1850)
LoggerProvider::log_processors()andLoggerProvider::resource()are not public methods anymore. They are only used within theopentelemetry-sdkcrate. -
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
targetfield toLogRecordstructure, populated byopentelemetry-appender-tracingandopentelemetry-appender-logappenders.
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
httpv1 types (viaopentelemetry-httpupdate) - Update
opentelemetrydependency version to 0.24 - Update
opentelemetry-httpdependency 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
OsResourceDetectorandProcessResourceDetectorresource detectors, use theopentelemetry-resource-detectorinstead. - #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_resourcemethod in your custom LogProcessor, which invokes exporter'sset_resource. - Implement
set_resourcemethod 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. LogDatadoesn'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
shutdownbehavior ofLoggerProviderandLogProcessor#1643.shutdowncan be called by any clone of theLoggerProviderwithout the need of waiting on allLoggerdrops. Thus,try_shutdownhas been removed.shutdownmethods inLoggerProviderandLogProcessornow takes a immutable reference- After
shutdown,LoggerProviderwill return noopLogger - After
shutdown,LogProcessorwill not process any new logs
- Moving LogRecord implementation to the SDK. 1702.
- Relocated
LogRecordstruct 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
opentelemetrydependency version to 0.23 - Update
opentelemetry-httpdependency 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
Resourcefor 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_spanfromSpanLimits, links/events are kept in the first-come order. The previous "eviction" based approach is no longer performed.Breaking Change Affecting Exporter authors:
SpanDatanow storeslinksasSpanLinksinstead ofEvictedQueuewhereSpanLinksis a struct with aVecof links anddropped_count.SpanDatanow storeseventsasSpanEventsinstead ofEvictedQueuewhereSpanEventsis a struct with aVecof events anddropped_count. -
Breaking Remove
TextMapCompositePropagator#1373. UseTextMapCompositePropagatorin opentelemetry API. -
#1375 Fix metric collections during PeriodicReader shutdown
-
Breaking #1480 Remove fine grained
BatchConfigconfigurations fromBatchLogProcessorBuilderandBatchSpanProcessorBuilder. UseBatchConfigBuilderto construct aBatchConfiginstance and pass it usingBatchLogProcessorBuilder::with_batch_configorBatchSpanProcessorBuilder::with_batch_config. -
Breaking #1480 Remove mutating functions from
BatchConfig, useBatchConfigBuilderto construct aBatchConfiginstance. -
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
Loggernow takes an Owned Logger instead of aWeak<LoggerProviderInner>LoggerProviderInneris no longerpub (crate)Logger.provider()now returns&LoggerProviderinstead 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
MeterProviderandMetertoSdkMeterProviderandSdkMeterrespectively 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_scalevalidation of exponential histogram configuration. #1452
- Fix metric export corruption if gauges have not received a last value. #1363
- Return consistent
Meterfor 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_apitoopentelemetryas the latter is now the API crate. #1226 -
Add in memory span exporter #1216
-
Add in memory log exporter #1231
-
Add
Syncbound to theSpanExporterandLogExportertraits #1240 -
Move
MetricsProducerconfig 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:
SpanDatanow storesattributesasVec<KeyValue>instead ofEvictedHashMap.SpanDatanow exposedropped_attributes_countas a separate field.Breaking Change Affecting Sampler authors:
should_samplechangesattributesfromOrderMap<Key, Value>toVec<KeyValue>. -
Breaking Move type argument from
RuntimeChannel<T>to associated types #1314
- Remove context from Metric force_flush #1245
- Remove
logs::BatchMessageandtrace::BatchMessagetypes #1314
- Fix metric instrument name validation to include
_#1274
- Implement cardinality limits for metric streams #1066.
- Propagate shutdown calls from
PeriodicReaderto 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
InstrumentationLibraryas one of parameters toshould_sample. #1041. - Synchronous instruments no longer accepts
Contextwhile 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_apiv0.19. - Update to
opentelemetry_httpv0.8. - Bump MSRV to 1.57 #953.
- Fix doc in
ShouldSampletrait #951 - Only run
ParentBaseddelegate 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_memorysettings #946.
- Update the Number in the SDK API to support min and max. #989
- BREAKING
structs which implementShouldSamplea.k.a Custom Samplers must now implementClone. This enables (#833) - SDK split from
opentelemetrycrate