Skip to content

Commit 206dd7e

Browse files
authored
Merge branch 'main' into logrecord-getters
2 parents 4507e16 + 6b71301 commit 206dd7e

File tree

61 files changed

+863
-329
lines changed

Some content is hidden

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

61 files changed

+863
-329
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
- main
99
paths-ignore:
1010
- '**.md'
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
1114
jobs:
1215
test:
1316
strategy:
@@ -24,6 +27,7 @@ jobs:
2427
- rust: stable
2528
os: actuated-arm64-4cpu-16gb
2629
runs-on: ${{ matrix.os }}
30+
continue-on-error: ${{ matrix.rust == 'beta' }}
2731
steps:
2832
- name: Free disk space
2933
if: ${{ matrix.os == 'ubuntu-latest'}}

.github/workflows/semver.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ env:
44
on:
55
pull_request:
66
types: [ labeled, synchronize, opened, reopened ]
7-
87
jobs:
98
semver-compliance: # This job uses the latest published crate as baseline for comparison.
109
runs-on: ubuntu-latest

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,26 @@ analysis in order to understand your software's performance and behavior. You
1717
can export and analyze them using [Prometheus], [Jaeger], and other
1818
observability tools.
1919

20-
*Compiler support: [requires `rustc` 1.70+][msrv]*
20+
*[Supported Rust Versions](#supported-rust-versions)*
2121

2222
[Prometheus]: https://prometheus.io
2323
[Jaeger]: https://www.jaegertracing.io
24-
[msrv]: #supported-rust-versions
2524

2625
## Project Status
2726

27+
The table below summarizes the overall status of each component. Some components
28+
include unstable features, which are documented in their respective crate
29+
documentation.
30+
2831
| Signal/Component | Overall Status |
2932
| -------------------- | ------------------ |
3033
| Logs-API | RC* |
3134
| Logs-SDK | Beta |
3235
| Logs-OTLP Exporter | Beta |
3336
| Logs-Appender-Tracing | Beta |
3437
| Metrics-API | RC |
35-
| Metrics-SDK | Beta |
36-
| Metrics-OTLP Exporter | Beta |
38+
| Metrics-SDK | Beta |
39+
| Metrics-OTLP Exporter | Beta |
3740
| Traces-API | Beta |
3841
| Traces-SDK | Beta |
3942
| Traces-OTLP Exporter | Beta |

examples/metrics-basic/Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@ license = "Apache-2.0"
66
publish = false
77

88
[dependencies]
9-
opentelemetry = { path = "../../opentelemetry", features = ["metrics", "otel_unstable"] }
9+
opentelemetry = { path = "../../opentelemetry", features = ["metrics"] }
1010
opentelemetry_sdk = { path = "../../opentelemetry-sdk", features = ["metrics", "rt-tokio"] }
1111
opentelemetry-stdout = { path = "../../opentelemetry-stdout", features = ["metrics"]}
1212
tokio = { workspace = true, features = ["full"] }
1313
serde_json = { workspace = true }
1414

15-
[features]
16-
default = ["otel_unstable"]
17-
otel_unstable = ["opentelemetry/otel_unstable"]

examples/self-diagnostics/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ opentelemetry-stdout = { path = "../../opentelemetry-stdout"}
1212
tokio = { workspace = true, features = ["full"] }
1313
tracing = { workspace = true, features = ["std"]}
1414
tracing-core = { workspace = true }
15-
tracing-subscriber = { version = "0.3.18", features = ["env-filter","registry", "std"]}
15+
tracing-subscriber = { workspace = true, features = ["env-filter","registry", "std", "fmt"]}

examples/self-diagnostics/src/main.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use opentelemetry::global;
22
use opentelemetry::KeyValue;
33
use opentelemetry_sdk::metrics::PeriodicReader;
4+
use opentelemetry_sdk::Resource;
45
use std::error::Error;
56
use tracing::info;
67
use tracing_subscriber::fmt;
@@ -13,6 +14,10 @@ fn init_meter_provider() -> opentelemetry_sdk::metrics::SdkMeterProvider {
1314
let reader = PeriodicReader::builder(exporter, opentelemetry_sdk::runtime::Tokio).build();
1415

1516
let provider = opentelemetry_sdk::metrics::SdkMeterProvider::builder()
17+
.with_resource(Resource::new([KeyValue::new(
18+
"service.name",
19+
"self-diagnostics-example",
20+
)]))
1621
.with_reader(reader)
1722
.build();
1823

@@ -26,7 +31,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
2631
// OpenTelemetry uses `tracing` crate for its internal logging. Unless a
2732
// tracing subscriber is set, the logs will be discarded. In this example,
2833
// we configure a `tracing` subscriber to:
29-
// 1. Print logs of level INFO or higher to stdout.
34+
// 1. Print logs of level DEBUG or higher to stdout using tracing's fmt layer.
3035
// 2. Filter logs from OpenTelemetry's dependencies (like tonic, hyper,
3136
// reqwest etc. which are commonly used by the OTLP exporter) to only print
3237
// ERROR-level logs. This filtering helps reduce repetitive log messages
@@ -35,11 +40,11 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
3540
// https://github.com/open-telemetry/opentelemetry-rust/issues/761 is
3641
// resolved.
3742

38-
// Target name used by OpenTelemetry always start with "opentelemetry".
43+
// Target names used by all OpenTelemetry official crates always start with "opentelemetry".
3944
// Hence, one may use "add_directive("opentelemetry=off".parse().unwrap())"
4045
// to turn off all logs from OpenTelemetry.
4146

42-
let filter = EnvFilter::new("info")
47+
let filter = EnvFilter::new("debug")
4348
.add_directive("hyper=error".parse().unwrap())
4449
.add_directive("tonic=error".parse().unwrap())
4550
.add_directive("h2=error".parse().unwrap())
@@ -54,11 +59,14 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
5459
info!("Starting self-diagnostics example");
5560

5661
let meter = global::meter("example");
57-
// Create a counter using an invalid name to trigger
58-
// internal log about the same.
59-
let counter = meter.u64_counter("my_counter with_space").build();
62+
let counter = meter.u64_counter("my_counter").build();
6063
counter.add(10, &[KeyValue::new("key", "value")]);
6164

65+
let _observable_counter = meter
66+
.u64_observable_counter("my_observable_counter")
67+
.with_callback(|observer| observer.observe(10, &[KeyValue::new("key", "value")]))
68+
.build();
69+
6270
meter_provider.shutdown()?;
6371
info!("Shutdown complete. Bye!");
6472
Ok(())

opentelemetry-appender-log/src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
//!
33
//! This library implements a log appender for the [`log`] crate using the [Logs Bridge API].
44
//!
5+
//! *[Supported Rust Versions](#supported-rust-versions)*
6+
//!
57
//! # Getting Started
68
//!
79
//! The bridge requires configuration on both the `log` and OpenTelemetry sides.
@@ -93,6 +95,20 @@
9395
//! - `with-serde`: Support complex values as attributes without stringifying them.
9496
//!
9597
//! [Logs Bridge API]: https://opentelemetry.io/docs/specs/otel/logs/bridge-api/
98+
//!
99+
//! ## Supported Rust Versions
100+
//!
101+
//! OpenTelemetry is built against the latest stable release. The minimum
102+
//! supported version is 1.70. The current OpenTelemetry version is not
103+
//! guaranteed to build on Rust versions earlier than the minimum supported
104+
//! version.
105+
//!
106+
//! The current stable Rust compiler and the three most recent minor versions
107+
//! before it will always be supported. For example, if the current stable
108+
//! compiler version is 1.49, the minimum supported version will not be
109+
//! increased past 1.46, three minor versions prior. Increasing the minimum
110+
//! supported compiler version is not considered a semver breaking change as
111+
//! long as doing so complies with this policy.
96112
97113
use log::{Level, Metadata, Record};
98114
use opentelemetry::{

opentelemetry-appender-tracing/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,18 @@ management, and export of telemetry. A major goal of OpenTelemetry is that you
3232
can easily instrument your applications or systems, no matter their language,
3333
infrastructure, or runtime environment. Crucially, the storage and visualization
3434
of telemetry is intentionally left to other tools.
35+
36+
*[Supported Rust Versions](#supported-rust-versions)*
37+
38+
## Supported Rust Versions
39+
40+
OpenTelemetry is built against the latest stable release. The minimum supported
41+
version is 1.70. The current OpenTelemetry version is not guaranteed to build
42+
on Rust versions earlier than the minimum supported version.
43+
44+
The current stable Rust compiler and the three most recent minor versions
45+
before it will always be supported. For example, if the current stable compiler
46+
version is 1.49, the minimum supported version will not be increased past 1.46,
47+
three minor versions prior. Increasing the minimum supported compiler version
48+
is not considered a semver breaking change as long as doing so complies with
49+
this policy.

opentelemetry-appender-tracing/src/layer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl<'a, LR: LogRecord> EventVisitor<'a, LR> {
6969
}
7070
}
7171

72-
impl<'a, LR: LogRecord> tracing::field::Visit for EventVisitor<'a, LR> {
72+
impl<LR: LogRecord> tracing::field::Visit for EventVisitor<'_, LR> {
7373
fn record_debug(&mut self, field: &tracing::field::Field, value: &dyn std::fmt::Debug) {
7474
#[cfg(feature = "experimental_metadata_attributes")]
7575
if is_duplicated_metadata(field.name()) {

opentelemetry-http/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,18 @@ management, and export of telemetry. A major goal of OpenTelemetry is that you
2828
can easily instrument your applications or systems, no matter their language,
2929
infrastructure, or runtime environment. Crucially, the storage and visualization
3030
of telemetry is intentionally left to other tools.
31+
32+
*[Supported Rust Versions](#supported-rust-versions)*
33+
34+
## Supported Rust Versions
35+
36+
OpenTelemetry is built against the latest stable release. The minimum supported
37+
version is 1.70. The current OpenTelemetry version is not guaranteed to build
38+
on Rust versions earlier than the minimum supported version.
39+
40+
The current stable Rust compiler and the three most recent minor versions
41+
before it will always be supported. For example, if the current stable compiler
42+
version is 1.49, the minimum supported version will not be increased past 1.46,
43+
three minor versions prior. Increasing the minimum supported compiler version
44+
is not considered a semver breaking change as long as doing so complies with
45+
this policy.

0 commit comments

Comments
 (0)