use super::otlp_types::{AnyValueTyped, KeyValue, LogRecord};
pub fn make_kv(key: &str, value: &str) -> KeyValue {
KeyValue {
key: key.to_string(),
value: AnyValueTyped {
string_value: Some(value.to_string()),
int_value: None,
double_value: None,
},
}
}
pub fn make_kv_int(key: &str, value: i64) -> KeyValue {
KeyValue {
key: key.to_string(),
value: AnyValueTyped {
string_value: None,
int_value: Some(value),
double_value: None,
},
}
}
pub fn make_log_record(event_name: &str, attrs: Vec<KeyValue>) -> LogRecord {
let mut all_attrs = vec![make_kv("event.name", event_name)];
all_attrs.extend(attrs);
LogRecord {
time_unix_nano: Some("1700000000000000000".to_string()),
attributes: Some(all_attrs),
}
}