This commit is contained in:
Joel Maher 2024-11-01 08:54:59 -07:00 коммит произвёл GitHub
Родитель 13fd4e4bec
Коммит f1a6c9dfd5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
17 изменённых файлов: 11 добавлений и 272 удалений

Просмотреть файл

@ -15,12 +15,6 @@ jobs:
- run:
command: yarn markdownlint
name: Check markdown linting
- run:
command: sudo apt-get update && sudo apt-get install python3-venv -y
name: python for glean
- run:
command: yarn build:glean
name: generate glean files
- run:
command: yarn test:coverage
name: Run Jest tests
@ -35,12 +29,6 @@ jobs:
name: Restore Yarn Package Cache
keys:
- node-deps-v1-{{ .Branch }}
- run:
command: sudo apt-get update && sudo apt-get install python3-venv -y
name: python for glean
- run:
command: yarn install && yarn build:glean
name: generate glean files
- run: pip install tox
- run:
command: tox -e docs
@ -56,9 +44,6 @@ jobs:
- checkout
- docker/install-docker-compose:
version: 1.29.2
- run:
command: sudo NEEDRESTART_SUSPEND=True apt-get update && sudo NEEDRESTART_SUSPEND=True apt-get install python3-venv -y
name: python for glean
- run:
name: Run tests and coverage within Docker container
command: |

Просмотреть файл

@ -1 +0,0 @@
ui/glean/generated/*.js

6
.github/workflows/glean-probe-scraper.yml поставляемый
Просмотреть файл

@ -1,6 +0,0 @@
---
name: Glean probe-scraper
on: [push]
jobs:
glean-probe-scraper:
uses: mozilla/probe-scraper/.github/workflows/glean.yaml@main

1
.gitignore поставляемый
Просмотреть файл

@ -1,5 +1,4 @@
.*/
ui/glean/generated/
node_modules/
.DS_store
*.pyc

Просмотреть файл

@ -60,7 +60,7 @@ services:
working_dir: /app
environment:
BACKEND: http://backend:8000
command: sh -c "yarn && yarn build:glean && yarn start --host 0.0.0.0"
command: sh -c "yarn && yarn start --host 0.0.0.0"
volumes:
- .:/app
ports:

Просмотреть файл

@ -6,9 +6,6 @@ WORKDIR /app
COPY ui/ /app/ui/
COPY package.json babel.config.json webpack.config.js yarn.lock /app/
# ensure we have python-venv available for glean
RUN apt-get update && apt-get install python3-venv -y
RUN npm install -g --force yarn@1.22.22
RUN yarn install
RUN yarn build

Просмотреть файл

@ -18,7 +18,7 @@ module.exports = {
transform: {
'\\.(mjs|jsx|js)$': 'babel-jest',
},
transformIgnorePatterns: ['node_modules/(!taskcluster-client-web|!@mozilla)'],
transformIgnorePatterns: ['node_modules/(?!taskcluster-client-web)'],
setupFilesAfterEnv: ['<rootDir>/tests/ui/test-setup.js'],
testPathIgnorePatterns: ['tests/ui/integration'],
};

Просмотреть файл

@ -16,7 +16,6 @@
"@fortawesome/free-regular-svg-icons": "6.2.1",
"@fortawesome/free-solid-svg-icons": "6.2.1",
"@fortawesome/react-fontawesome": "0.2.2",
"@mozilla/glean": "5.0.3",
"@types/prop-types": "*",
"@types/react": "*",
"@types/react-dom": "*",
@ -120,21 +119,19 @@
"webpack-merge": "5.8.0"
},
"scripts": {
"build": "yarn build:glean && node ./node_modules/webpack/bin/webpack.js --mode production",
"build": "node ./node_modules/webpack/bin/webpack.js --mode production",
"build:dev": "node ./node_modules/webpack/bin/webpack.js --mode development",
"build:glean": "node ./node_modules/@mozilla/glean/dist/cli/cli.js translate ui/glean/metrics.yaml ui/glean/pings.yaml -f javascript -o ui/glean/generated",
"format": "node ./node_modules/prettier/bin-prettier.js --write \"**/*.{css,html,js,jsx,json,md,yaml,yml}\"",
"format:check": "node ./node_modules/prettier/bin-prettier.js --check \"**/*.{css,html,js,jsx,json,md,yaml,yml}\"",
"lint": "node ./node_modules/eslint/bin/eslint.js --report-unused-disable-directives --max-warnings 0 --format codeframe --ext js,jsx \".*.js\" \"*.js\" ui/ tests/ui/",
"lint-with-cache": "node ./node_modules/eslint/bin/eslint.js --cache --report-unused-disable-directives --max-warnings 0 --format codeframe --ext js,jsx \".*.js\" \"*.js\" ui/ tests/ui/",
"lint:glean": "node ./node_modules/@mozilla/glean/dist/cli/cli.js glinter ui/glean/metrics.yaml ui/glean/pings.yaml",
"markdownlint": "node ./node_modules/markdownlint-cli/markdownlint.js -c .markdownlint.json -p .markdownlintignore .",
"prettier": "npx prettier --check .",
"start": "node ./node_modules/webpack/bin/webpack.js serve --mode development",
"start:stage": "BACKEND=https://treeherder.allizom.org node ./node_modules/webpack/bin/webpack.js serve --mode development",
"start:local": "BACKEND=http://localhost:8000 node ./node_modules/webpack/bin/webpack.js serve --mode development",
"test:coverage": "yarn build:glean && node ./node_modules/jest/bin/jest -w 1 --silent --coverage",
"test": "yarn build:glean && node ./node_modules/jest/bin/jest",
"test:coverage": "node ./node_modules/jest/bin/jest -w 1 --silent --coverage",
"test": "&& node ./node_modules/jest/bin/jest",
"test:integration": "node node_modules/puppeteer/install.js && set TEST_TYPE=integration && node ./node_modules/jest/bin/jest",
"test:watch": "node ./node_modules/jest/bin/jest --watch"
},

Просмотреть файл

@ -1,71 +0,0 @@
---
# Schema
$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0
# Category
classification:
new_failure_other:
type: counter
description: Counts how often a NEW tag is classified as fixed_by_commit.
send_in_pings:
- classified
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1799785
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1805793
notification_emails:
- jmaher@mozilla.com
- aryx@mozilla.com
expires: never
new_bug:
type: counter
description: Counts how often a bug is filed without a NEW tag.
send_in_pings:
- classified
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1799785
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1805793
notification_emails:
- jmaher@mozilla.com
- aryx@mozilla.com
expires: never
new_failure_new_bug:
type: counter
description: Counts how often a bug is filed with a NEW tag.
send_in_pings:
- classified
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1799785
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1805793
notification_emails:
- jmaher@mozilla.com
- aryx@mozilla.com
expires: never
fixed_by_commit:
type: counter
description: Counts how often a failure is annotated FBC.
send_in_pings:
- classified
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1799785
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1805793
notification_emails:
- jmaher@mozilla.com
- aryx@mozilla.com
expires: never
fixed_by_commit_new_failure:
type: counter
description: Counts how often a failure is annotated FBC with a NEW tag.
send_in_pings:
- classified
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1799785
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1805793
notification_emails:
- jmaher@mozilla.com
- aryx@mozilla.com
expires: never

Просмотреть файл

@ -1,18 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
---
$schema: moz://mozilla.org/schemas/glean/pings/2-0-0
classified:
description: sends counters related to user actions done on treeherder.
include_client_id: false
send_if_empty: false
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1799785
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1805793
notification_emails:
- jmaher@mozilla.com
- aryx@mozilla.com

Просмотреть файл

@ -1,16 +1,11 @@
/* eslint import/no-unresolved: [2, { ignore: ['@mozilla/glean/web$'] }] */
import React from 'react';
import PropTypes from 'prop-types';
import chunk from 'lodash/chunk';
import { connect } from 'react-redux';
import Glean from '@mozilla/glean/web';
import { notify } from '../redux/stores/notifications';
import { setPinBoardVisible } from '../redux/stores/pinnedJobs';
import { thEvents } from '../../helpers/constants';
import { addAggregateFields } from '../../helpers/job';
import { getUrlParam } from '../../helpers/location';
import { getLogViewerUrl, getArtifactsUrl } from '../../helpers/url';
import { formatArtifacts } from '../../helpers/display';
import { getData } from '../../helpers/http';
@ -34,8 +29,6 @@ class DetailsPanel extends React.Component {
// used to cancel all the ajax requests triggered by selectJob
this.selectJobController = null;
this.gleanInitialized = false;
this.state = {
selectedJobFull: null,
jobDetails: [],
@ -94,24 +87,6 @@ class DetailsPanel extends React.Component {
);
}
initializeGlean = () => {
const { notify } = this.props;
if (!this.gleanInitialized && !getUrlParam('noTelemetry')) {
if (!localStorage.getItem('glean_notify')) {
notify(
`Collecting telemetry data about failure classification. turn off in user menu`,
'success',
);
localStorage.setItem('glean_notify', 'displayed');
}
// for development (data sent to: https://debug-ping-preview.firebaseapp.com/pings/treeherder)
// Glean.setLogPings(true);
// Glean.setDebugViewTag('treeherder');
Glean.initialize('treeherder', true);
this.gleanInitialized = true;
}
};
togglePinBoardVisibility = () => {
const { setPinBoardVisible, isPinBoardVisible } = this.props;
@ -404,7 +379,6 @@ class DetailsPanel extends React.Component {
isStaff={user.isStaff || false}
classificationTypes={classificationTypes}
selectedJobFull={selectedJobFull}
initializeGlean={this.initializeGlean}
/>
{!!selectedJobFull && (
<div id="details-panel-content">
@ -446,7 +420,6 @@ class DetailsPanel extends React.Component {
logViewerFullUrl={logViewerFullUrl}
taskId={selectedJobFull.task_id}
rootUrl={currentRepo.tc_root_url}
initializeGlean={this.initializeGlean}
/>
</div>
)}
@ -468,7 +441,6 @@ DetailsPanel.propTypes = {
isPinBoardVisible: PropTypes.bool.isRequired,
pushList: PropTypes.arrayOf(PropTypes.object).isRequired,
selectedJob: PropTypes.shape({}),
notify: PropTypes.func.isRequired,
};
DetailsPanel.defaultProps = {
@ -481,6 +453,4 @@ const mapStateToProps = ({
pinnedJobs: { isPinBoardVisible },
}) => ({ selectedJob, pushList, isPinBoardVisible });
export default connect(mapStateToProps, { notify, setPinBoardVisible })(
DetailsPanel,
);
export default connect(mapStateToProps, { setPinBoardVisible })(DetailsPanel);

Просмотреть файл

@ -1,5 +1,3 @@
/* eslint import/no-unresolved: [2, { ignore: ['../glean/generated/pings.js$', '../glean/generated/classification.js$'] }] */
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
@ -37,27 +35,6 @@ import {
setClassificationId,
setClassificationComment,
} from '../redux/stores/pinnedJobs';
import { classified } from '../../glean/generated/pings.js';
import {
fixedByCommitNewFailure,
fixedByCommit,
newFailureOther,
} from '../../glean/generated/classification.js';
import { getUrlParam } from '../../helpers/location';
function gleanMetrics(failureClassificationId, newFailure) {
switch (failureClassificationId) {
case 2:
if (newFailure) {
fixedByCommitNewFailure.add();
} else {
fixedByCommit.add();
}
break;
default:
if (newFailure) newFailureOther.add();
}
}
class PinBoard extends React.Component {
constructor(props) {
@ -88,11 +65,9 @@ class PinBoard extends React.Component {
save = () => {
const {
isLoggedIn,
failureClassificationId,
pinnedJobs,
recalculateUnclassifiedCounts,
notify,
initializeGlean,
} = this.props;
let errorFree = true;
@ -114,15 +89,6 @@ class PinBoard extends React.Component {
}
if (errorFree) {
const jobs = Object.values(pinnedJobs);
// accumulate telemetry on failure classification type
// submit data when all jobs are counted
if (!getUrlParam('noTelemetry')) {
initializeGlean();
jobs.forEach((job) =>
gleanMetrics(failureClassificationId, job.newFailure),
);
classified.submit();
}
const classifyPromises = jobs.map((job) => this.saveClassification(job));
const bugPromises = jobs.map((job) => this.saveBugs(job));
Promise.all([...classifyPromises, ...bugPromises]).then(() => {
@ -751,7 +717,6 @@ PinBoard.propTypes = {
selectedJobFull: PropTypes.shape({}),
email: PropTypes.string,
revisionTips: PropTypes.arrayOf(PropTypes.object),
initializeGlean: PropTypes.func.isRequired,
};
PinBoard.defaultProps = {

Просмотреть файл

@ -14,7 +14,7 @@ import { thEvents } from '../../../helpers/constants';
import JobArtifacts from '../../../shared/JobArtifacts';
import JobTestGroups from '../JobTestGroups';
import { clearSelectedJob } from '../../redux/stores/selectedJob';
import { pinJob, addBug, updatePinnedJob } from '../../redux/stores/pinnedJobs';
import { pinJob, addBug } from '../../redux/stores/pinnedJobs';
import FailureSummaryTab from '../../../shared/tabs/failureSummary/FailureSummaryTab';
import PerformanceTab from './PerformanceTab';
@ -141,8 +141,6 @@ class TabsPanel extends React.Component {
addBug,
taskId,
rootUrl,
initializeGlean,
updatePinnedJob,
} = this.props;
const { enableTestGroupsTab, tabIndex } = this.state;
const countPinnedJobs = Object.keys(pinnedJobs).length;
@ -231,9 +229,7 @@ class TabsPanel extends React.Component {
logViewerFullUrl={logViewerFullUrl}
addBug={addBug}
pinJob={pinJob}
updatePinnedJob={updatePinnedJob}
repoName={currentRepo.name}
initializeGlean={initializeGlean}
fontSize="font-size-11"
/>
</TabPanel>
@ -307,7 +303,6 @@ TabsPanel.propTypes = {
logViewerFullUrl: PropTypes.string,
taskId: PropTypes.string.isRequired,
rootUrl: PropTypes.string.isRequired,
initializeGlean: PropTypes.func.isRequired,
};
TabsPanel.defaultProps = {
@ -323,9 +318,6 @@ const mapStateToProps = ({
pinnedJobs: { pinnedJobs, isPinBoardVisible },
}) => ({ pinnedJobs, isPinBoardVisible });
export default connect(mapStateToProps, {
clearSelectedJob,
pinJob,
addBug,
updatePinnedJob,
})(TabsPanel);
export default connect(mapStateToProps, { clearSelectedJob, pinJob, addBug })(
TabsPanel,
);

Просмотреть файл

@ -51,7 +51,6 @@ export const pinJob = (job) => {
} = getState();
if (MAX_SIZE - Object.keys(pinnedJobs).length > 0) {
job.newFailure = 0;
dispatch({
type: SET_PINNED_JOBS,
payload: {
@ -106,20 +105,6 @@ export const pinJobs = (jobsToPin) => {
};
};
export const updatePinnedJob = (jobData) => {
return async (dispatch, getState) => {
const {
pinnedJobs: { pinnedJobs },
} = getState();
Object.keys(pinnedJobs).forEach((jobId) => {
if (jobData.id === jobId) {
pinnedJobs[jobId].newFailure = jobData.newFailure;
}
});
};
};
export const addBug = (bug, job) => {
return async (dispatch, getState) => {
const {

Просмотреть файл

@ -1,5 +1,3 @@
/* eslint import/no-unresolved: [2, { ignore: ['../glean/generated/pings.js$', '../glean/generated/classification.js$'] }] */
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
@ -29,10 +27,7 @@ import {
getApiUrl,
} from '../helpers/url';
import { create } from '../helpers/http';
import { getUrlParam } from '../helpers/location';
import { notify } from '../job-view/redux/stores/notifications';
import { classified } from '../glean/generated/pings.js';
import { newFailureNewBug, newBug } from '../glean/generated/classification.js';
const omittedLeads = [
'TEST-UNEXPECTED-FAIL',
@ -140,7 +135,6 @@ export class BugFilerClass extends React.Component {
const crashSignatures = this.getCrashSignatures(suggestion);
const newFailure = suggestion.showNewButton;
const keywords = [];
let isAssertion = [
/ASSERTION:/, // binary code
@ -277,7 +271,6 @@ export class BugFilerClass extends React.Component {
thisFailure,
keywords,
crashSignatures,
newFailure,
};
}
@ -468,7 +461,6 @@ export class BugFilerClass extends React.Component {
comment,
isIntermittent,
isSecurityIssue,
newFailure,
checkedLogLinks,
regressedBy,
seeAlso,
@ -591,15 +583,6 @@ export class BugFilerClass extends React.Component {
);
if (!failureStatus) {
if (!getUrlParam('noTelemetry')) {
// glean metrics for new bugs added
if (newFailure) {
newFailureNewBug.add();
} else {
newBug.add();
}
classified.submit();
}
toggle();
successCallback(data);
} else {

Просмотреть файл

@ -10,9 +10,7 @@ import {
import isEqual from 'lodash/isEqual';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faUser } from '@fortawesome/free-solid-svg-icons';
import { push as pushRoute } from 'connected-react-router';
import { setUrlParam, getUrlParam } from '../../helpers/location';
import { loggedOutUser } from '../../helpers/auth';
import { getApiUrl, loginCallbackUrl } from '../../helpers/url';
import UserModel from '../../models/user';
@ -25,9 +23,6 @@ class Login extends React.Component {
constructor(props) {
super(props);
this.state = {
telemetry: true,
};
this.authService = new AuthService(this.props.setUser);
}
@ -42,8 +37,6 @@ class Login extends React.Component {
this.setLoggedOut();
}
});
this.setState({ telemetry: !getUrlParam('noTelemetry') });
}
componentWillUnmount() {
@ -94,19 +87,6 @@ class Login extends React.Component {
window.open(loginCallbackUrl, '_blank');
};
toggleTelemetry = () => {
const { telemetry } = this.state;
if (telemetry) {
setUrlParam('noTelemetry', 1);
this.setState({ telemetry: false });
} else {
setUrlParam('noTelemetry', null);
this.setState({ telemetry: true });
}
pushRoute();
};
logout = () => {
const { notify } = this.props;
@ -149,9 +129,6 @@ class Login extends React.Component {
<DropdownItem tag="a" onClick={this.logout}>
Logout
</DropdownItem>
<DropdownItem tag="a" onClick={() => this.toggleTelemetry()}>
Turn Telemetry {this.state.telemetry ? 'off' : 'on'}
</DropdownItem>
</DropdownMenu>
</UncontrolledDropdown>
) : (

Просмотреть файл

@ -7,7 +7,6 @@ import { faSpinner } from '@fortawesome/free-solid-svg-icons';
import { thBugSuggestionLimit, thEvents } from '../../../helpers/constants';
import { getResultState, isReftest } from '../../../helpers/job';
import { getReftestUrl } from '../../../helpers/url';
import { getUrlParam } from '../../../helpers/location';
import BugFiler from '../../BugFiler';
import BugSuggestionsModel from '../../../models/bugSuggestions';
@ -44,13 +43,7 @@ class FailureSummaryTab extends React.Component {
}
fileBug = (suggestion) => {
const { selectedJob, pinJob, initializeGlean } = this.props;
// accumulate telemetry on failure classification type
// submit data when all jobs are counted
if (!getUrlParam('noTelemetry')) {
initializeGlean();
}
const { selectedJob, pinJob } = this.props;
pinJob(selectedJob);
this.setState({
@ -149,7 +142,6 @@ class FailureSummaryTab extends React.Component {
logViewerFullUrl,
selectedJob,
addBug,
updatePinnedJob,
repoName,
developerMode,
} = this.props;
@ -180,10 +172,6 @@ class FailureSummaryTab extends React.Component {
}
});
if (selectedJob.newFailure > 0) {
updatePinnedJob?.(selectedJob);
}
return (
<div className="w-100 h-100" role="region" aria-label="Failure Summary">
<ul
@ -322,9 +310,7 @@ FailureSummaryTab.propTypes = {
repoName: PropTypes.string.isRequired,
addBug: PropTypes.func,
pinJob: PropTypes.func,
updatePinnedJob: PropTypes.func,
developerMode: PropTypes.bool,
initializeGlean: PropTypes.func.isRequired,
};
FailureSummaryTab.defaultProps = {
@ -333,7 +319,6 @@ FailureSummaryTab.defaultProps = {
logViewerFullUrl: null,
addBug: null,
pinJob: null,
updatePinnedJob: null,
developerMode: false,
};