@@ -11,7 +11,7 @@ This guide describes how to develop Service Ping metrics using metrics instrumen
...
@@ -11,7 +11,7 @@ This guide describes how to develop Service Ping metrics using metrics instrumen
## Nomenclature
## Nomenclature
-**Instrumentation class**:
-**Instrumentation class**:
- Inherits one of the metric classes: `DatabaseMetric`, `RedisHLLMetric` or `GenericMetric`.
- Inherits one of the metric classes: `DatabaseMetric`, `RedisMetric`, `RedisHLLMetric` or `GenericMetric`.
- Implements the logic that calculates the value for a Service Ping metric.
- Implements the logic that calculates the value for a Service Ping metric.
-**Metric definition**
-**Metric definition**
...
@@ -24,7 +24,7 @@ This guide describes how to develop Service Ping metrics using metrics instrumen
...
@@ -24,7 +24,7 @@ This guide describes how to develop Service Ping metrics using metrics instrumen
A metric definition has the [`instrumentation_class`](metrics_dictionary.md) field, which can be set to a class.
A metric definition has the [`instrumentation_class`](metrics_dictionary.md) field, which can be set to a class.
The defined instrumentation class should have one of the existing metric classes: `DatabaseMetric`, `RedisHLLMetric`, or `GenericMetric`.
The defined instrumentation class should have one of the existing metric classes: `DatabaseMetric`, `RedisMetric`, `RedisHLLMetric`, or `GenericMetric`.
Using the instrumentation classes ensures that metrics can fail safe individually, without breaking the entire
Using the instrumentation classes ensures that metrics can fail safe individually, without breaking the entire
process of Service Ping generation.
process of Service Ping generation.
...
@@ -50,6 +50,20 @@ module Gitlab
...
@@ -50,6 +50,20 @@ module Gitlab
end
end
end
end
```
```
## Redis metrics
[Example of a merge request that adds a `Redis` metric](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66582).
Count unique values for `source_code_pushes` event.
```yaml
time_frame:all
data_source:redis
instrumentation_class:'RedisMetric'
options:
event:pushes
counter_class:SourceCodeCounter
```
## Redis HyperLogLog metrics
## Redis HyperLogLog metrics
...
@@ -60,7 +74,7 @@ Count unique values for `i_quickactions_approve` event.
...
@@ -60,7 +74,7 @@ Count unique values for `i_quickactions_approve` event.