Enable /track_event(s) as official way to track events
What does this MR do and why?
This MR documents /track_event(s)
endpoints as official way to track InternalEvents from the systems outside of GitLab instance.
The code changes allow users to optionally skip sending specific events to Snowplow.
This can be achieved by adding a skip_sending_to_snowplow
parameter when tracking events.
By default, events will still be sent to Snowplow, but this new feature provides more control over which events are shared with the platform.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
example request:
$ curl --header "PRIVATE-TOKEN: <YOUR API scope PAT>" \
--header "Content-Type: application/json" \
--request POST \
--data '{"event":"web_ide_viewed","namespace_id":1,"project_id":1,"additional_properties":{"lang": "eng"}}' \
"http://localhost:3000/api/v4/usage_data/track_event"
200%
or
$ curl --header "PRIVATE-TOKEN: <YOUR API scope PAT>" \
--header "Content-Type: application/json" \
--request POST \
--data '{"events":[{"event":"web_ide_viewed","namespace_id":1,"project_id":1,"additional_properties":{"lang": "eng"}}
,{"event":"web_ide_viewed","namespace_id":2,"project_id":2,"additional_properties":{"lang": "eng"}}]}' \
"http://localhost:3000/api/v4/usage_data/track_events"
200%
Related to #478781 (closed)