Module glean.metrics.object
Classes
class ObjectMetric (meta: CommonMetricData)-
Expand source code
class ObjectMetric(ObjectMetricProtocol): _handle: ctypes.c_uint64 def __init__(self, meta: CommonMetricData): _UniffiFfiConverterTypeCommonMetricData.check_lower(meta) _uniffi_lowered_args = ( _UniffiFfiConverterTypeCommonMetricData.lower(meta), ) _uniffi_lift_return = _UniffiFfiConverterTypeObjectMetric.lift _uniffi_error_converter = None _uniffi_ffi_result = _uniffi_rust_call_with_error( _uniffi_error_converter, _UniffiLib.uniffi_glean_core_fn_constructor_objectmetric_new, *_uniffi_lowered_args, ) self._handle = _uniffi_ffi_result def __del__(self): # In case of partial initialization of instances. handle = getattr(self, "_handle", None) if handle is not None: _uniffi_rust_call(_UniffiLib.uniffi_glean_core_fn_free_objectmetric, handle) def _uniffi_clone_handle(self): return _uniffi_rust_call(_UniffiLib.uniffi_glean_core_fn_clone_objectmetric, self._handle) # Used by alternative constructors or any methods which return this type. @classmethod def _uniffi_make_instance(cls, handle): # Lightly yucky way to bypass the usual __init__ logic # and just create a new instance with the required handle. inst = cls.__new__(cls) inst._handle = handle return inst def record_schema_error(self, ) -> None: _uniffi_lowered_args = ( self._uniffi_clone_handle(), ) _uniffi_lift_return = lambda val: None _uniffi_error_converter = None _uniffi_ffi_result = _uniffi_rust_call_with_error( _uniffi_error_converter, _UniffiLib.uniffi_glean_core_fn_method_objectmetric_record_schema_error, *_uniffi_lowered_args, ) return _uniffi_lift_return(_uniffi_ffi_result) def set_string(self, object: str) -> None: _UniffiFfiConverterString.check_lower(object) _uniffi_lowered_args = ( self._uniffi_clone_handle(), _UniffiFfiConverterString.lower(object), ) _uniffi_lift_return = lambda val: None _uniffi_error_converter = None _uniffi_ffi_result = _uniffi_rust_call_with_error( _uniffi_error_converter, _UniffiLib.uniffi_glean_core_fn_method_objectmetric_set_string, *_uniffi_lowered_args, ) return _uniffi_lift_return(_uniffi_ffi_result) def test_get_num_recorded_errors(self, error: ErrorType) -> int: _UniffiFfiConverterTypeErrorType.check_lower(error) _uniffi_lowered_args = ( self._uniffi_clone_handle(), _UniffiFfiConverterTypeErrorType.lower(error), ) _uniffi_lift_return = _UniffiFfiConverterInt32.lift _uniffi_error_converter = None _uniffi_ffi_result = _uniffi_rust_call_with_error( _uniffi_error_converter, _UniffiLib.uniffi_glean_core_fn_method_objectmetric_test_get_num_recorded_errors, *_uniffi_lowered_args, ) return _uniffi_lift_return(_uniffi_ffi_result) def test_get_value(self, ping_name: typing.Union[object, typing.Optional[str]] = _DEFAULT) -> typing.Optional[JsonValue]: if ping_name is _DEFAULT: ping_name = None _UniffiFfiConverterOptionalString.check_lower(ping_name) _uniffi_lowered_args = ( self._uniffi_clone_handle(), _UniffiFfiConverterOptionalString.lower(ping_name), ) _uniffi_lift_return = _UniffiFfiConverterOptionalTypeJsonValue.lift _uniffi_error_converter = None _uniffi_ffi_result = _uniffi_rust_call_with_error( _uniffi_error_converter, _UniffiLib.uniffi_glean_core_fn_method_objectmetric_test_get_value, *_uniffi_lowered_args, ) return _uniffi_lift_return(_uniffi_ffi_result)Base class for protocol classes.
Protocol classes are defined as::
class Proto(Protocol): def meth(self) -> int: ...Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).
For example::
class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type checkSee PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as::
class GenProto[T](Protocol): def meth(self) -> T: ...Ancestors
- glean._uniffi.glean.ObjectMetricProtocol
- typing.Protocol
- typing.Generic
Methods
def record_schema_error(self) ‑> None-
Expand source code
def record_schema_error(self, ) -> None: _uniffi_lowered_args = ( self._uniffi_clone_handle(), ) _uniffi_lift_return = lambda val: None _uniffi_error_converter = None _uniffi_ffi_result = _uniffi_rust_call_with_error( _uniffi_error_converter, _UniffiLib.uniffi_glean_core_fn_method_objectmetric_record_schema_error, *_uniffi_lowered_args, ) return _uniffi_lift_return(_uniffi_ffi_result) def set_string(self, object: str) ‑> None-
Expand source code
def set_string(self, object: str) -> None: _UniffiFfiConverterString.check_lower(object) _uniffi_lowered_args = ( self._uniffi_clone_handle(), _UniffiFfiConverterString.lower(object), ) _uniffi_lift_return = lambda val: None _uniffi_error_converter = None _uniffi_ffi_result = _uniffi_rust_call_with_error( _uniffi_error_converter, _UniffiLib.uniffi_glean_core_fn_method_objectmetric_set_string, *_uniffi_lowered_args, ) return _uniffi_lift_return(_uniffi_ffi_result) def test_get_num_recorded_errors(self, error: ErrorType) ‑> int-
Expand source code
def test_get_num_recorded_errors(self, error: ErrorType) -> int: _UniffiFfiConverterTypeErrorType.check_lower(error) _uniffi_lowered_args = ( self._uniffi_clone_handle(), _UniffiFfiConverterTypeErrorType.lower(error), ) _uniffi_lift_return = _UniffiFfiConverterInt32.lift _uniffi_error_converter = None _uniffi_ffi_result = _uniffi_rust_call_with_error( _uniffi_error_converter, _UniffiLib.uniffi_glean_core_fn_method_objectmetric_test_get_num_recorded_errors, *_uniffi_lowered_args, ) return _uniffi_lift_return(_uniffi_ffi_result) def test_get_value(self,
ping_name: typing.Union[object, typing.Optional[str]] = <object object>) ‑> str | None-
Expand source code
def test_get_value(self, ping_name: typing.Union[object, typing.Optional[str]] = _DEFAULT) -> typing.Optional[JsonValue]: if ping_name is _DEFAULT: ping_name = None _UniffiFfiConverterOptionalString.check_lower(ping_name) _uniffi_lowered_args = ( self._uniffi_clone_handle(), _UniffiFfiConverterOptionalString.lower(ping_name), ) _uniffi_lift_return = _UniffiFfiConverterOptionalTypeJsonValue.lift _uniffi_error_converter = None _uniffi_ffi_result = _uniffi_rust_call_with_error( _uniffi_error_converter, _UniffiLib.uniffi_glean_core_fn_method_objectmetric_test_get_value, *_uniffi_lowered_args, ) return _uniffi_lift_return(_uniffi_ffi_result)
class ObjectSerialize-
Expand source code
class ObjectSerialize: """ A class that can be converted into key-value pairs of event extras. This will be automatically implemented for event properties of an [ObjectMetricType]. """ def into_serialized_object(self) -> str: """ Convert the event extras into a key-value dict: """ return json.dumps(self, cls=EncodeObject)A class that can be converted into key-value pairs of event extras. This will be automatically implemented for event properties of an [ObjectMetricType].
Methods
def into_serialized_object(self) ‑> str-
Expand source code
def into_serialized_object(self) -> str: """ Convert the event extras into a key-value dict: """ return json.dumps(self, cls=EncodeObject)Convert the event extras into a key-value dict: