Skip to content

Commit 2543234

Browse files
committed
add in some more comments
1 parent 532e22b commit 2543234

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

packages/bundler-plugin-core/src/sentry/telemetry.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@ export function createSentryInstance({
4040
sentryScope: Scope;
4141
sentryClient: Client;
4242
} {
43+
// setting to undefined will ensure that no data is sent
4344
let sampleRate = undefined;
4445
let tracesSampleRate = undefined;
4546
// just being really explicit here as to what we're checking for
47+
// currently we're not tracking dry runs as they're more for debugging, and
48+
// are not interacting with our systems - up for debate whether we want to
49+
// keep this
4650
if (enableTelemetry === true && isDryRun === false) {
4751
sampleRate = 1;
4852
tracesSampleRate = 1;
@@ -65,6 +69,7 @@ export function createSentryInstance({
6569

6670
beforeSend: (event) => {
6771
event.exception?.values?.forEach((exception) => {
72+
// Stack track may have some PII
6873
delete exception.stacktrace;
6974
});
7075

@@ -110,12 +115,15 @@ export function setTelemetryDataOnScope(
110115
bundler: string,
111116
metaFramework?: string,
112117
) {
118+
// some general information about where the plugins are being ram
113119
scope.setTag("node", process.version);
114120
scope.setTag("platform", process.platform);
115121

122+
// determine which plugin and it's version that's being used
116123
scope.setTag("plugin.name", pluginInfo.name);
117124
scope.setTag("plugin.version", pluginInfo.version);
118125

126+
// determine the method of authorization
119127
let authMode = options.dryRun ? "dry-run" : "tokenless";
120128
if (options.uploadToken && options.uploadToken !== "") {
121129
authMode = "token";
@@ -124,12 +132,15 @@ export function setTelemetryDataOnScope(
124132
}
125133
scope.setTag("auth_mode", authMode);
126134

135+
// determine what git services are being used to auth with tokenless
127136
if (options.gitService) {
128137
scope.setTag("git_service", options.gitService);
129138
}
130139

140+
// want to see if we're mainly running in ci envs compared to local builds
131141
scope.setTag("ci", !!process.env.CI);
132142

143+
// track which bundlers and meta-frameworks are being used
133144
scope.setTag("meta_framework", metaFramework ?? "none");
134145
scope.setTag("bundler", bundler);
135146
}
@@ -164,8 +175,8 @@ export function telemetryPlugin({
164175
);
165176
startSpan(
166177
{
167-
name: "Codecov Bundler Plugin execution",
168-
op: "bundler-plugin-startup",
178+
name: "Codecov Bundler Plugin Execution",
179+
op: "bundler-plugin-execution",
169180
scope: sentryScope,
170181
},
171182
() => {

0 commit comments

Comments
 (0)