Commit f2c0274a authored by Mikolaj Wawrzyniak's avatar Mikolaj Wawrzyniak Committed by Dhiraj Bodicherla

Remove metrics_dashboard_annotations feature flag

Because we want to make annotations public available we need
to remove feature flag.
parent d6cfb4ac
...@@ -13,11 +13,7 @@ import trackDashboardLoad from '../monitoring_tracking_helper'; ...@@ -13,11 +13,7 @@ import trackDashboardLoad from '../monitoring_tracking_helper';
import getEnvironments from '../queries/getEnvironments.query.graphql'; import getEnvironments from '../queries/getEnvironments.query.graphql';
import getAnnotations from '../queries/getAnnotations.query.graphql'; import getAnnotations from '../queries/getAnnotations.query.graphql';
import statusCodes from '../../lib/utils/http_status'; import statusCodes from '../../lib/utils/http_status';
import { import { backOff, convertObjectPropsToCamelCase } from '../../lib/utils/common_utils';
backOff,
convertObjectPropsToCamelCase,
isFeatureFlagEnabled,
} from '../../lib/utils/common_utils';
import { s__, sprintf } from '../../locale'; import { s__, sprintf } from '../../locale';
import { import {
...@@ -116,14 +112,7 @@ export const clearExpandedPanel = ({ commit }) => { ...@@ -116,14 +112,7 @@ export const clearExpandedPanel = ({ commit }) => {
export const fetchData = ({ dispatch }) => { export const fetchData = ({ dispatch }) => {
dispatch('fetchEnvironmentsData'); dispatch('fetchEnvironmentsData');
dispatch('fetchDashboard'); dispatch('fetchDashboard');
/**
* Annotations data is not yet fetched. This will be
* ready after the BE piece is implemented.
* https://gitlab.com/gitlab-org/gitlab/-/issues/211330
*/
if (isFeatureFlagEnabled('metricsDashboardAnnotations')) {
dispatch('fetchAnnotations'); dispatch('fetchAnnotations');
}
}; };
// Metrics dashboard // Metrics dashboard
......
...@@ -9,7 +9,6 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -9,7 +9,6 @@ class Projects::EnvironmentsController < Projects::ApplicationController
authorize_metrics_dashboard! authorize_metrics_dashboard!
push_frontend_feature_flag(:prometheus_computed_alerts) push_frontend_feature_flag(:prometheus_computed_alerts)
push_frontend_feature_flag(:metrics_dashboard_annotations, project)
end end
before_action :authorize_read_environment! before_action :authorize_read_environment!
before_action :authorize_create_environment!, only: [:new, :create] before_action :authorize_create_environment!, only: [:new, :create]
......
...@@ -18,7 +18,6 @@ module Resolvers ...@@ -18,7 +18,6 @@ module Resolvers
def resolve(**args) def resolve(**args)
return [] unless dashboard return [] unless dashboard
return [] unless Feature.enabled?(:metrics_dashboard_annotations, dashboard.environment&.project)
::Metrics::Dashboards::AnnotationsFinder.new(dashboard: dashboard, params: args).execute ::Metrics::Dashboards::AnnotationsFinder.new(dashboard: dashboard, params: args).execute
end end
......
...@@ -11,8 +11,7 @@ module Types ...@@ -11,8 +11,7 @@ module Types
description: 'Path to a file with the dashboard definition' description: 'Path to a file with the dashboard definition'
field :annotations, Types::Metrics::Dashboards::AnnotationType.connection_type, null: true, field :annotations, Types::Metrics::Dashboards::AnnotationType.connection_type, null: true,
description: 'Annotations added to the dashboard. Will always return `null` ' \ description: 'Annotations added to the dashboard',
'if `metrics_dashboard_annotations` feature flag is disabled',
resolver: Resolvers::Metrics::Dashboards::AnnotationResolver resolver: Resolvers::Metrics::Dashboards::AnnotationResolver
end end
# rubocop: enable Graphql/AuthorizeTypes # rubocop: enable Graphql/AuthorizeTypes
......
---
title: Add metrics dashboard annotations feature, which enables marking interesting
events over metrics dashboard charts
merge_request: 30371
author:
type: added
...@@ -6027,7 +6027,7 @@ type Metadata { ...@@ -6027,7 +6027,7 @@ type Metadata {
type MetricsDashboard { type MetricsDashboard {
""" """
Annotations added to the dashboard. Will always return `null` if `metrics_dashboard_annotations` feature flag is disabled Annotations added to the dashboard
""" """
annotations( annotations(
""" """
......
...@@ -16917,7 +16917,7 @@ ...@@ -16917,7 +16917,7 @@
"fields": [ "fields": [
{ {
"name": "annotations", "name": "annotations",
"description": "Annotations added to the dashboard. Will always return `null` if `metrics_dashboard_annotations` feature flag is disabled", "description": "Annotations added to the dashboard",
"args": [ "args": [
{ {
"name": "from", "name": "from",
......
...@@ -28,8 +28,6 @@ module API ...@@ -28,8 +28,6 @@ module API
post ':id/metrics_dashboard/annotations' do post ':id/metrics_dashboard/annotations' do
annotations_source_object = annotations_source[:class].find(params[:id]) annotations_source_object = annotations_source[:class].find(params[:id])
not_found! unless Feature.enabled?(:metrics_dashboard_annotations, annotations_source_object.project)
forbidden! unless can?(current_user, :create_metrics_dashboard_annotation, annotations_source_object) forbidden! unless can?(current_user, :create_metrics_dashboard_annotation, annotations_source_object)
create_service_params = declared(params).merge(annotations_source[:create_service_param_key] => annotations_source_object) create_service_params = declared(params).merge(annotations_source[:create_service_param_key] => annotations_source_object)
......
...@@ -97,7 +97,11 @@ describe('Monitoring store actions', () => { ...@@ -97,7 +97,11 @@ describe('Monitoring store actions', () => {
null, null,
state, state,
[], [],
[{ type: 'fetchEnvironmentsData' }, { type: 'fetchDashboard' }], [
{ type: 'fetchEnvironmentsData' },
{ type: 'fetchDashboard' },
{ type: 'fetchAnnotations' },
],
); );
}); });
......
...@@ -21,6 +21,7 @@ describe 'Getting Metrics Dashboard Annotations' do ...@@ -21,6 +21,7 @@ describe 'Getting Metrics Dashboard Annotations' do
create(:metrics_dashboard_annotation, environment: environment, starting_at: to.advance(minutes: 5), dashboard_path: path) create(:metrics_dashboard_annotation, environment: environment, starting_at: to.advance(minutes: 5), dashboard_path: path)
end end
let(:args) { "from: \"#{from}\", to: \"#{to}\"" }
let(:fields) do let(:fields) do
<<~QUERY <<~QUERY
#{all_graphql_fields_for('MetricsDashboardAnnotation'.classify)} #{all_graphql_fields_for('MetricsDashboardAnnotation'.classify)}
...@@ -47,29 +48,8 @@ describe 'Getting Metrics Dashboard Annotations' do ...@@ -47,29 +48,8 @@ describe 'Getting Metrics Dashboard Annotations' do
) )
end end
context 'feature flag metrics_dashboard_annotations' do
let(:args) { "from: \"#{from}\", to: \"#{to}\"" }
before do before do
project.add_developer(current_user) project.add_developer(current_user)
end
context 'is off' do
before do
stub_feature_flags(metrics_dashboard_annotations: false)
post_graphql(query, current_user: current_user)
end
it 'returns empty nodes array' do
annotations = graphql_data.dig('project', 'environments', 'nodes')[0].dig('metricsDashboard', 'annotations', 'nodes')
expect(annotations).to be_empty
end
end
context 'is on' do
before do
stub_feature_flags(metrics_dashboard_annotations: true)
post_graphql(query, current_user: current_user) post_graphql(query, current_user: current_user)
end end
...@@ -104,6 +84,4 @@ describe 'Getting Metrics Dashboard Annotations' do ...@@ -104,6 +84,4 @@ describe 'Getting Metrics Dashboard Annotations' do
it_behaves_like 'a working graphql query' it_behaves_like 'a working graphql query'
end end
end end
end
end
end end
...@@ -19,12 +19,6 @@ describe API::Metrics::Dashboard::Annotations do ...@@ -19,12 +19,6 @@ describe API::Metrics::Dashboard::Annotations do
end end
context "with :source_type == #{source_type.pluralize}" do context "with :source_type == #{source_type.pluralize}" do
context 'feature flag metrics_dashboard_annotations' do
context 'is on' do
before do
stub_feature_flags(metrics_dashboard_annotations: { enabled: true, thing: project })
end
context 'with correct permissions' do context 'with correct permissions' do
context 'with valid parameters' do context 'with valid parameters' do
it 'creates a new annotation', :aggregate_failures do it 'creates a new annotation', :aggregate_failures do
...@@ -68,27 +62,13 @@ describe API::Metrics::Dashboard::Annotations do ...@@ -68,27 +62,13 @@ describe API::Metrics::Dashboard::Annotations do
project.add_guest(guest) project.add_guest(guest)
end end
it 'returns error messsage' do it 'returns error message' do
post api(url, guest), params: params post api(url, guest), params: params
expect(response).to have_gitlab_http_status(:forbidden) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
end end
context 'is off' do
before do
stub_feature_flags(metrics_dashboard_annotations: { enabled: false })
end
it 'returns error messsage' do
post api(url, user), params: params
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
end
end end
describe 'environment' do describe 'environment' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment