Closed poulok closed 9 months ago
Noting here to discuss with @tannerjfco:
We decided to log an error if a metric violates a rule, and not throw an exception. The log message will fail nightly tests but not cause problems in a production network.
Additionally, check the unit name for compatibility because the unit is appended to the metric name.
List of decisions made after discussing with @hendrikebbers | Option 1 | Option 2 |
---|---|---|
Throw exception | Log Error | |
Design | ✓ | |
Not Required | Required for Metrics Supporting Units | |
Unit | ✓ | |
suffix of the name | Prometheus handle | |
Unit | ✓ | |
Fixed values | Free values | |
Unit | ✓ | |
Create and assert naming conventions | Free values | |
Naming Style | ✓ | |
Validate In Metrics Framework | Validate in Prometheus adapter | |
Design | ✓ | |
Extension | Performance | |
Design | ✓ |
There are currently no restrictions on what characters can be used in metric names. Some characters cause problems for systems like Prometheus and Elastic to ingest. There are currently scripts that modify metric names to make them compatible with other systems.
Metric names should be validated at the time of creation. There are at least two options for this:
Elastic converter: https://github.com/swirlds/infrastructure/blob/master/hedera-utils/PipelineGenerator.py Prometheus converter:
com.swirlds.common.metrics.platform.prometheus.NameConverter