Function relay_base_schema::metrics::try_normalize_metric_name

source ยท
pub fn try_normalize_metric_name(name: &str) -> Option<Cow<'_, str>>
Expand description

Validates a metric name and normalizes it. This is the statsd name, i.e. without type or unit.

Metric names cannot be empty, must begin with a letter and can consist of ASCII alphanumerics, underscores, dashes, and periods. The implementation will further replace dashes with underscores.

The function validates that the first character of the metric must be ASCII alphanumeric, later consecutive invalid characters in the name will be replaced with underscores.