feat(telemetry): configure otlp endpoint from flag

This commit is contained in:
Daniel Lundin 2024-12-24 01:27:41 +01:00
commit b1f701ddf2
Signed by: dln
SSH key fingerprint: SHA256:dQy1Xj3UiqJYpKR5ggQ2bxgz4jCH8IF+k3AB8o0kmdI
7 changed files with 175 additions and 140 deletions
controller/src/bin

View file

@ -14,12 +14,15 @@ use patagia_controller::context::ControllerContext;
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
struct Cli {}
struct Cli {
#[arg(long = "telemetry-otlp-endpoint", default_value = "http://localhost:4317", value_name = "OTEL_EXPORTER_OTLP_ENDPOINT")]
otlp_endpoint: Option<String>,
}
#[tokio::main]
async fn main() -> Result<()> {
let _args = Cli::parse();
let _tracing = instrumentation::init_tracing_subscriber()?;
let args = Cli::parse();
let _tracing = instrumentation::init_tracing(args.otlp_endpoint.as_ref())?;
tracing::info!("Patagia Controller");