Skip to content

Commit

Permalink
Revert "Merge pull request #1141 from chromaui/cody/cap-2635-add-metr…
Browse files Browse the repository at this point in the history
…ics-to-determine-if-lock-file-parsing-is-helping-or"

This reverts commit f349c8e, reversing
changes made to 1ecc76c.
  • Loading branch information
codykaup committed Jan 16, 2025
1 parent d5d3321 commit 6646a43
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 51 deletions.
31 changes: 0 additions & 31 deletions node-src/lib/newRelic.ts

This file was deleted.

20 changes: 0 additions & 20 deletions node-src/tasks/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { findChangedDependencies } from '../lib/findChangedDependencies';
import { findChangedPackageFiles } from '../lib/findChangedPackageFiles';
import { getDependentStoryFiles } from '../lib/getDependentStoryFiles';
import { getFileHashes } from '../lib/getFileHashes';
import { writeLog } from '../lib/newRelic';
import { createTask, transitionTo } from '../lib/tasks';
import { uploadBuild } from '../lib/upload';
import { rewriteErrorMessage, throttle } from '../lib/utils';
Expand Down Expand Up @@ -133,31 +132,18 @@ export const traceChangedFiles = async (ctx: Context, task: Task) => {

transitionTo(tracing)(ctx, task);

const turbosnapMetrics: {
dependencyChanges: boolean;
lockFileParseResult?: 'success' | 'error' | 'did not throw but no dependency changes found';
error?: string;
} = {
dependencyChanges: false,
};
const { statsPath } = ctx.fileInfo;
const { changedFiles, packageMetadataChanges } = ctx.git;

try {
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
let changedDependencyNames: void | string[] = [];
if (packageMetadataChanges?.length) {
turbosnapMetrics.dependencyChanges = true;

changedDependencyNames = await findChangedDependencies(ctx).catch((err) => {
const { name, message, stack, code } = err;
ctx.log.debug({ name, message, stack, code });
turbosnapMetrics.lockFileParseResult = 'error';
turbosnapMetrics.error = message;
});
if (changedDependencyNames) {
turbosnapMetrics.lockFileParseResult = 'success';

ctx.git.changedDependencyNames = changedDependencyNames;
if (!ctx.options.interactive) {
const list =
Expand All @@ -167,10 +153,6 @@ export const traceChangedFiles = async (ctx: Context, task: Task) => {
ctx.log.info(`Found ${changedDependencyNames.length} changed dependencies${list}`);
}
} else {
if (!turbosnapMetrics.lockFileParseResult) {
turbosnapMetrics.lockFileParseResult = 'did not throw but no dependency changes found';
}

ctx.log.warn(`Could not retrieve dependency changes from lockfiles; checking package.json`);

const changedPackageFiles = await findChangedPackageFiles(packageMetadataChanges);
Expand Down Expand Up @@ -224,8 +206,6 @@ export const traceChangedFiles = async (ctx: Context, task: Task) => {
ctx.log.info('Failed to retrieve dependent story files', { statsPath, changedFiles, err });
}
throw rewriteErrorMessage(err, `Could not retrieve dependent story files.\n${err.message}`);
} finally {
await writeLog({ ...turbosnapMetrics, message: 'Turbosnap lock file parsing metrics' });
}
};

Expand Down

0 comments on commit 6646a43

Please sign in to comment.