Skip to content

Commit 09568f7

Browse files
authored
Merge branch 'main' into measurement-processor
2 parents 800c660 + 5be79c7 commit 09568f7

File tree

55 files changed

+1237
-796
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1237
-796
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ It's important to regularly review and remove the `otel_unstable` flag from the
172172

173173
The potential features include:
174174

175-
- Stable and non-experimental features that compliant to specification, and have a feature flag to minimize compilation size. Example: feature flags for signals (like `logs`, `traces`, `metrics`) and runtimes (`rt-tokio`, `rt-tokio-current-thread`, `rt-async-std`).
175+
- Stable and non-experimental features that are compliant with the specification and have a feature flag to minimize compilation size. Example: feature flags for signals (like `logs`, `traces`, `metrics`) and runtimes (`rt-tokio`, `rt-tokio-current-thread`).
176176
- Stable and non-experimental features, although not part of the specification, are crucial for enhancing the tracing/log crate's functionality or boosting performance. These features are also subject to discussion and approval by the OpenTelemetry Rust Maintainers.
177177

178178
All such features should adhere to naming convention `<signal>_<feature_name>`

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ documentation.
3030

3131
| Signal/Component | Overall Status |
3232
| -------------------- | ------------------ |
33+
| Context | Beta |
34+
| Baggage | Beta |
35+
| Propagators | Beta |
3336
| Logs-API | Stable* |
3437
| Logs-SDK | RC |
3538
| Logs-OTLP Exporter | RC |
@@ -178,7 +181,6 @@ you're more than welcome to participate!
178181

179182
* [Cijo Thomas](https://github.com/cijothomas)
180183
* [Harold Dost](https://github.com/hdost)
181-
* [Julian Tescher](https://github.com/jtescher)
182184
* [Lalit Kumar Bhasin](https://github.com/lalitb)
183185
* [Utkarsh Umesan Pillai](https://github.com/utpilla)
184186
* [Zhongyang Wu](https://github.com/TommyCpp)
@@ -192,6 +194,7 @@ you're more than welcome to participate!
192194

193195
* [Dirkjan Ochtman](https://github.com/djc)
194196
* [Jan Kühle](https://github.com/frigus02)
197+
* [Julian Tescher](https://github.com/jtescher)
195198
* [Isobel Redelmeier](https://github.com/iredelmeier)
196199
* [Mike Goldsmith](https://github.com/MikeGoldsmith)
197200

docs/design/logs.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,13 @@ They get called in the order of registration. Log records are passed to the
195195
records, enrich them, filter them, and export to destinations by leveraging
196196
LogRecord Exporters.
197197

198+
Similar to [LoggerProvider](#sdkloggerprovider), methods on the `LogProcessor`
199+
trait also takes a immutable self (`&self`) only, forcing the need to use
200+
interior mutability, if any mutation is required. The exception to this is
201+
`set_resource`, which takes a `&mut self`. This is acceptable as `set_resource`
202+
is called by the `SdkLoggerProvider` during build() method only, and is not
203+
required after that.
204+
198205
Following built-in Log processors are provided in the Log SDK:
199206

200207
##### SimpleLogProcessor
@@ -232,8 +239,13 @@ other words, that many logs can be lost if the app crashes in the middle.
232239

233240
## LogExporters
234241

235-
LogExporters are responsible for exporting logs to a destination. Some of them
236-
include:
242+
LogExporters are responsible for exporting logs to a destination.
243+
`SdkLoggerProvider` does not have a direct knowledge of the `LogExporter`, as it
244+
only deals with `LogProcessors`. It is the `LogProcessor`s that invokes
245+
`LogExporter` methods. Most methods on `LogExporter` trait also only takes
246+
`&self`, following the same reasoning as [LogProcessors](#logrecord-processors)
247+
248+
Some of the exporters are:
237249

238250
1. **InMemoryExporter** - exports to an in-memory list, primarily for
239251
unit-testing. This is used extensively in the repo itself, and external users

examples/tracing-jaeger/Cargo.toml

Lines changed: 0 additions & 12 deletions
This file was deleted.

examples/tracing-jaeger/README.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

examples/tracing-jaeger/jaeger.png

-165 KB
Binary file not shown.

examples/tracing-jaeger/src/main.rs

Lines changed: 0 additions & 48 deletions
This file was deleted.

opentelemetry-appender-log/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## vNext
44

5+
- Similar to the `opentelemetry-appender-tracing` fix [2658](https://github.com/open-telemetry/opentelemetry-rust/issues/2658)
6+
InstrumentationScope(Logger) used by the appender now uses an empty ("") named Logger.
7+
Previously, a Logger with name and version of the crate was used.
8+
Receivers (processors, exporters) are expected to use `LogRecord.target()` as scope name.
9+
This is already done in OTLP Exporters, so this change should be transparent to most users.
10+
511
## 0.28.0
612

713
Released 2025-Feb-10

opentelemetry-appender-log/src/lib.rs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
use log::{Level, Metadata, Record};
114114
use opentelemetry::{
115115
logs::{AnyValue, LogRecord, Logger, LoggerProvider, Severity},
116-
InstrumentationScope, Key,
116+
Key,
117117
};
118118
#[cfg(feature = "experimental_metadata_attributes")]
119119
use opentelemetry_semantic_conventions::attribute::{
@@ -189,12 +189,13 @@ where
189189
L: Logger + Send + Sync,
190190
{
191191
pub fn new(provider: &P) -> Self {
192-
let scope = InstrumentationScope::builder("opentelemetry-log-appender")
193-
.with_version(env!("CARGO_PKG_VERSION"))
194-
.build();
195-
196-
OpenTelemetryLogBridge {
197-
logger: provider.logger_with_scope(scope),
192+
Self {
193+
// Using empty scope name.
194+
// The name/version of this library itself can be added
195+
// as a Scope attribute once a semantic convention is
196+
// defined for the same.
197+
// See https://github.com/open-telemetry/semantic-conventions/issues/1550
198+
logger: provider.logger(""),
198199
_phantom: Default::default(),
199200
}
200201
}
@@ -985,9 +986,13 @@ mod tests {
985986
);
986987

987988
let logs = exporter.get_emitted_logs().unwrap();
989+
assert_eq!(logs.len(), 1);
990+
991+
let log = logs.first().unwrap();
992+
assert_eq!(log.instrumentation.name(), "");
988993

989994
let get = |needle: &str| -> Option<AnyValue> {
990-
logs[0].record.attributes_iter().find_map(|(k, v)| {
995+
log.record.attributes_iter().find_map(|(k, v)| {
991996
if k.as_str() == needle {
992997
Some(v.clone())
993998
} else {
@@ -1197,9 +1202,13 @@ mod tests {
11971202
);
11981203

11991204
let logs = exporter.get_emitted_logs().unwrap();
1205+
assert_eq!(logs.len(), 1);
1206+
1207+
let log = logs.first().unwrap();
1208+
assert_eq!(log.instrumentation.name(), "");
12001209

12011210
let get = |needle: &str| -> Option<AnyValue> {
1202-
logs[0].record.attributes_iter().find_map(|(k, v)| {
1211+
log.record.attributes_iter().find_map(|(k, v)| {
12031212
if k.as_str() == needle {
12041213
Some(v.clone())
12051214
} else {

opentelemetry-appender-tracing/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ transparent to most users.
4242
implementations (SDK, processor, exporters) to leverage this additional
4343
information to determine if an event is enabled.
4444

45+
- `u64` and `usize` values are stored as `opentelemetry::logs::AnyValue::Int`
46+
when conversion is feasible. Otherwise stored as
47+
`opentelemetry::logs::AnyValue::String`. This avoids unnecessary string
48+
allocation when values can be represented in their original types.
49+
- Byte arrays are stored as `opentelemetry::logs::AnyValue::Bytes` instead
50+
of string.
51+
- perf - small perf improvement by avoiding string allocation of `target`
52+
4553
## 0.28.1
4654

4755
Released 2025-Feb-12

0 commit comments

Comments
 (0)