ClickHouse data collector
-
Review changes -
-
Download -
Patches
-
Plain diff
What does this MR do and why?
ClickHouse data collector
Introduces feature flag clickhouse_data_collector
#420257 (closed)
Screenshots or screen recordings
No user-facing changes
How to set up and validate locally
Make sure you have GitLab Ultimate license on your local.
- Install and run the ClickHouse server as per these directions
!124295 (merged)
- If you do the one-line install rather than installing via
apt
, you can remove the password from theyml
file because the default user it comes with doesn't have a password. There is a way to set up other users or set a password, but for the purposes of testing I don't think it's necessary.
- Run the ClickHouse client, connecting to the
gitlab_clickhouse_test
database. - Create the
events
table into thegitlab_clickhouse_test
database (run the code as in thedb/click_house/main/20230705124511_create_events.sql
file in clickhouse client) - Create the
contribution_analytics_events
table - rundb/click_house/main/20230724064832_create_contribution_analytics_events.sql
file in this MR in clickhouse client - Create the materialised view - run
db/click_house/main/20230724064918_contribution_analytics_events_materialized_view.sql
in this MR in clickhouse client
OR as @ahegyi says: just do #414938 (closed)
- Find a project with some MR activity (code pushes, etc) or seed some.
- Fill out the table:
def format_row(event)
namespace = event.project.try(:project_namespace) || event.group
path = namespace.traversal_ids.join('/')
action = Event.actions[event.action]
[
event.id,
"'#{path}/'",
event.author_id,
event.target_id,
"'#{event.target_type}'",
action,
event.created_at.to_f,
event.updated_at.to_f
].join(',')
end
values = []
Event.all.each do |event|
values << "(#{format_row(event)})"
end
insert_query = <<~SQL
INSERT INTO events
(id, path, author_id, target_id, target_type, action, created_at, updated_at)
VALUES
#{values.join(',')}
SQL
ClickHouse::Client.execute(insert_query, :main)
- Tail logs
tail -f log/development.log
- To get the data:
- PG: make sure
Feature.enabled?(:clickhouse_data_collection)
isfalse
- CH: make sure
Feature.enabled?(:clickhouse_data_collection)
istrue
Using the GDK group flightjs
:
{
group(fullPath: "flightjs") {
contributions(from: "2023-06-01", to: "2023-08-01") {
nodes {
user {
id
}
totalEvents
repoPushed
}
}
}
}
Try with the FF off first, note the result, and then with FF on. The resulting data should be the same. If the FF is off, you'll see a MATERIALIZED VIEW
query hit the Postgres DB. If the FF is on, it will be missing.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #414610 (closed)
Edited by Pedro Pombeiro
Merge request reports
Compare and
- version 35c8a57531
- version 345fb00aa5
- version 3359bf7ad4
- version 327fd717e1
- version 318d7e009d
- version 30e9f72641
- version 29e48f53f3
- version 28711b40af
- version 27865cc8a7
- version 26fb3070b6
- version 256117b158
- version 246db16f15
- version 234bcd5d9c
- version 226b976159
- version 2160ac0d5b
- version 20cde40f9b
- version 19b976eece
- version 184536f909
- version 179cabc7f8
- version 169ec21de9
- version 15013cdbc7
- version 14e8575adb
- version 13c924945d
- version 1216d1becd
- version 113a117beb
- version 10f0ba8a97
- version 952760dac
- version 8db307ee1
- version 7efc748d9
- version 6cdc57251
- version 5b21dbccc
- version 41df9580b
- version 3f1c3f366
- version 22fce0485
- version 15fba6db9
- master (base)
- latest version1987b06d1 commit,
- version 35c8a575311 commit,
- version 345fb00aa51 commit,
- version 3359bf7ad45 commits,
- version 327fd717e14 commits,
- version 318d7e009d4 commits,
- version 30e9f726414 commits,
- version 29e48f53f34 commits,
- version 28711b40af4 commits,
- version 27865cc8a74 commits,
- version 26fb3070b64 commits,
- version 256117b1584 commits,
- version 246db16f154 commits,
- version 234bcd5d9c5 commits,
- version 226b9761595 commits,
- version 2160ac0d5b5 commits,
- version 20cde40f9b5 commits,
- version 19b976eece4 commits,
- version 184536f9094 commits,
- version 179cabc7f84 commits,
- version 169ec21de94 commits,
- version 15013cdbc74 commits,
- version 14e8575adb4 commits,
- version 13c924945d4 commits,
- version 1216d1becd4 commits,
- version 113a117beb4 commits,
- version 10f0ba8a974 commits,
- version 952760dac4 commits,
- version 8db307ee14 commits,
- version 7efc748d94 commits,
- version 6cdc572514 commits,
- version 5b21dbccc4 commits,
- version 41df9580b4 commits,
- version 3f1c3f3664 commits,
- version 22fce04854 commits,
- version 15fba6db98 commits,
12 files
+ 390
− 194
Compare changes
- Side-by-side
- Inline
Files
12+ 8
− 0
Loading