Commit 78c7aa2f authored by Alper Akgun's avatar Alper Akgun

Merge branch 'aa-docs-for-usage-data-add-method' into 'master'

Docs for usage data add method

See merge request gitlab-org/gitlab!54804
parents 41376fac 24b6f3ed
...@@ -742,7 +742,7 @@ Arguments: ...@@ -742,7 +742,7 @@ Arguments:
- or a `block`: which is evaluated - or a `block`: which is evaluated
- `fallback: -1`: the common value used for any metrics that are failing. - `fallback: -1`: the common value used for any metrics that are failing.
Example of usage: Usage:
```ruby ```ruby
alt_usage_data { Gitlab::VERSION } alt_usage_data { Gitlab::VERSION }
...@@ -750,6 +750,17 @@ alt_usage_data { Gitlab::CurrentSettings.uuid } ...@@ -750,6 +750,17 @@ alt_usage_data { Gitlab::CurrentSettings.uuid }
alt_usage_data(999) alt_usage_data(999)
``` ```
### Adding counters to build new metrics
When adding the results of two counters, use the `add` usage data method that
handles fallback values and exceptions. It also generates a valid SQL export.
Example usage:
```ruby
add(User.active, User.bot)
```
### Prometheus Queries ### Prometheus Queries
In those cases where operational metrics should be part of Usage Ping, a database or Redis query is unlikely In those cases where operational metrics should be part of Usage Ping, a database or Redis query is unlikely
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment