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
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion libdd-data-pipeline/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,14 @@ libdd-tinybytes = { version = "1.1.1", path = "../libdd-tinybytes", features = [
web-time = "1"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { version = "1.23", features = ["time", "test-util"], default-features = false }
tokio = { version = "1.23", features = ["time", "test-util", "net"], default-features = false }
libdd-capabilities-impl = { version = "3.0.0", path = "../libdd-capabilities-impl", default-features = false }
# OTLP gRPC transport: a custom GrpcService over hyper h2c. tonic's transport
# (hyper/tokio/socket2) does not build for wasm32, so the whole gRPC path is gated off.
tonic = { version = "0.14", default-features = false }
prost = "0.14.1"
hyper = { workspace = true, features = ["client", "http2"] }
hyper-util = { workspace = true, features = ["tokio"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.2", features = ["js"] }
Expand Down Expand Up @@ -85,6 +91,7 @@ tokio = { version = "1.23", features = [
"test-util",
], default-features = false }
duplicate = "2.0.1"
h2 = "0.4"

[features]
default = ["https", "telemetry"]
Expand Down
26 changes: 26 additions & 0 deletions libdd-data-pipeline/src/otlp/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,19 @@ pub struct OtlpTraceConfig {
pub otel_trace_semantics_enabled: bool,
}

/// Per-request OTLP gRPC trace exporter configuration.
// Not yet wired to the trace exporter's send loop; exercised by tests only.
#[allow(dead_code)]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To be wired in #2171

#[derive(Clone, Debug)]
pub struct OtlpGrpcTraceConfig {
/// Custom key-value pairs forwarded as gRPC request metadata.
pub headers: Vec<(String, String)>,
/// Per-request timeout.
pub timeout: Duration,
/// When `true`, omit DD-specific per-span attributes from the payload.
pub otel_trace_semantics_enabled: bool,
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down Expand Up @@ -120,6 +133,19 @@ mod tests {
libdd_common::header::APPLICATION_PROTOBUF
);
}

#[test]
fn grpc_config_constructs_and_clones() {
let cfg = OtlpGrpcTraceConfig {
headers: vec![("k".to_string(), "v".to_string())],
timeout: Duration::from_secs(3),
otel_trace_semantics_enabled: true,
};
let clone = cfg.clone();
assert_eq!(clone.headers, cfg.headers);
assert_eq!(clone.timeout, Duration::from_secs(3));
assert!(clone.otel_trace_semantics_enabled);
}
Comment on lines +136 to +148

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We're basically testing the builtin Clone derive implementation.

Suggested change
#[test]
fn grpc_config_constructs_and_clones() {
let cfg = OtlpGrpcTraceConfig {
headers: vec![("k".to_string(), "v".to_string())],
timeout: Duration::from_secs(3),
otel_trace_semantics_enabled: true,
};
let clone = cfg.clone();
assert_eq!(clone.headers, cfg.headers);
assert_eq!(clone.timeout, Duration::from_secs(3));
assert!(clone.otel_trace_semantics_enabled);
}

}

/// Parsed OTLP trace-metrics exporter configuration.
Expand Down
Loading
Loading