diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-28 12:10:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-28 12:10:15 +0300 |
commit | 25788905108838d95a62d7e3ad3ca16e6f6d0fda (patch) | |
tree | 72f4cb84b9ad509d4bda9aa838a751d123082708 /doc/development/service_ping | |
parent | 5431dbfffcd7ae1cacc9b68b719b0e8fea29e6a4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development/service_ping')
-rw-r--r-- | doc/development/service_ping/metrics_instrumentation.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/doc/development/service_ping/metrics_instrumentation.md b/doc/development/service_ping/metrics_instrumentation.md index 4b00d1fc56d..759e1cf11df 100644 --- a/doc/development/service_ping/metrics_instrumentation.md +++ b/doc/development/service_ping/metrics_instrumentation.md @@ -41,7 +41,7 @@ We have built a domain-specific language (DSL) to define the metrics instrumenta You can use database metrics to track data kept in the database, for example, a count of issues that exist on a given instance. - `operation`: Operations for the given `relation`, one of `count`, `distinct_count`, `sum`, and `average`. -- `relation`: `ActiveRecord::Relation` for the objects we want to perform the `operation`. +- `relation`: Assigns lambda that returns the `ActiveRecord::Relation` for the objects we want to perform the `operation`. The assigned lambda can accept up to one parameter. The parameter is hashed and stored under the `options` key in the metric definition. - `start`: Specifies the start value of the batch counting, by default is `relation.minimum(:id)`. - `finish`: Specifies the end value of the batch counting, by default is `relation.maximum(:id)`. - `cache_start_and_finish_as`: Specifies the cache key for `start` and `finish` values and sets up caching them. Use this call when `start` and `finish` are expensive queries that should be reused between different metric calculations. @@ -55,10 +55,10 @@ module Gitlab module Usage module Metrics module Instrumentations - class CountBoardsMetric < DatabaseMetric + class CountIssuesMetric < DatabaseMetric operation :count - relation { Board } + relation ->(options) { Issue.where(confidential: options[:confidential]) } end end end |