Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ pin-project-lite = "0.2"
prost = "0.14"
rand = { version = "0.9", default-features = false }
reqwest = { version = "0.13.1", default-features = false }
rustix = { version = "1.1.4", default-features = false }
serial_test = "3"
serde = { version = "1.0", default-features = false }
serde_json = "1.0"
temp-env = "0.3.6"
Expand Down
1 change: 1 addition & 0 deletions examples/logs-advanced/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ opentelemetry-appender-tracing = { workspace = true }
tracing = { workspace = true, features = ["std"]}
tracing-subscriber = { workspace = true, features = ["env-filter","registry", "std", "fmt"] }
opentelemetry = { workspace = true }
opentelemetry-proto = { workspace = true, features = ["process-context"] }
17 changes: 12 additions & 5 deletions examples/logs-advanced/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@ use tracing::{error, info};
use tracing_subscriber::{prelude::*, EnvFilter};

fn main() {
let resource = Resource::builder()
.with_service_name("log-appender-tracing-example")
.build();

// Publish resource attributes via a memory-mapped region so external readers
// (e.g. the OpenTelemetry eBPF Profiler) can discover this process.
// This is a no-op on non-Linux platforms.
opentelemetry_proto::process_context::publish(&resource);

let exporter = opentelemetry_stdout::LogExporter::default();
let enriching_processor = EnrichmentLogProcessor::new(SimpleLogProcessor::new(exporter));
let provider: SdkLoggerProvider = SdkLoggerProvider::builder()
.with_resource(
Resource::builder()
.with_service_name("log-appender-tracing-example")
.build(),
)
.with_resource(resource)
.with_log_processor(enriching_processor)
.build();

Expand Down Expand Up @@ -55,6 +60,8 @@ fn main() {
info!(name: "my-event-name", target: "my-system", event_id = 20, user_name = "otel", user_email = "otel@opentelemetry.io", message = "This is an example message");
error!(name: "my-event-name", target: "my-system", event_id = 50, user_name = "otel", user_email = "otel@opentelemetry.io", message = "This is an example message");
let _ = provider.shutdown();

opentelemetry_proto::process_context::unpublish();
}

/// A log processor that enriches log records with additional attributes before
Expand Down
1 change: 1 addition & 0 deletions opentelemetry-proto/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Update proto definitions to v1.10.0.
- Updated `schemars` dependency to version 1.0.0.
- **Feature**: Add process context sharing support behind `process-context` feature flag ([OTEP-4719](https://github.com/open-telemetry/oteps/pull/4719)). Publishes SDK resource attributes via a named memory mapping on Linux, enabling external readers such as the OpenTelemetry eBPF Profiler to discover process metadata.

## 0.31.0

Expand Down
3 changes: 3 additions & 0 deletions opentelemetry-proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ metrics = ["opentelemetry/metrics", "opentelemetry_sdk/metrics"]
logs = ["opentelemetry/logs", "opentelemetry_sdk/logs"]
zpages = ["trace"]
profiles = []
process-context = ["gen-tonic-messages", "rustix"]
testing = ["opentelemetry/testing"]

# add ons
Expand All @@ -61,12 +62,14 @@ schemars = { workspace = true, optional = true }
serde = { workspace = true, optional = true, features = ["serde_derive", "std"] }
const-hex = { workspace = true, optional = true }
base64 = { workspace = true, optional = true }
rustix = { workspace = true, optional = true, features = ["mm", "fs", "process", "time"] }

[dev-dependencies]
opentelemetry = { workspace = true, features = ["testing"] }
tonic-prost-build = { workspace = true }
tempfile = { workspace = true }
serde_json = { workspace = true }
serial_test = { workspace = true }
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes it easier for testing


[lints]
workspace = true
3 changes: 3 additions & 0 deletions opentelemetry-proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ mod proto;
pub use proto::tonic;

pub mod transform;

#[cfg(feature = "process-context")]
pub mod process_context;
Loading
Loading