Skip to content

Commit 6c13684

Browse files
authored
Merge branch 'main' into main
2 parents c9de4b8 + bc5e6ce commit 6c13684

File tree

93 files changed

+984
-665
lines changed

Some content is hidden

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

93 files changed

+984
-665
lines changed

.github/workflows/fossa.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: FOSSA scanning
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
fossa:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
16+
17+
- uses: fossas/fossa-action@93a52ecf7c3ac7eb40f5de77fd69b1a19524de94 # v1.5.0
18+
with:
19+
api-key: ${{secrets.FOSSA_API_KEY}}
20+
team: OpenTelemetry

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pin-project-lite = "0.2"
3636
prost = "0.13"
3737
prost-build = "0.13"
3838
prost-types = "0.13"
39-
rand = { version = "0.8", default-features = false }
39+
rand = { version = "0.9", default-features = false }
4040
reqwest = { version = "0.12", default-features = false }
4141
serde = { version = "1.0", default-features = false }
4242
serde_json = "1.0"
@@ -59,3 +59,6 @@ url = { version = "2.5", default-features = false }
5959
opentelemetry = { path = "opentelemetry" }
6060
opentelemetry_sdk = { path = "opentelemetry-sdk" }
6161
opentelemetry-stdout = { path = "opentelemetry-stdout" }
62+
63+
[workspace.lints.clippy]
64+
all = { level = "warn", priority = 1 }

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ you're more than welcome to participate!
186186
### Approvers
187187

188188
* [Shaun Cox](https://github.com/shaun-cox)
189+
* [Scott Gerring](https://github.com/scottgerring)
189190

190191
### Emeritus
191192

docs/design/logs.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,22 @@ this crate.
280280
## Performance
281281

282282
// Call out things done specifically for performance
283+
// Rough draft
284+
285+
1. `LogRecord` is stack allocated and not Boxed unless required by the component
286+
needing to store it beyond the logging call. (eg: BatchProcessor)
287+
2. LogRecords's Attribute storage is specially designed struct, that holds up to
288+
five attributes in stack.
289+
3. When passing `LogRecord`s to processor, a mutable ref is passed. This allows
290+
calling multiple processors one after another, without the need for cloning.
291+
4. `Logger` provides a `Enabled` check which can optimize performance when
292+
no-one is interested in the log. The check is passed from `Logger` to the
293+
processor, which may consult its exporter to make the decision. An example use
294+
case - an ETW or user-events exporter can check for the presence of listener and
295+
convey that decision back to logger, allowing appender to avoid even the cost of
296+
creating a `LogRecord` in the first place if there is no listener. This check is
297+
done for each log emission, and can react dynamically to changes in interest, by
298+
enabling/disabling ETW/user-event listener.
283299

284300
### Perf test - benchmarks
285301

@@ -289,6 +305,23 @@ this crate.
289305

290306
// Share ~~ numbers
291307

308+
## Internal logs
309+
310+
OTel itself is instrumented with `tracing` crate to emit internal logs about its
311+
operations. This is feature gated under "internal-logs", and is enabled by
312+
default for all components. The `opentelemetry` provide few helper macros
313+
`otel_warn` etc., which in turn invokes various `tracing` macros like `warn!`
314+
etc. The cargo package name will be set as `target` when using `tracing`. For
315+
example, logs from `opentelemetry-otlp` will have target set to
316+
"opentelemetry-otlp".
317+
318+
The helper macros are part of public API, so can be used by anyone. But it is
319+
only meant for OTel components itself and anyone writing extensions like custom
320+
Exporters etc.
321+
322+
// TODO: Document the principles followed when selecting severity for internal
323+
logs // TODO: Document how this can cause circular loop and plans to address it.
324+
292325
## Summary
293326

294327
- OpenTelemetry Logs does not provide a user-facing logging API.

examples/metrics-advanced/src/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
use opentelemetry::global;
22
use opentelemetry::Key;
33
use opentelemetry::KeyValue;
4-
use opentelemetry_sdk::metrics::{
5-
Aggregation, Instrument, PeriodicReader, SdkMeterProvider, Stream, Temporality,
6-
};
4+
use opentelemetry_sdk::metrics::{Aggregation, Instrument, SdkMeterProvider, Stream, Temporality};
75
use opentelemetry_sdk::Resource;
86
use std::error::Error;
97

examples/metrics-basic/src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use opentelemetry::{global, KeyValue};
2-
use opentelemetry_sdk::error::OTelSdkError;
3-
use opentelemetry_sdk::metrics::{PeriodicReader, SdkMeterProvider};
2+
use opentelemetry_sdk::metrics::SdkMeterProvider;
43
use opentelemetry_sdk::Resource;
54
use std::error::Error;
65
use std::vec;

examples/tracing-jaeger/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use opentelemetry::{
22
global,
3-
trace::{TraceContextExt, TraceError, Tracer},
3+
trace::{TraceContextExt, Tracer},
44
KeyValue,
55
};
6-
use opentelemetry_sdk::trace::SdkTracerProvider;
6+
use opentelemetry_sdk::trace::{SdkTracerProvider, TraceError};
77
use opentelemetry_sdk::Resource;
88

99
use std::error::Error;

opentelemetry-appender-log/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ opentelemetry-stdout = { path = "../opentelemetry-stdout", features = ["logs"] }
3434
log = { workspace = true, features = ["kv_serde"] }
3535
tokio = { workspace = true }
3636
serde = { workspace = true, features = ["std", "derive"] }
37+
38+
[lints]
39+
workspace = true

opentelemetry-appender-log/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This crate contains a [Log Appender](https://github.com/open-telemetry/opentelem
88

99
[![Crates.io: opentelemetry-appender-log](https://img.shields.io/crates/v/opentelemetry-appender-log.svg)](https://crates.io/crates/opentelemetry-appender-log)
1010
[![Documentation](https://docs.rs/opentelemetry-appender-log/badge.svg)](https://docs.rs/opentelemetry-appender-log)
11-
[![LICENSE](https://img.shields.io/crates/l/opentelemetry-appender-log)](./LICENSE)
11+
[![LICENSE](https://img.shields.io/crates/l/opentelemetry-appender-log)](https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry-appender-log/LICENSE)
1212
[![GitHub Actions CI](https://github.com/open-telemetry/opentelemetry-rust/workflows/CI/badge.svg)](https://github.com/open-telemetry/opentelemetry-rust/actions?query=workflow%3ACI+branch%3Amain)
1313
[![Slack](https://img.shields.io/badge/slack-@cncf/otel/rust-brightgreen.svg?logo=slack)](https://cloud-native.slack.com/archives/C03GDP0H023)
1414

@@ -29,4 +29,4 @@ of telemetry is intentionally left to other tools.
2929

3030
## Release Notes
3131

32-
You can find the release notes (changelog) [here](./CHANGELOG.md).
32+
You can find the release notes (changelog) [here](https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry-appender-log/CHANGELOG.md).

opentelemetry-appender-tracing/CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,32 @@
55
Fixes [1682](https://github.com/open-telemetry/opentelemetry-rust/issues/1682).
66
"spec_unstable_logs_enabled" feature now do not suppress logs for other layers.
77

8+
The special treatment of the "message" field has been extended when recording
9+
string values. With this change, when a log is emitted with a field named
10+
"message" (and string value), its value is directly assigned to the LogRecord’s
11+
body rather than being stored as an attribute named "message". This offers a
12+
slight performance improvement over previous.
13+
14+
For example, the below will now produce LogRecord with the message value
15+
populated as LogRecord's body:
16+
17+
```rust
18+
error!(name: "my-event-name", target: "my-system", event_id = 20, user_name = "otel", user_email = "[email protected]", message = "This is an example message");
19+
```
20+
21+
Previously, Body was only populated when the below style was used.
22+
23+
```rust
24+
error!(name: "my-event-name", target: "my-system", event_id = 20, user_name = "otel", user_email = "[email protected]", "This is an example message");
25+
```
26+
27+
This style, while slightly slower, should still be used when the value is not a
28+
simple string, but require format arguments as in the below example.
29+
30+
```rust
31+
error!(name: "my-event-name", target: "my-system", event_id = 20, user_name = "otel", user_email = "[email protected]", "This is an example message with format arguments {} and {}", "foo", "bar");
32+
```
33+
834
## 0.28.1
935

1036
Released 2025-Feb-12

0 commit comments

Comments
 (0)