Skip to content

Commit

Permalink
chore: add tracking to the performance tab COMPASS-4899 (#4909)
Browse files Browse the repository at this point in the history
Add tracking to the performance tab
  • Loading branch information
lerouxb authored Sep 27, 2023
1 parent 39e6a32 commit c2cc547
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
5 changes: 4 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion packages/compass-serverstats/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@
"license": "SSPL",
"peerDependencies": {
"@mongodb-js/compass-components": "^1.14.0",
"@mongodb-js/compass-logging": "^1.2.0",
"react": "^17.0.2"
},
"dependencies": {
"@mongodb-js/compass-components": "^1.14.0"
"@mongodb-js/compass-components": "^1.14.0",
"@mongodb-js/compass-logging": "^1.2.0"
},
"devDependencies": {
"@mongodb-js/mocha-config-compass": "^1.3.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
const timer = require('d3-timer');
const React = require('react');
const PropTypes = require('prop-types');
const { createLoggerAndTelemetry } = require('@mongodb-js/compass-logging');
const Actions = require('../actions');
const DBErrorStore = require('../stores/dberror-store');
const { track } = createLoggerAndTelemetry('COMPASS-PERFORMANCE-UI');

// const debug = require('debug')('mongodb-compass:server-stats:current-op-component');

Expand Down Expand Up @@ -92,6 +94,7 @@ class CurrentOpComponent extends React.Component {
* @param {Object} data - The row data.
*/
showOperationDetails(data) {
track('CurrentOp showOperationDetails');
Actions.showOperationDetails(data);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const React = require('react');
const Actions = require('../actions');
const { Button, Icon } = require('@mongodb-js/compass-components');
const { createLoggerAndTelemetry } = require('@mongodb-js/compass-logging');
const { track } = createLoggerAndTelemetry('COMPASS-PERFORMANCE-UI');

// const debug = require('debug')('mongodb-compass:server-stats:detailview-component');

Expand Down Expand Up @@ -37,6 +39,7 @@ class DetailViewComponent extends React.Component {
}

killOp() {
track('DetailView killOp');
Actions.killOp(this.state.data.opid);
this.hideOperationDetails();
}
Expand All @@ -45,6 +48,7 @@ class DetailViewComponent extends React.Component {
* Fire the show operation detail action with the row data.
*/
hideOperationDetails() {
track('DetailView hideOperationDetails');
Actions.hideOperationDetails();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import React, { useCallback, useEffect, useState } from 'react';
import d3 from 'd3';
import { Button, Icon, css, cx, spacing, palette, useDarkMode } from '@mongodb-js/compass-components';
import { createLoggerAndTelemetry } from '@mongodb-js/compass-logging';

import Actions from '../actions';
import ServerStatsStore from '../stores/server-stats-graphs-store';

const { track } = createLoggerAndTelemetry('COMPASS-PERFORMANCE-UI');

const serverStatsToolbarStyles = css({
display: 'flex',
flexDirection: 'row',
Expand Down Expand Up @@ -63,6 +66,12 @@ function ServerStatsToolbar({
}, []);

const onPlayPauseClicked = useCallback(() => {
if (isPaused) {
track('Performance Resumed');
}
else {
track('Performance Paused');
}
setPaused(!isPaused)
Actions.pause();
}, [ isPaused ]);
Expand Down

0 comments on commit c2cc547

Please sign in to comment.