Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gh 1570] feature flag for table metrics #1574

Merged
merged 5 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json

from dataall.base.feature_toggle_checker import is_feature_enabled
from dataall.core.permissions.services.resource_policy_service import ResourcePolicyService
from dataall.core.tasks.service_handlers import Worker
from dataall.base.context import get_context
Expand All @@ -22,6 +23,7 @@
class DatasetProfilingService:
@staticmethod
@ResourcePolicyService.has_resource_permission(PROFILE_DATASET_TABLE)
@is_feature_enabled('modules.s3_datasets.features.metrics_data')
def start_profiling_run(uri, table_uri, glue_table_name):
context = get_context()
with context.db_engine.scoped_session() as session:
Expand Down Expand Up @@ -55,6 +57,7 @@ def start_profiling_run(uri, table_uri, glue_table_name):
return run

@staticmethod
@is_feature_enabled('modules.s3_datasets.features.metrics_data')
def resolve_profiling_run_status(run_uri):
context = get_context()
with context.db_engine.scoped_session() as session:
Expand All @@ -64,11 +67,13 @@ def resolve_profiling_run_status(run_uri):

@staticmethod
@ResourcePolicyService.has_resource_permission(GET_DATASET)
@is_feature_enabled('modules.s3_datasets.features.metrics_data')
def list_profiling_runs(uri):
with get_context().db_engine.scoped_session() as session:
return DatasetProfilingRepository.list_profiling_runs(session, uri)

@classmethod
@is_feature_enabled('modules.s3_datasets.features.metrics_data')
def get_dataset_table_profiling_run(cls, uri: str):
with get_context().db_engine.scoped_session() as session:
cls._check_preview_permissions_if_needed(session, table_uri=uri)
Expand All @@ -94,6 +99,7 @@ def get_dataset_table_profiling_run(cls, uri: str):
return run

@classmethod
@is_feature_enabled('modules.s3_datasets.features.metrics_data')
def list_table_profiling_runs(cls, uri: str):
with get_context().db_engine.scoped_session() as session:
cls._check_preview_permissions_if_needed(session=session, table_uri=uri)
Expand Down
1 change: 1 addition & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"aws_actions": true,
"preview_data": true,
"glue_crawler": true,
"metrics_data": true,
"show_stack_logs": "enabled"
}
},
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/modules/Tables/views/TableView.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { isFeatureEnabled } from 'utils';
import config from '../../../generated/config.json';

const previewDataEnabled = isFeatureEnabled('s3_datasets', 'preview_data');
const metricsEnabled = isFeatureEnabled('s3_datasets', 'metrics_data');

const confidentialityOptionsDict =
config.modules.datasets_base.features.confidentiality_dropdown === true &&
Expand Down Expand Up @@ -195,7 +196,7 @@ const TableView = () => {
if (!tabs.find((t) => t.value === 'columns')) {
tabs.push({ label: 'Columns', value: 'columns' });
}
if (!tabs.find((t) => t.value === 'metrics')) {
if (metricsEnabled && !tabs.find((t) => t.value === 'metrics')) {
tabs.push({ label: 'Metrics', value: 'metrics' });
}
if (
Expand Down Expand Up @@ -310,7 +311,7 @@ const TableView = () => {
{currentTab === 'columns' && (
<TableColumns table={table} isAdmin={isAdmin} />
)}
{currentTab === 'metrics' && (
{metricsEnabled && currentTab === 'metrics' && (
<TableMetrics table={table} isAdmin={isAdmin} />
)}
{currentTab === 'datafilters' && isAdmin && (
Expand Down
Loading