Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2024-06-27 06:20:11 +00:00
parent 00e2fbb908
commit 837e5eba97
15 changed files with 264 additions and 38 deletions

View File

@ -1 +1 @@
cab22ed596319359484966ded1f21bfbe3bd9796
117d83886351afe9c05c3a3464cba7e22bc234a3

View File

@ -1 +1 @@
9b8665b9d50d2be9880d85949ce5aea4afbd272d
df16e199eba9d1fe851e42b7842bab4bb6215ae2

View File

@ -3,8 +3,6 @@ import {
GlAlert,
GlBadge,
GlButton,
GlCard,
GlIcon,
GlLoadingIcon,
GlModalDirective,
GlKeysetPagination,
@ -15,6 +13,7 @@ import {
} from '@gitlab/ui';
import { __, s__, sprintf } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import CrudComponent from '~/vue_shared/components/crud_component.vue';
import { convertEnvironmentScope } from '~/ci/common/private/ci_environments_dropdown';
import {
DEFAULT_EXCEEDS_VARIABLE_LIMIT_TEXT,
@ -65,13 +64,12 @@ export default {
GlAlert,
GlBadge,
GlButton,
GlCard,
GlKeysetPagination,
GlLink,
GlIcon,
GlLoadingIcon,
GlTable,
GlModal,
CrudComponent,
},
directives: {
GlModalDirective,
@ -213,20 +211,14 @@ export default {
<template>
<div>
<gl-card
class="gl-new-card ci-variable-table"
header-class="gl-new-card-header"
body-class="gl-new-card-body gl-px-0"
<crud-component
:title="$options.i18n.title"
:count="variables.length"
icon="code"
class="ci-variable-table"
:data-testid="tableDataTestId"
>
<template #header>
<div class="gl-new-card-title-wrapper">
<h5 class="gl-new-card-title">{{ $options.i18n.title }}</h5>
<span class="gl-new-card-count">
<gl-icon name="code" class="gl-mr-2" />
{{ variables.length }}
</span>
</div>
<template #actions>
<div v-if="!isInheritedGroupVars" class="gl-new-card-actions gl-font-size-0">
<gl-button
v-if="!isTableEmpty"
@ -368,21 +360,22 @@ export default {
</div>
</template>
<template v-if="!isInheritedGroupVars" #cell(actions)="{ item }">
<div class="gl-display-flex gl-justify-content-end -gl-mt-2 -gl-mb-2">
<div class="gl-flex gl-justify-end gl-gap-2 -gl-mt-3 -gl-mb-2">
<gl-button
v-gl-tooltip
category="tertiary"
icon="pencil"
size="small"
class="gl-mr-3"
:title="$options.i18n.editButton"
:aria-label="$options.i18n.editButton"
data-testid="edit-ci-variable-button"
@click="setSelectedVariable(item.index)"
/>
<gl-button
v-gl-tooltip
v-gl-modal-directive="`delete-variable-${item.index}`"
variant="danger"
category="secondary"
category="tertiary"
icon="remove"
size="small"
:title="$options.i18n.deleteButton"
:aria-label="$options.i18n.deleteButton"
/>
<gl-modal
@ -411,7 +404,7 @@ export default {
>
{{ exceedsVariableLimitText }}
</gl-alert>
</gl-card>
</crud-component>
<div v-if="!isInheritedGroupVars">
<div v-if="showPagination" class="gl-display-flex gl-justify-content-center gl-mt-5">
<gl-keyset-pagination

View File

@ -9,7 +9,7 @@
.settings-content
= render 'ci/variables/attributes'
- if ci_variable_protected_by_default?
%p.settings-message.text-center.gl-mb-0
%p.settings-message.gl-text-center
- help_link = link_to('', help_page_path('ci/variables/index', anchor: 'protect-a-cicd-variable', target: '_blank', rel: 'noopener noreferrer'))
= safe_format(s_('Environment variables on this GitLab instance are configured to be %{help_link_start}protected%{help_link_end} by default.'), tag_pair(help_link, :help_link_start, :help_link_end))
#js-instance-variables{ data: { endpoint: admin_ci_variables_path, maskable_regex: ci_variable_maskable_regex, protected_by_default: ci_variable_protected_by_default?.to_s} }

View File

@ -2,8 +2,8 @@
name: show_role_details_in_drawer
feature_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/456280
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/152914
rollout_issue_url:
milestone: '17.1'
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/468669
milestone: '17.2'
group: group::authorization
type: wip
type: beta
default_enabled: false

View File

@ -14,3 +14,13 @@ allow_cross_foreign_keys:
- gitlab_main_clusterwide
sharding_key:
project_id: projects
schema_inconsistencies:
- type: missing_indexes
object_name: index_deployments_on_created_at
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/157136
- type: missing_indexes
object_name: index_deployments_on_id_and_status_and_created_at
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/157136
- type: missing_indexes
object_name: index_deployments_on_user_id_and_status_and_created_at
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/157136

View File

@ -0,0 +1,24 @@
# frozen_string_literal: true
class DropUnusedDeploymentsIndexes < Gitlab::Database::Migration[2.2]
disable_ddl_transaction!
milestone '17.2'
def up
prepare_async_index_removal :deployments, :created_at,
name: 'index_deployments_on_created_at'
prepare_async_index_removal :deployments, %i[id status created_at],
name: 'index_deployments_on_id_and_status_and_created_at'
prepare_async_index_removal :deployments, %i[user_id status created_at],
name: 'index_deployments_on_user_id_and_status_and_created_at'
end
def down
unprepare_async_index :deployments, :created_at,
name: 'index_deployments_on_created_at'
unprepare_async_index :deployments, %i[id status created_at],
name: 'index_deployments_on_id_and_status_and_created_at'
unprepare_async_index :deployments, %i[user_id status created_at],
name: 'index_deployments_on_user_id_and_status_and_created_at'
end
end

View File

@ -0,0 +1 @@
959939a04862d472807e17e9667abc82fc39b1c859e72d7e81fbb077e595d3a0

View File

@ -14,3 +14,4 @@ This page is a work in progress. If you have access to the GitLab Slack workspac
- [Quick start for internal event tracking](quick_start.md#quick-start-for-internal-event-tracking)
- [Migrating existing tracking to internal event tracking](migration.md)
- [Event definition guide](event_definition_guide.md)
- [Metric definition guide](metric_definition_guide.md)

View File

@ -0,0 +1,196 @@
---
stage: Monitor
group: Analytics Instrumentation
info: Any user with at least the Maintainer role can merge updates to this content. For details, see https://docs.gitlab.com/ee/development/development_processes.html#development-guidelines-review.
---
# Metrics definitions
Metrics are defined in YAML files located in subfolders of `config/metrics` and `ee/config/metrics`.
The YAML files are called metrics definitions.
This page describes the subsection of metric definitions with `data_source: internal_events`.
You can find a general overview of metric definition files in the [Metric Dictionary Guide](../metrics/metrics_dictionary.md)
## Supported metric types
Internal events supports three different metric types which are grouped like this:
1. All time total counters
1. Time framed total counters
1. Time framed unique counters
| Count type / Time frame | `7d` / `28d` | `all` |
|-------------------------|-----------------------------|-------------------------|
| **Total count** | Time framed total counters | All time total counters |
| **Unique count** | Time framed unique counters | |
You can tell if a metric is counting unique values or total values by looking at the [event selection rules](#event-selection-rules).
A snippet from a unique metric could look like below. Notice the `unique` property which defines which [identifier](event_definition_guide.md#event-definition-and-validation) of the `create_merge_request` event is used for counting the unique values.
```yaml
events:
- name: create_merge_request
unique: user_id
```
Similarly, a snippet from a total count metric can look like below. Notice how there is no `unique` property.
```yaml
events:
- name: create_merge_request
```
We can track multiple events within one metric via [aggregated metrics](#aggregated-metrics).
### All time total counters
Example: Total visits to /groups/:group/-/analytics/productivity_analytics all time
```yaml
data_category: optional
key_path: counts.productivity_analytics_views
description: Total visits to /groups/:group/-/analytics/productivity_analytics all time
product_group: optimize
value_type: number
status: active
time_frame: all
data_source: internal_events
events:
- name: view_productivity_analytics
distribution:
- ee
tier:
- premium
- ultimate
performance_indicator_type: []
milestone: "<13.9"
```
The combination of `time_frame: all` and the event selection rule under `events` referring to the
`view_productivity_analytics` event means that this is an "all time total count" metric.
### Time framed total counters
An example is: Weekly count of Runner usage CSV report exports
```yaml
key_path: counts.count_total_export_runner_usage_by_project_as_csv_weekly
description: Weekly count of Runner usage CSV report exports
product_group: runner
performance_indicator_type: []
value_type: number
status: active
milestone: '16.9'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/142328
data_source: internal_events
data_category: optional
distribution:
- ee
tier:
- ultimate
time_frame: 7d
events:
- name: export_runner_usage_by_project_as_csv
```
The combination of `time_frame: 7d` and the event selection rule under `events` referring to the
`export_runner_usage_by_project_as_csv` event means that this is a "timed framed total count" metric.
### Time framed unique counters
Example: Count of distinct users who opted to filter out anonymous users on the analytics dashboard view in the last 28 days.
```yaml
key_path: count_distinct_user_id_from_exclude_anonymised_users_28d
description: Count of distinct users who opted to filter out anonymous users on the analytics dashboard view in the last 28 days.
product_group: product_analytics
performance_indicator_type: []
value_type: number
status: active
milestone: '16.7'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/138150
time_frame: 28d
data_source: internal_events
data_category: optional
distribution:
- ee
tier:
- ultimate
events:
- name: exclude_anonymised_users
unique: user.id
```
The combination of `time_frame: 28d`, the event selection rule under `events` referring to the
`exclude_anonymised_users` event and the unique value (`unique: user.id`) means that this is a "timed framed unique count" metric.
## Event Selection Rules
Event selection rules are the parts which connects metric definitions and event definitions.
They are needed to know which metrics should be updated when an event is triggered.
Each internal event based metric should have a least one event selection rule with the following properties.
| Property | Required | Additional information |
|--------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `name` | yes | Name of the event |
| `unique` | no | Used if the metric should count the distinct number of users, projects or namespaces present in the event. Valid values are `user.id`, `project.id` and `namespace.id`. |
| `filter` | no | Used when only a subset of events should be included in the metric. Only additional properties can be used for filtering. |
An example of a single event selection rule which updates a unique count metric when an event called `pull_package` with additional property `label` with the value `rubygems` occurs:
```yaml
- name: pull_package
unique: user.id
filter:
label: rubygems
```
### Filters
Filters are used to constrain which events cause an metric to increase.
This filter includes only `pull_package` events with `label: rubygems`:
```yaml
- name: pull_package
filter:
label: rubygems
```
Whereas, this filter is even more restricted and only includes `pull_package` events with `label: rubygems` and `property: deploy_token`:
```yaml
- name: pull_package
filter:
label: rubygems
property: deploy_token
```
Filters only support matching of exact values and not wildcards or regular expressions.
## Aggregated metrics
A metric definition with several event selection rules can be considered an aggregated metric.
If you want to get total number of `pull_package` and `push_package` events you have to add two event selection rules:
```yaml
events:
- name: pull_package
- name: push_package
```
To get the number of unique users that have at least pushed or pulled a package once:
```yaml
events:
- name: pull_package
unique: user.id
- name: push_package
unique: user.id
```
Notice that unique metrics and total count metrics cannot be mixed in a single metric.

View File

@ -133,7 +133,7 @@ To enable product analytics on your instance:
1. On the left sidebar, at the bottom, select **Admin Area**.
1. Select **Settings > Analytics**.
1. Expand **Product analytics** and enter the configuration values.
1. Enter the configuration values.
1. Select **Save changes**.
### Project-level settings

View File

@ -1,5 +1,5 @@
variables:
AUTO_BUILD_IMAGE_VERSION: 'v4.1.0'
AUTO_BUILD_IMAGE_VERSION: 'v4.2.0'
build:
stage: build

View File

@ -1,5 +1,5 @@
variables:
AUTO_BUILD_IMAGE_VERSION: 'v4.1.0'
AUTO_BUILD_IMAGE_VERSION: 'v4.2.0'
build:
stage: build

View File

@ -47987,7 +47987,7 @@ msgstr ""
msgid "SecurityOrchestration|Only owners can update Security Policy Project"
msgstr ""
msgid "SecurityOrchestration|Override the following project settings:"
msgid "SecurityOrchestration|Override the following project settings"
msgstr ""
msgid "SecurityOrchestration|Overwrite the current CI/CD code with the new file's content?"

View File

@ -1,6 +1,7 @@
import { GlAlert, GlBadge, GlKeysetPagination, GlCard, GlIcon } from '@gitlab/ui';
import { GlAlert, GlBadge, GlKeysetPagination, GlIcon } from '@gitlab/ui';
import { sprintf } from '~/locale';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import CrudComponent from '~/vue_shared/components/crud_component.vue';
import CiVariableTable from '~/ci/ci_variable_list/components/ci_variable_table.vue';
import { EXCEEDS_VARIABLE_LIMIT_TEXT, projectString } from '~/ci/ci_variable_list/constants';
import { mockInheritedVariables, mockVariables } from '../mocks';
@ -52,7 +53,7 @@ describe('Ci variable table', () => {
const findGroupCiCdSettingsLink = (rowIndex) =>
wrapper.findAllByTestId('ci-variable-table-row-cicd-path').at(rowIndex).attributes('href');
const findKeysetPagination = () => wrapper.findComponent(GlKeysetPagination);
const findCard = () => wrapper.findComponent(GlCard);
const findCrud = () => wrapper.findComponent(CrudComponent);
const generateExceedsVariableLimitText = (entity, currentVariableCount, maxVariableLimit) => {
return sprintf(EXCEEDS_VARIABLE_LIMIT_TEXT, { entity, currentVariableCount, maxVariableLimit });
@ -61,18 +62,18 @@ describe('Ci variable table', () => {
describe('card', () => {
it('displays the correct title', () => {
createComponent();
expect(findCard().text()).toContain('CI/CD Variables');
expect(findCrud().text()).toContain('CI/CD Variables');
});
it('displays the correct icon', () => {
createComponent();
expect(findCard().findComponent(GlIcon).props('name')).toBe('code');
expect(findCrud().findComponent(GlIcon).props('name')).toBe('code');
});
it('displays the number of added CI/CD Variables', () => {
const variables = [1, 2, 3];
createComponent({ props: { variables } });
expect(findCard().text()).toContain(String(variables.length));
expect(findCrud().text()).toContain(String(variables.length));
});
});