Skip to content

Migrate "agent_users_using_ci_tunnel" event to internal tracking

What does this MR do and why?

This MR migrates agent_users_using_ci_tunnel metrics to the internal event tracking. This is to populate the metrics with user, project, and namespace.

agent_users_using_ci_tunnel event is equivalent to the aggregation of three events: k8s_api_proxy_requests_unique_users_via_ci_access, k8s_api_proxy_requests_unique_users_via_user_access, and k8s_api_proxy_requests_unique_users_via_pat_access. For more context about metrics: #428008 (comment 1694459378).

It follows Migrating from tracking with RedisHLL for migration.

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
        }
      ]
    }
  }'

To skip authentication with JWT token, comment out here: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/api/helpers/kubernetes/agent_helpers.rb#L10

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.

Edited by Taka Nishida

Merge request reports

Loading