Skip to content

Commit

Permalink
feat: Allow passing of meta-framework as telemetry data (#539)
Browse files Browse the repository at this point in the history
  • Loading branch information
lforst authored May 31, 2024
1 parent f22747b commit 45c7f1c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/bundler-plugin-core/src/options-mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ export function normalizeUserOptions(userOptions: UserOptions) {
},
bundleSizeOptimizations: userOptions.bundleSizeOptimizations,
reactComponentAnnotation: userOptions.reactComponentAnnotation,
_metaOptions: {
telemetry: {
metaFramework: userOptions._metaOptions?.telemetry?.metaFramework,
},
},
moduleMetadata: userOptions.moduleMetadata || userOptions._experiments?.moduleMetadata,
_experiments: userOptions._experiments ?? {},
};
Expand Down
2 changes: 2 additions & 0 deletions packages/bundler-plugin-core/src/sentry/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ export function setTelemetryDataOnHub(options: NormalizedOptions, hub: Hub, bund
hub.setTag("node", process.version);
hub.setTag("platform", process.platform);

hub.setTag("meta-framework", options._metaOptions.telemetry.metaFramework ?? "none");

hub.setTags({
organization: org,
project,
Expand Down
10 changes: 10 additions & 0 deletions packages/bundler-plugin-core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,16 @@ export interface Options {
* Example value: `[sentry-webpack-plugin (client)]`
*/
loggerPrefixOverride?: string;

/**
* Arbitrary telemetry items.
*/
telemetry?: {
/**
* The meta framework using the plugin.
*/
metaFramework?: string;
};
};
}

Expand Down
10 changes: 10 additions & 0 deletions packages/bundler-plugin-core/test/option-mappings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ describe("normalizeUserOptions()", () => {
silent: false,
telemetry: true,
_experiments: {},
_metaOptions: {
telemetry: {
metaFramework: undefined,
},
},
url: "https://sentry.io",
});
});
Expand Down Expand Up @@ -73,6 +78,11 @@ describe("normalizeUserOptions()", () => {
silent: false,
telemetry: true,
_experiments: {},
_metaOptions: {
telemetry: {
metaFramework: undefined,
},
},
url: "https://sentry.io",
});
});
Expand Down

0 comments on commit 45c7f1c

Please sign in to comment.