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

chore: [logging] add selected tab name into perf logging #10080

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions superset-frontend/src/dashboard/components/Dashboard.jsx
Expand Up @@ -91,12 +91,15 @@ class Dashboard extends React.PureComponent {
}

componentDidMount() {
const appContainer = document.getElementById('app');
const bootstrapData = appContainer?.getAttribute('data-bootstrap') || '';
const { dashboardState, layout } = this.props;
const eventData = {
is_edit_mode: dashboardState.editMode,
mount_duration: Logger.getTimestamp(),
is_empty: isDashboardEmpty(layout),
is_published: dashboardState.isPublished,
bootstrap_data_length: bootstrapData.length,
};
const directLinkComponentId = getLocationHash();
if (directLinkComponentId) {
Expand Down
Expand Up @@ -150,12 +150,13 @@ class Tabs extends React.PureComponent {
},
});
} else if (tabIndex !== this.state.tabIndex) {
const pathToTabIndex = getDirectPathToTabIndex(component, tabIndex);
const targetTabId = pathToTabIndex[pathToTabIndex.length - 1];
this.props.logEvent(LOG_ACTIONS_SELECT_DASHBOARD_TAB, {
tab_id: component.id,
target_id: targetTabId,
index: tabIndex,
});

const pathToTabIndex = getDirectPathToTabIndex(component, tabIndex);
this.props.onChangeTab({ pathToTabIndex });
}
}
Expand Down
13 changes: 12 additions & 1 deletion superset-frontend/src/middleware/loggerMiddleware.js
Expand Up @@ -68,7 +68,12 @@ const loggerMiddleware = store => next => action => {
return next(action);
}

const { dashboardInfo, explore, impressionId } = store.getState();
const {
dashboardInfo,
explore,
impressionId,
dashboardLayout,
} = store.getState();
let logMetadata = {
impression_id: impressionId,
version: 'v2',
Expand Down Expand Up @@ -111,6 +116,12 @@ const loggerMiddleware = store => next => action => {
};
}

if (eventData.target_id && dashboardLayout.present) {
const meta = dashboardLayout.present[eventData.target_id].meta;
// chart name or tab/header text
eventData.target_name = meta.chartId ? meta.sliceName : meta.text;
}

logMessageQueue.append(eventData);
return eventData;
};
Expand Down