feat: `jaeger-debug-id` from data generator
parent
f1936f0b08
commit
c961454dcd
|
@ -1549,6 +1549,7 @@ dependencies = [
|
|||
"test_helpers",
|
||||
"tokio",
|
||||
"url",
|
||||
"uuid",
|
||||
"workspace-hack",
|
||||
]
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ serde = { version = "1.0", features = ["derive"] }
|
|||
serde_json = "1.0.72"
|
||||
snafu = "0.6.6"
|
||||
url = "2.1.1"
|
||||
uuid = { version = "0.8", features = ["v4"] }
|
||||
workspace-hack = { path = "../workspace-hack"}
|
||||
|
||||
[dev-dependencies] # In alphabetical order
|
||||
|
|
|
@ -100,6 +100,7 @@ pub struct Client {
|
|||
pub url: String,
|
||||
auth_header: Option<String>,
|
||||
reqwest: reqwest::Client,
|
||||
jaeger_debug: bool,
|
||||
}
|
||||
|
||||
impl Client {
|
||||
|
@ -124,6 +125,15 @@ impl Client {
|
|||
url: url.into(),
|
||||
auth_header,
|
||||
reqwest: reqwest::Client::new(),
|
||||
jaeger_debug: false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Enable generation of `jaeger-debug-id` headers.
|
||||
pub fn with_jaeger_debug(self) -> Self {
|
||||
Self {
|
||||
jaeger_debug: true,
|
||||
..self
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,6 +144,12 @@ impl Client {
|
|||
if let Some(auth) = &self.auth_header {
|
||||
req = req.header("Authorization", auth);
|
||||
}
|
||||
if self.jaeger_debug {
|
||||
req = req.header(
|
||||
"jaeger-debug-id",
|
||||
format!("influxdb_client-{}", uuid::Uuid::new_v4()),
|
||||
);
|
||||
}
|
||||
|
||||
req
|
||||
}
|
||||
|
|
|
@ -139,6 +139,11 @@ Logging:
|
|||
.help("Generate this many samplings to batch into a single API call. Good for sending a bunch of historical data in quickly if paired with a start time from long ago.")
|
||||
.takes_value(true)
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("jaeger_debug")
|
||||
.long("jaeger_debug")
|
||||
.help("Generate `jaeger-debug-id` headers during write")
|
||||
)
|
||||
.get_matches();
|
||||
|
||||
let disable_log_output = matches.is_present("PRINT");
|
||||
|
@ -191,7 +196,16 @@ Logging:
|
|||
matches.value_of("ORG_ID"),
|
||||
);
|
||||
|
||||
PointsWriterBuilder::new_api(host, org, bucket, token, create_bucket, org_id).await?
|
||||
PointsWriterBuilder::new_api(
|
||||
host,
|
||||
org,
|
||||
bucket,
|
||||
token,
|
||||
create_bucket,
|
||||
org_id,
|
||||
matches.is_present("jaeger_debug"),
|
||||
)
|
||||
.await?
|
||||
} else if matches.is_present("PRINT") {
|
||||
PointsWriterBuilder::new_std_out()
|
||||
} else if matches.is_present("NOOP") {
|
||||
|
|
|
@ -118,6 +118,7 @@ impl PointsWriterBuilder {
|
|||
token: impl Into<String> + Send,
|
||||
create_bucket: bool,
|
||||
org_id: Option<&str>,
|
||||
jaeger_debug: bool,
|
||||
) -> Result<Self> {
|
||||
let host = host.into();
|
||||
|
||||
|
@ -130,7 +131,10 @@ impl PointsWriterBuilder {
|
|||
format!("http://{}", host)
|
||||
};
|
||||
|
||||
let client = influxdb2_client::Client::new(host, token.into());
|
||||
let mut client = influxdb2_client::Client::new(host, token.into());
|
||||
if jaeger_debug {
|
||||
client = client.with_jaeger_debug();
|
||||
}
|
||||
let org = org.into();
|
||||
let bucket = bucket.into();
|
||||
|
||||
|
|
Loading…
Reference in New Issue