Skip to content

Commit b5db494

Browse files
author
Ganesh Jangir
authored
feat: add named-pipe trace exporter example (#1222)
1 parent e3bc25c commit b5db494

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

data-pipeline/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ harness = false
5151
path = "benches/main.rs"
5252

5353
[dev-dependencies]
54+
clap = { version = "4.0", features = ["derive"] }
5455
criterion = "0.5.1"
5556
datadog-trace-utils = { path = "../datadog-trace-utils", features = [
5657
"test-utils",

data-pipeline/examples/send-traces-with-stats.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/
22
// SPDX-License-Identifier: Apache-2.0
33

4+
use clap::Parser;
45
use data_pipeline::trace_exporter::{
56
TraceExporter, TraceExporterInputFormat, TraceExporterOutputFormat,
67
};
@@ -29,10 +30,24 @@ fn get_span(now: i64, trace_id: u64, span_id: u64) -> pb::Span {
2930
}
3031
}
3132

33+
#[derive(Parser)]
34+
#[command(name = "send-traces-with-stats")]
35+
#[command(about = "A data pipeline example for sending traces with statistics")]
36+
struct Args {
37+
#[arg(
38+
short = 'u',
39+
long = "url",
40+
default_value = "http://localhost:8126",
41+
help = "Set the trace agent URL\n\nExamples:\n http://localhost:8126 (default)\n windows://./pipe/dd-apm-test-agent (Windows named pipe)\n https://trace.agent.datadoghq.com:443 (custom endpoint)"
42+
)]
43+
url: String,
44+
}
45+
3246
fn main() {
47+
let args = Args::parse();
3348
let mut builder = TraceExporter::builder();
3449
builder
35-
.set_url("http://localhost:8126")
50+
.set_url(&args.url)
3651
.set_hostname("test")
3752
.set_env("testing")
3853
.set_app_version(env!("CARGO_PKG_VERSION"))

0 commit comments

Comments
 (0)