Receive and track events from Gitlab Agent for Kubernetes
What does this MR do and why?
This MR receives k8s api events from GitLab Kubernetes Agent (KAS) through newly added API endpoint kubernetes/agent_events
.
It will track events with user id and project id, using new internal event tracking.
Adding new endpoint, separated from kubernetes/usage_metrics
, is because the new internal event tracking tracks "events", not "metrics". We used to track metrics using kubernetes/usage_metrics
, but I suppose it is more straightforward to receive events and track them. In this way, we can further improve it by adding more attribute such as namespace
for each event.
Part of #428008 (closed).
How to set up and validate locally
This curl
request can imitate the request sent by KAS.
$ curl --request POST \
--url "https://gdk.test:3443/api/v4/internal/kubernetes/agent_events" \
--header "Gitlab-Kas-Api-Request: <JWT token>" \
--header "Content-Type: application/json" \
--data '{
"events": {
"k8s_api_proxy_requests_unique_users_via_ci_access": [
{
"user_id": 1,
"project_id": 1
}
]
}
}'
Numbered steps to set up and validate the change are strongly suggested.
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.