Skip to content

Commit

Permalink
add url param for log export (http)
Browse files Browse the repository at this point in the history
  • Loading branch information
Frefreak committed Jan 10, 2025
1 parent ec9f00c commit c29d808
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/cmd_report_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ pub struct Report {
#[clap(long, requires = "tls")]
domain: Option<String>,

/// full url as base
#[clap(long)]
url: Option<String>,

/// server host
#[clap(long, default_value = "localhost", env = "OTK_REPORT_HOST")]
host: String,
Expand Down Expand Up @@ -105,7 +109,11 @@ async fn do_report_log(report: Report) -> Result<(), Box<dyn error::Error>> {
Protocol::HttpJson => DEFAULT_HTTP_JSON_PORT,
});
let scheme = if report.tls { "https" } else { "http" };
let endpoint_base = format!("{}://{}:{}", scheme, report.host, port);
let endpoint_base = if let Some(url) = &report.url {
url.clone()
} else {
format!("{}://{}:{}", scheme, report.host, port)
};
let resource = Resource::new(report.rtags.iter().map(|x| x.clone().into()));
let log_config = logs::config().with_resource(resource);
let pipeline = pipeline.with_log_config(log_config);
Expand Down

0 comments on commit c29d808

Please sign in to comment.