Skip to content

Track event for downloading group coverage CSV

Erick Bajao requested to merge eb-track-group-coverage-csv-download into master

What does this MR do?

Solves #221064 (closed)

This tracks the event when the CSV of a group's code coverage is downloaded.

Screenshots

This is what I get when I do GET http://localhost:9090/micro/good after downloading the CSV:

[
    {
        "event": {
            "api": {
                "vendor": "com.snowplowanalytics.snowplow",
                "version": "tp2"
            },
            "parameters": {
                "e": "pp",
                "f_qt": "0",
                "duid": "6af99103-8565-45ed-bbb5-3bfe7aa563e1",
                "vid": "3",
                "pp_miy": "0",
                "f_ag": "0",
                "eid": "648065ff-ccdb-400b-a8f5-269ccf84a7ed",
                "url": "http://gitlab.gdk:3000/groups/boomer/-/insights/#/issues",
                "refr": "http://gitlab.gdk:3000/groups/boomer/-/insights/#/",
                "aid": "gitlab",
                "cx": "eyJzY2hlbWEiOiJpZ2x1OmNvbS5zbm93cGxvd2FuYWx5dGljcy5zbm93cGxvdy9jb250ZXh0cy9qc29uc2NoZW1hLzEtMC0wIiwiZGF0YSI6W3sic2NoZW1hIjoiaWdsdTpjb20uc25vd3Bsb3dhbmFseXRpY3Muc25vd3Bsb3cvd2ViX3BhZ2UvanNvbnNjaGVtYS8xLTAtMCIsImRhdGEiOnsiaWQiOiJlMTZiN2ZjOC0xMWY5LTQxNGYtODM0NS01MDI2YTU3MzM1N2MifX1dfQ",
                "f_dir": "0",
                "tna": "gl",
                "cs": "UTF-8",
                "cd": "24",
                "page": "Insights · boomer · GitLab",
                "stm": "1598966535392",
                "tz": "Asia/Shanghai",
                "f_pdf": "1",
                "pp_may": "0",
                "f_java": "0",
                "tv": "js-2.10.0",
                "vp": "1920x848",
                "ds": "1905x1743",
                "f_realp": "0",
                "res": "1920x1080",
                "f_fla": "0",
                "cookie": "1",
                "p": "web",
                "dtm": "1598966535388",
                "pp_mix": "0",
                "f_gears": "0",
                "lang": "en-US",
                "sid": "879d11db-f316-4648-ab58-6b94c51b0a34",
                "f_wma": "0",
                "pp_max": "0"
            },
            "contentType": "application/json",
            "source": {
                "name": "ssc-0.15.0-stdout$",
                "encoding": "UTF-8",
                "hostname": "localhost"
            },
            "context": {
                "timestamp": "2020-09-01T13:22:15.423Z",
                "ipAddress": "172.17.0.1",
                "useragent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36",
                "refererUri": "http://gitlab.gdk:3000/",
                "headers": [
                    "Host: localhost:9090",
                    "Connection: keep-alive",
                    "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36",
                    "Accept: */*",
                    "Origin: http://gitlab.gdk:3000",
                    "Sec-Fetch-Site: cross-site",
                    "Sec-Fetch-Mode: cors",
                    "Sec-Fetch-Dest: empty",
                    "Referer: http://gitlab.gdk:3000/",
                    "Accept-Encoding: gzip, deflate, br",
                    "Accept-Language: en-US, en;q=0.9",
                    "Timeout-Access: <function1>",
                    "application/json"
                ],
                "userId": "ee9b210d-eaee-4118-96c8-fd8a543048fe"
            }
        },
        "eventType": "pp",
        "schema": null,
        "contexts": [
            "iglu:com.snowplowanalytics.snowplow/web_page/jsonschema/1-0-0"
        ]
    },
    {
        "event": {
            "api": {
                "vendor": "com.snowplowanalytics.snowplow",
                "version": "tp1"
            },
            "parameters": {
                "e": "se",
                "se_va": "54",
                "eid": "5f52c36f-10f8-4cb5-aff0-7c2dde9efdc6",
                "aid": "gitlab",
                "tna": "gl",
                "stm": "1598966521815",
                "tv": "rb-0.6.1",
                "se_ac": "download_csv",
                "se_la": "group_id",
                "se_ca": "Groups::Analytics::CoverageReportsController",
                "p": "srv",
                "dtm": "1598966521812"
            },
            "contentType": null,
            "source": {
                "name": "ssc-0.15.0-stdout$",
                "encoding": "UTF-8",
                "hostname": "localhost"
            },
            "context": {
                "timestamp": "2020-09-01T13:22:01.833Z",
                "ipAddress": "172.17.0.1",
                "useragent": "Ruby",
                "refererUri": null,
                "headers": [
                    "Accept-Encoding: gzip, deflate;q=0.6, identity;q=0.3",
                    "Accept: */*",
                    "User-Agent: Ruby",
                    "Connection: close",
                    "Host: localhost:9090",
                    "Timeout-Access: <function1>"
                ],
                "userId": "2b87a19f-a003-4aa2-b451-a2eeffe8a189"
            }
        },
        "eventType": "se",
        "schema": null,
        "contexts": null
    }
]

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Erick Bajao

Merge request reports