Skip to content

Commit 5c3a0ef

Browse files
Charlie Friendmsft-tsharp
authored andcommitted
Implement string and integer properties
1 parent 4ffe5a6 commit 5c3a0ef

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

wrappers/rust/oneds-telemetry/src/lib.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,12 @@ impl LogManager {
100100
}
101101

102102
let handle = self.log_handle.as_ref().unwrap();
103-
evt_flush(handle);
104-
debug!("LogManager.flush(EVT_OP_FLUSH)");
103+
let status = evt_flush(handle);
104+
debug!("LogManager.flush(EVT_OP_FLUSH) returned: {}", status);
105105

106106
if upload {
107-
evt_upload(handle);
108-
debug!("LogManager.flush(EVT_OP_UPLOAD)");
107+
let status = evt_upload(handle);
108+
debug!("LogManager.flush(EVT_OP_UPLOAD) returned: {}", status);
109109
}
110110
}
111111

@@ -146,8 +146,7 @@ impl LogManager {
146146

147147
let handle = self.log_handle.clone().unwrap();
148148

149-
// TODO
150-
// evt_log_vec(&handle, &mut event_props);
149+
evt_log(&handle, &mut event_props);
151150
}
152151

153152
pub fn track_evt(&self, mut event_props: &mut [evt_prop]) {

wrappers/rust/oneds-telemetry/src/types.rs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use chrono::{DateTime, Utc};
88
use log::{debug, error};
99
use once_cell::sync::Lazy;
1010

11-
use cpp_client_telemetry_sys::{evt_prop, evt_prop_v, evt_prop_t_TYPE_STRING, evt_prop_t_TYPE_TIME};
11+
use cpp_client_telemetry_sys::{evt_prop, evt_prop_v, evt_prop_t_TYPE_STRING, evt_prop_t_TYPE_TIME, evt_prop_t_TYPE_INT64};
1212

1313
#[derive(Clone, Debug)]
1414
pub struct StringProperty {
@@ -107,9 +107,26 @@ impl TelemetryItem {
107107
for key in self.data.keys() {
108108
let value = self.data.get(key).expect("Unable to get value");
109109
match value {
110-
TelemetryProperty::String(value) => {}
111-
TelemetryProperty::Int(value) => {}
112-
_ => error!("Unknown TelemetryProperty Type: [{}]", key),
110+
TelemetryProperty::String(value) => {
111+
properties.push(evt_prop {
112+
name: StringProperty::new(key).as_ptr(),
113+
type_: evt_prop_t_TYPE_STRING,
114+
value: evt_prop_v {
115+
as_string: value.as_ptr()
116+
},
117+
piiKind: 0
118+
})
119+
}
120+
TelemetryProperty::Int(value) => {
121+
properties.push(evt_prop {
122+
name: StringProperty::new(key).as_ptr(),
123+
type_: evt_prop_t_TYPE_INT64,
124+
value: evt_prop_v {
125+
as_int64: value.clone()
126+
},
127+
piiKind: 0
128+
})
129+
}
113130
}
114131
}
115132

0 commit comments

Comments
 (0)