Module glean.metrics.string
Classes
class StringMetricType (common_metric_data: glean._uniffi.glean.CommonMetricData)-
Expand source code
class StringMetricType: """ This implements the developer facing API for recording string metrics. Instances of this class type are automatically generated by `glean.load_metrics`, allowing developers to record values that were previously registered in the metrics.yaml file. The string API only exposes the `StringMetricType.set` method, which takes care of validating the input data and making sure that limits are enforced. """ def __init__(self, common_metric_data: CommonMetricData): self._inner = StringMetric(common_metric_data) def set(self, value: str) -> None: """ Set a string value. Args: value (str): This is a user-defined string value. If the length of the string exceeds the maximum length, it will be truncated. """ if value is None: return self._inner.set(value) def test_get_value(self, ping_name: Optional[str] = None) -> Optional[str]: return self._inner.test_get_value(ping_name) def test_get_num_recorded_errors(self, error_type: ErrorType) -> int: return self._inner.test_get_num_recorded_errors(error_type)This implements the developer facing API for recording string metrics.
Instances of this class type are automatically generated by
load_metrics(), allowing developers to record values that were previously registered in the metrics.yaml file.The string API only exposes the
StringMetricType.set()method, which takes care of validating the input data and making sure that limits are enforced.Methods
def set(self, value: str) ‑> None-
Expand source code
def set(self, value: str) -> None: """ Set a string value. Args: value (str): This is a user-defined string value. If the length of the string exceeds the maximum length, it will be truncated. """ if value is None: return self._inner.set(value)Set a string value.
Args
value:str- This is a user-defined string value. If the length of the string exceeds the maximum length, it will be truncated.
def test_get_num_recorded_errors(self, error_type: glean._uniffi.glean.ErrorType) ‑> int-
Expand source code
def test_get_num_recorded_errors(self, error_type: ErrorType) -> int: return self._inner.test_get_num_recorded_errors(error_type) def test_get_value(self, ping_name: str | None = None) ‑> str | None-
Expand source code
def test_get_value(self, ping_name: Optional[str] = None) -> Optional[str]: return self._inner.test_get_value(ping_name)