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
c4479f62
Commit
c4479f62
authored
Apr 14, 2021
by
alinamihaila
Committed by
Mikołaj Wawrzyniak
Apr 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean naming suggestions for Redis events
parent
bcd369a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
22 deletions
+14
-22
doc/development/usage_ping/index.md
doc/development/usage_ping/index.md
+14
-22
No files found.
doc/development/usage_ping/index.md
View file @
c4479f62
...
@@ -492,39 +492,32 @@ Implemented using Redis methods [PFADD](https://redis.io/commands/pfadd) and [PF
...
@@ -492,39 +492,32 @@ Implemented using Redis methods [PFADD](https://redis.io/commands/pfadd) and [PF
Example event:
Example event:
```
yaml
```
yaml
-
name
:
i_compliance_credential_inventory
-
name
:
users_creating_epics
category
:
compliance
category
:
epics_usage
redis_slot
:
compliance
redis_slot
:
users
expiry
:
42
# 6 weeks
aggregation
:
weekly
aggregation
:
weekly
feature_flag
:
usage_data_i_compliance_credential_inventor
y
feature_flag
:
track_epics_activit
y
```
```
Keys:
Keys:
-
`name`
: unique event name.
-
`name`
: unique event name.
Name format
`<prefix>_<redis_slot>_name
`.
Name format
for Redis HLL events `<name>_<redis_slot>
`.
Use one of the following prefixes for the event's name:
[See Metric name](metrics_dictionary.md#metric-name) for a complete guide on metric naming suggestion.
- `g_` for group, as an event which is tracked for group.
- `p_` for project, as an event which is tracked for project.
- `i_` for instance, as an event which is tracked for instance.
- `a_` for events encompassing all `g_`, `p_`, `i_`.
- `o_` for other.
Consider including in the event's name the Redis slot to be able to count totals for a specific category.
Consider including in the event's name the Redis slot to be able to count totals for a specific category.
Example names: `
i_compliance_credential_inventory`, `g_analytics_contribution
`.
Example names: `
users_creating_epics`, `users_triggering_security_scans
`.
-
`category`
: event category. Used for getting total counts for events in a category, for easier
-
`category`
: event category. Used for getting total counts for events in a category, for easier
access to a group of events.
access to a group of events.
-
`redis_slot`
: optional Redis slot; default value: event name. Used if needed to calculate totals
-
`redis_slot`
: optional Redis slot; default value: event name. Used if needed to calculate totals
for a group of metrics. Ensure keys are in the same slot. For example:
for a group of metrics. Ensure keys are in the same slot. For example:
`
i_compliance_credential_inventory`
with
`redis_slot: 'compliance
'`
builds Redis key
`
users_creating_epics`
with
`redis_slot: 'users
'`
builds Redis key
`
i_{compliance}_credential_inventory
-2020-34`
. If
`redis_slot`
is not defined the Redis key will
`
{users}_creating_epics
-2020-34`
. If
`redis_slot`
is not defined the Redis key will
be
`{
i_compliance_credential_inventory
}-2020-34`
.
be
`{
users_creating_epics
}-2020-34`
.
-
`expiry`
: expiry time in days. Default: 29 days for daily aggregation and 6 weeks for weekly
-
`expiry`
: expiry time in days. Default: 29 days for daily aggregation and 6 weeks for weekly
aggregation.
aggregation.
-
`aggregation`
: may be set to a
`:daily`
or
`:weekly`
key. Defines how counting data is stored in Redis.
-
`aggregation`
: may be set to a
`:daily`
or
`:weekly`
key. Defines how counting data is stored in Redis.
...
@@ -581,7 +574,7 @@ Use one of the following methods to track events:
...
@@ -581,7 +574,7 @@ Use one of the following methods to track events:
user:
current_user
,
subject:
user_group
user:
current_user
,
subject:
user_group
).
execute
).
execute
increment_unique_values
(
'
i_list
_repositories'
,
current_user
.
id
)
increment_unique_values
(
'
users_listing
_repositories'
,
current_user
.
id
)
present
paginate
(
repositories
),
with:
Entities
::
ContainerRegistry
::
Repository
,
tags:
params
[
:tags
],
tags_count:
params
[
:tags_count
]
present
paginate
(
repositories
),
with:
Entities
::
ContainerRegistry
::
Repository
,
tags:
params
[
:tags
],
tags_count:
params
[
:tags_count
]
end
end
...
@@ -655,15 +648,15 @@ Use one of the following methods to track events:
...
@@ -655,15 +648,15 @@ Use one of the following methods to track events:
Trigger events in rails console by using
`track_event`
method
Trigger events in rails console by using
`track_event`
method
```
ruby
```
ruby
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
.
track_event
(
'g_compliance_audit_events'
,
values:
1
)
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
.
track_event
(
'
users_viewin
g_compliance_audit_events'
,
values:
1
)
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
.
track_event
(
'g_compliance_audit_events'
,
values:
[
2
,
3
])
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
.
track_event
(
'
users_viewin
g_compliance_audit_events'
,
values:
[
2
,
3
])
```
```
Next, get the unique events for the current week.
Next, get the unique events for the current week.
```
ruby
```
ruby
# Get unique events for metric for current_week
# Get unique events for metric for current_week
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
.
unique_events
(
event_names:
'g_compliance_audit_events'
,
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
.
unique_events
(
event_names:
'
users_viewin
g_compliance_audit_events'
,
start_date:
Date
.
current
.
beginning_of_week
,
end_date:
Date
.
current
.
next_week
)
start_date:
Date
.
current
.
beginning_of_week
,
end_date:
Date
.
current
.
next_week
)
```
```
...
@@ -824,7 +817,6 @@ We return fallback values in these cases:
...
@@ -824,7 +817,6 @@ We return fallback values in these cases:
Add the metric in one of the top level keys
Add the metric in one of the top level keys
-
`license`
: for license related metrics.
-
`settings`
: for settings related metrics.
-
`settings`
: for settings related metrics.
-
`counts_weekly`
: for counters that have data for the most recent 7 days.
-
`counts_weekly`
: for counters that have data for the most recent 7 days.
-
`counts_monthly`
: for counters that have data for the most recent 28 days.
-
`counts_monthly`
: for counters that have data for the most recent 28 days.
...
...
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