Skip to content

Commit 92352c3

Browse files
committed
collect some more info about meta frameworks and bundlers
1 parent 8e60f72 commit 92352c3

File tree

11 files changed

+46
-2
lines changed

11 files changed

+46
-2
lines changed

packages/astro-plugin/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ const astroPluginFactory = createVitePlugin<AstroPluginFactoryOptions, true>(
4949
pluginName: PLUGIN_NAME,
5050
pluginVersion: PLUGIN_VERSION,
5151
options,
52+
bundler: unpluginMetaContext.framework,
53+
metaFramework: "astro",
5254
});
5355

5456
if (options.enableBundleAnalysis) {

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ describe("telemetry", () => {
2828
isDryRun: false,
2929
pluginName: "test-plugin",
3030
pluginVersion: "1.0.0",
31+
bundler: "test-bundler",
3132
});
3233

3334
expect(sentryClient).toBeDefined();
@@ -40,6 +41,7 @@ describe("telemetry", () => {
4041
isDryRun: false,
4142
pluginName: "test-plugin",
4243
pluginVersion: "1.0.0",
44+
bundler: "test-bundler",
4345
});
4446

4547
expect(sentryClient).toBeDefined();
@@ -64,7 +66,13 @@ describe("telemetry", () => {
6466
version: "1.0.0",
6567
};
6668

67-
setTelemetryDataOnScope(options, pluginInfo, scope);
69+
setTelemetryDataOnScope(
70+
options,
71+
pluginInfo,
72+
scope,
73+
"test-bundler",
74+
"none",
75+
);
6876

6977
// eslint-disable-next-line @typescript-eslint/unbound-method
7078
expect(scope.setTag).toHaveBeenCalledWith("auth_mode", "token");
@@ -74,6 +82,10 @@ describe("telemetry", () => {
7482
expect(scope.setTag).toHaveBeenCalledWith("plugin.name", "test-plugin");
7583
// eslint-disable-next-line @typescript-eslint/unbound-method
7684
expect(scope.setTag).toHaveBeenCalledWith("plugin.version", "1.0.0");
85+
// eslint-disable-next-line @typescript-eslint/unbound-method
86+
expect(scope.setTag).toHaveBeenCalledWith("bundler", "test-bundler");
87+
// eslint-disable-next-line @typescript-eslint/unbound-method
88+
expect(scope.setTag).toHaveBeenCalledWith("meta_framework", "none");
7789
});
7890

7991
it("sets correct tags for github OIDC auth", () => {
@@ -91,7 +103,13 @@ describe("telemetry", () => {
91103
version: "1.0.0",
92104
};
93105

94-
setTelemetryDataOnScope(options, pluginInfo, scope);
106+
setTelemetryDataOnScope(
107+
options,
108+
pluginInfo,
109+
scope,
110+
"test-bundler",
111+
"none",
112+
);
95113

96114
// eslint-disable-next-line @typescript-eslint/unbound-method
97115
expect(scope.setTag).toHaveBeenCalledWith("auth_mode", "github-oidc");

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ interface CreateSentryInstanceOptions {
2424
pluginName: string;
2525
pluginVersion: string;
2626
options?: NormalizedOptions;
27+
bundler: string;
28+
metaFramework?: string;
2729
}
2830

2931
export function createSentryInstance({
@@ -32,6 +34,8 @@ export function createSentryInstance({
3234
pluginName,
3335
pluginVersion,
3436
options,
37+
bundler,
38+
metaFramework,
3539
}: CreateSentryInstanceOptions): {
3640
sentryScope: Scope;
3741
sentryClient: Client;
@@ -86,6 +90,8 @@ export function createSentryInstance({
8690
options,
8791
{ name: pluginName, version: pluginVersion },
8892
scope,
93+
bundler,
94+
metaFramework,
8995
);
9096
}
9197

@@ -101,6 +107,8 @@ export function setTelemetryDataOnScope(
101107
options: NormalizedOptions,
102108
pluginInfo: PluginInfo,
103109
scope: Scope,
110+
bundler: string,
111+
metaFramework?: string,
104112
) {
105113
scope.setTag("node", process.version);
106114
scope.setTag("platform", process.platform);
@@ -121,6 +129,9 @@ export function setTelemetryDataOnScope(
121129
}
122130

123131
scope.setTag("ci", !!process.env.CI);
132+
133+
scope.setTag("meta_framework", metaFramework ?? "none");
134+
scope.setTag("bundler", bundler);
124135
}
125136

126137
/** Flushing the SDK client can fail. We never want to crash the plugin because of telemetry. */

packages/nextjs-webpack-plugin/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ const codecovNextJSWebpackPluginFactory = createWebpackPlugin<
5353
pluginName: PLUGIN_NAME,
5454
pluginVersion: PLUGIN_VERSION,
5555
options,
56+
bundler: unpluginMetaContext.framework,
57+
metaFramework: "nextjs",
5658
});
5759

5860
if (options.enableBundleAnalysis) {

packages/nuxt-plugin/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ const codecovNuxtPluginFactory = createVitePlugin<Options, true>(
4545
pluginName: PLUGIN_NAME,
4646
pluginVersion: PLUGIN_VERSION,
4747
options,
48+
bundler: unpluginMetaContext.framework,
49+
metaFramework: "nuxt",
4850
});
4951

5052
if (options.enableBundleAnalysis) {

packages/remix-vite-plugin/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ const codecovRemixVitePluginFactory = createVitePlugin<Options, true>(
4747
pluginName: PLUGIN_NAME,
4848
pluginVersion: PLUGIN_VERSION,
4949
options,
50+
bundler: unpluginMetaContext.framework,
51+
metaFramework: "remix",
5052
});
5153

5254
if (options.enableBundleAnalysis) {

packages/rollup-plugin/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const codecovRollupPluginFactory = createRollupPlugin<Options, true>(
4646
pluginName: PLUGIN_NAME,
4747
pluginVersion: PLUGIN_VERSION,
4848
options,
49+
bundler: unpluginMetaContext.framework,
4950
});
5051

5152
if (options.enableBundleAnalysis) {

packages/solidstart-plugin/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ const codecovSolidStartPluginFactory = createVitePlugin<Options, true>(
4747
pluginName: PLUGIN_NAME,
4848
pluginVersion: PLUGIN_VERSION,
4949
options,
50+
bundler: unpluginMetaContext.framework,
51+
metaFramework: "solidstart",
5052
});
5153

5254
if (options.enableBundleAnalysis) {

packages/sveltekit-plugin/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ const codecovSvelteKitPluginFactory = createVitePlugin<Options, true>(
4747
pluginName: PLUGIN_NAME,
4848
pluginVersion: PLUGIN_VERSION,
4949
options,
50+
bundler: unpluginMetaContext.framework,
51+
metaFramework: "sveltekit",
5052
});
5153

5254
if (options.enableBundleAnalysis) {

packages/vite-plugin/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const codecovVitePluginFactory = createVitePlugin<Options, true>(
4646
pluginName: PLUGIN_NAME,
4747
pluginVersion: PLUGIN_VERSION,
4848
options,
49+
bundler: unpluginMetaContext.framework,
4950
});
5051

5152
if (options.enableBundleAnalysis) {

packages/webpack-plugin/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const codecovWebpackPluginFactory = createWebpackPlugin<Options, true>(
5353
pluginName: PLUGIN_NAME,
5454
pluginVersion: PLUGIN_VERSION,
5555
options,
56+
bundler: unpluginMetaContext.framework,
5657
});
5758

5859
if (options.enableBundleAnalysis) {

0 commit comments

Comments
 (0)