Skip to content

Commit

Permalink
feat(telemetry): Collect project specific tags
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiborza committed Jan 13, 2025
1 parent 1841d94 commit 472b7cf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as Sentry from '@sentry/node';
import * as core from '@actions/core';
import {getCLI} from './cli';
import * as options from './options';
Expand Down Expand Up @@ -30,6 +31,12 @@ withTelemetry(
const version = await options.getVersion();
const workingDirectory = options.getWorkingDirectory();

if (projects.length === 1) {
Sentry.setTag('project', projects[0]);
} else {
Sentry.setTag('projects', projects.join(','));
}

core.debug(`Version is ${version}`);
await getCLI().new(version, {projects});

Expand All @@ -38,6 +45,8 @@ withTelemetry(
process.chdir(workingDirectory);
}

Sentry.setTag('set-commits', setCommitsOption);

if (setCommitsOption !== 'skip') {
await traceStep('set-commits', async () => {
core.debug(`Setting commits with option '${setCommitsOption}'`);
Expand All @@ -49,6 +58,8 @@ withTelemetry(
});
}

Sentry.setTag('sourcemaps', sourcemaps.length > 0);

if (sourcemaps.length) {
await traceStep('upload-sourcemaps', async () => {
core.debug(`Adding sourcemaps`);
Expand All @@ -66,6 +77,8 @@ withTelemetry(
return getCLI().uploadSourceMaps(version, sourceMapOptions);
})
);

Sentry.setTag('sourcemaps-uploaded', true);
});
}

Expand All @@ -83,6 +96,8 @@ withTelemetry(
await traceStep('finalizing-release', async () => {
core.debug(`Finalizing the release`);
await getCLI().finalize(version);

Sentry.setTag('finalized', true);
});
}

Expand Down
4 changes: 4 additions & 0 deletions src/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ export async function withTelemetry<F>(

const session = Sentry.startSession();

const org = process.env['SENTRY_ORG'];

Sentry.setUser({id: org});
Sentry.setTag('organization', org);
Sentry.setTag('node', process.version);
Sentry.setTag('platform', process.platform);

Expand Down

0 comments on commit 472b7cf

Please sign in to comment.