Skip to content

Commit

Permalink
feat: add observability config
Browse files Browse the repository at this point in the history
  • Loading branch information
smorihira committed Sep 11, 2024
1 parent 50eb8e2 commit e0cd1b0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions rust/bin/meta/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use opentelemetry::global;
use opentelemetry::propagation::Extractor;
use tonic::transport::Server;
use tonic::Request;
use observability::{config::Config, observability::{Observability, ObservabilityImpl}};
use observability::{config::{Config, Tracer}, observability::{Observability, ObservabilityImpl, SERVICE_NAME}};

struct MetadataMap<'a>(&'a tonic::metadata::MetadataMap);

Expand Down Expand Up @@ -67,7 +67,15 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
//
// decode config yaml
// let observability_cfg = serde_yaml::from_str(config_yaml).unwrap();
let observability_cfg = Config::default();
let observability_cfg = Config::new()
.enabled(true)
.attribute(SERVICE_NAME, "vald-lb-gateway")
.attribute("target_pod", "target_pod")
.attribute("target_node", "target_node")
.attribute("exported_kubernetes_namaspace", "default")
.attribute("kubernetes_name", "vald-lb-gateway")
.endpoint("127.0.0.1:4318")
.tracer(Tracer::new().enabled(true));
let mut observability = ObservabilityImpl::new(observability_cfg)?;

let addr = "[::1]:8081".parse()?;
Expand Down

0 comments on commit e0cd1b0

Please sign in to comment.