Struct glean_core::metrics::ObjectMetric
source · pub struct ObjectMetric { /* private fields */ }
Expand description
An object metric.
Record structured data. The value must adhere to a predefined structure and is serialized into JSON.
Implementations§
source§impl ObjectMetric
impl ObjectMetric
sourcepub fn new(meta: CommonMetricData) -> Self
pub fn new(meta: CommonMetricData) -> Self
Creates a new object metric.
sourcepub fn set(&self, value: JsonValue)
pub fn set(&self, value: JsonValue)
Sets to the specified structure.
No additional verification is done. The shape needs to be externally verified.
Arguments
value
- the value to set.
sourcepub fn set_string(&self, object: String)
pub fn set_string(&self, object: String)
Sets to the specified structure.
Parses the passed JSON string. If it can’t be parsed into a valid object it records an invalid value error.
Note: This does not check the structure. This needs to be done by the wrapper.
Arguments
object
- JSON representation of the object to set.
sourcepub fn record_schema_error(&self)
pub fn record_schema_error(&self)
Record an InvalidValue
error for this metric.
Only to be used by the RLB.
sourcepub fn test_get_value(&self, ping_name: Option<String>) -> Option<JsonValue>
pub fn test_get_value(&self, ping_name: Option<String>) -> Option<JsonValue>
Test-only API (exported for FFI purposes).
Gets the currently stored value as JSON.
This doesn’t clear the stored value.
sourcepub fn test_get_num_recorded_errors(&self, error: ErrorType) -> i32
pub fn test_get_num_recorded_errors(&self, error: ErrorType) -> i32
Trait Implementations§
source§impl Clone for ObjectMetric
impl Clone for ObjectMetric
source§fn clone(&self) -> ObjectMetric
fn clone(&self) -> ObjectMetric
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ObjectMetric
impl Debug for ObjectMetric
source§impl MetricType for ObjectMetric
impl MetricType for ObjectMetric
Auto Trait Implementations§
impl RefUnwindSafe for ObjectMetric
impl Send for ObjectMetric
impl Sync for ObjectMetric
impl Unpin for ObjectMetric
impl UnwindSafe for ObjectMetric
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<>
Read more