Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4e9ec002
Commit
4e9ec002
authored
Oct 01, 2020
by
Alper Akgun
Committed by
Mike Jang
Oct 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Doc for usage data batch counts by a grouped relation
parent
5eeb1b78
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
doc/development/telemetry/usage_ping.md
doc/development/telemetry/usage_ping.md
+19
-0
No files found.
doc/development/telemetry/usage_ping.md
View file @
4e9ec002
...
...
@@ -223,6 +223,25 @@ Examples:
sum
(
JiraImportState
.
finished
,
:imported_issues_count
)
```
### Grouping & Batch Operations
The
`count`
,
`distinct_count`
, and
`sum`
batch counters can accept an
`ActiveRecord::Relation`
object, which groups by a specified column. With a grouped relation, the methods do batch counting,
handle errors, and returns a hash table of key-value pairs.
Examples:
```
ruby
count
(
Namespace
.
group
(
:type
))
# returns => {nil=>179, "Group"=>54}
distinct_count
(
Project
.
group
(
:visibility_level
),
:creator_id
)
# returns => {0=>1, 10=>1, 20=>11}
sum
(
Issue
.
group
(
:state_id
),
:weight
))
# returns => {1=>3542, 2=>6820}
```
### Redis Counters
Handles
`::Redis::CommandError`
and
`Gitlab::UsageDataCounters::BaseCounter::UnknownEvent`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment