Skip to content

Commit 472b7cf

Browse files
committed
feat(telemetry): Collect project specific tags
1 parent 1841d94 commit 472b7cf

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/main.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as Sentry from '@sentry/node';
12
import * as core from '@actions/core';
23
import {getCLI} from './cli';
34
import * as options from './options';
@@ -30,6 +31,12 @@ withTelemetry(
3031
const version = await options.getVersion();
3132
const workingDirectory = options.getWorkingDirectory();
3233

34+
if (projects.length === 1) {
35+
Sentry.setTag('project', projects[0]);
36+
} else {
37+
Sentry.setTag('projects', projects.join(','));
38+
}
39+
3340
core.debug(`Version is ${version}`);
3441
await getCLI().new(version, {projects});
3542

@@ -38,6 +45,8 @@ withTelemetry(
3845
process.chdir(workingDirectory);
3946
}
4047

48+
Sentry.setTag('set-commits', setCommitsOption);
49+
4150
if (setCommitsOption !== 'skip') {
4251
await traceStep('set-commits', async () => {
4352
core.debug(`Setting commits with option '${setCommitsOption}'`);
@@ -49,6 +58,8 @@ withTelemetry(
4958
});
5059
}
5160

61+
Sentry.setTag('sourcemaps', sourcemaps.length > 0);
62+
5263
if (sourcemaps.length) {
5364
await traceStep('upload-sourcemaps', async () => {
5465
core.debug(`Adding sourcemaps`);
@@ -66,6 +77,8 @@ withTelemetry(
6677
return getCLI().uploadSourceMaps(version, sourceMapOptions);
6778
})
6879
);
80+
81+
Sentry.setTag('sourcemaps-uploaded', true);
6982
});
7083
}
7184

@@ -83,6 +96,8 @@ withTelemetry(
8396
await traceStep('finalizing-release', async () => {
8497
core.debug(`Finalizing the release`);
8598
await getCLI().finalize(version);
99+
100+
Sentry.setTag('finalized', true);
86101
});
87102
}
88103

src/telemetry.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ export async function withTelemetry<F>(
2525

2626
const session = Sentry.startSession();
2727

28+
const org = process.env['SENTRY_ORG'];
29+
30+
Sentry.setUser({id: org});
31+
Sentry.setTag('organization', org);
2832
Sentry.setTag('node', process.version);
2933
Sentry.setTag('platform', process.platform);
3034

0 commit comments

Comments
 (0)