Skip to content

Commit

Permalink
feat: Update JavaScript SDKs to v8.37.1 (#1014)
Browse files Browse the repository at this point in the history
  • Loading branch information
timfish authored Nov 6, 2024
1 parent f99628e commit 76d0aaa
Show file tree
Hide file tree
Showing 7 changed files with 204 additions and 165 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@
"e2e": "xvfb-maybe vitest run --root=./test/e2e --silent=false --disable-console-intercept"
},
"dependencies": {
"@sentry/browser": "8.35.0",
"@sentry/core": "8.35.0",
"@sentry/node": "8.35.0",
"@sentry/types": "8.35.0",
"@sentry/utils": "8.35.0",
"@sentry/browser": "8.37.1",
"@sentry/core": "8.37.1",
"@sentry/node": "8.37.1",
"@sentry/types": "8.37.1",
"@sentry/utils": "8.37.1",
"deepmerge": "4.3.1"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.6",
"@sentry-internal/eslint-config-sdk": "8.35.0",
"@sentry-internal/typescript": "8.35.0",
"@sentry-internal/eslint-config-sdk": "8.37.1",
"@sentry-internal/typescript": "8.37.1",
"@types/busboy": "^1.5.4",
"@types/form-data": "^2.5.0",
"@types/koa": "^2.0.52",
Expand Down
2 changes: 2 additions & 0 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export {
linkedErrorsIntegration,
localVariablesIntegration,
lruMemoizerIntegration,
// eslint-disable-next-line deprecation/deprecation
metrics,
modulesIntegration,
mongoIntegration,
Expand All @@ -92,6 +93,7 @@ export {
parameterize,
postgresIntegration,
prismaIntegration,
processThreadBreadcrumbIntegration,
profiler,
redisIntegration,
requestDataIntegration,
Expand Down
1 change: 1 addition & 0 deletions src/main/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ function handleMetric(metric: MetricIPCMessage): void {
return;
}

// eslint-disable-next-line deprecation/deprecation
const metricsAggregator = metrics.getMetricsAggregatorForClient(client);

metricsAggregator.add(metric.metricType, metric.name, metric.value, metric.unit, metric.tags, metric.timestamp);
Expand Down
18 changes: 13 additions & 5 deletions src/renderer/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,36 +46,40 @@ class ElectronRendererMetricsAggregator implements MetricsAggregator {
/**
* Adds a value to a counter metric
*
* @experimental This API is experimental and might have breaking changes in the future.
* @deprecated — The Sentry metrics beta has ended. This method will be removed in a future release
*/
function increment(name: string, value: number = 1, data?: MetricData): void {
// eslint-disable-next-line deprecation/deprecation
metricsCore.increment(ElectronRendererMetricsAggregator, name, value, data);
}

/**
* Adds a value to a distribution metric
*
* @experimental This API is experimental and might have breaking changes in the future.
* @deprecated — The Sentry metrics beta has ended. This method will be removed in a future release
*/
function distribution(name: string, value: number, data?: MetricData): void {
// eslint-disable-next-line deprecation/deprecation
metricsCore.distribution(ElectronRendererMetricsAggregator, name, value, data);
}

/**
* Adds a value to a set metric. Value must be a string or integer.
*
* @experimental This API is experimental and might have breaking changes in the future.
* @deprecated — The Sentry metrics beta has ended. This method will be removed in a future release
*/
function set(name: string, value: number | string, data?: MetricData): void {
// eslint-disable-next-line deprecation/deprecation
metricsCore.set(ElectronRendererMetricsAggregator, name, value, data);
}

/**
* Adds a value to a gauge metric
*
* @experimental This API is experimental and might have breaking changes in the future.
* @deprecated — The Sentry metrics beta has ended. This method will be removed in a future release
*/
function gauge(name: string, value: number, data?: MetricData): void {
// eslint-disable-next-line deprecation/deprecation
metricsCore.gauge(ElectronRendererMetricsAggregator, name, value, data);
}

Expand All @@ -86,7 +90,7 @@ function gauge(name: string, value: number, data?: MetricData): void {
* You can either directly capture a numeric `value`, or wrap a callback function in `timing`.
* In the latter case, the duration of the callback execution will be captured as a span & a metric.
*
* @experimental This API is experimental and might have breaking changes in the future.
* @deprecated — The Sentry metrics beta has ended. This method will be removed in a future release
*/
function timing(name: string, value: number, unit?: DurationUnit, data?: Omit<MetricData, 'unit'>): void;
function timing<T>(name: string, callback: () => T, unit?: DurationUnit, data?: Omit<MetricData, 'unit'>): T;
Expand All @@ -96,9 +100,13 @@ function timing<T = void>(
unit: DurationUnit = 'second',
data?: Omit<MetricData, 'unit'>,
): T | void {
// eslint-disable-next-line deprecation/deprecation
metricsCore.timing(ElectronRendererMetricsAggregator, name, value, unit, data);
}

/**
* @deprecated — The Sentry metrics beta has ended. This will be removed in a future release
*/
export const metrics = {
increment,
distribution,
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ interface ElectronRendererOptions extends BrowserOptions {
export function init<O extends ElectronRendererOptions>(
options: ElectronRendererOptions & O = {} as ElectronRendererOptions & O,
// This parameter name ensures that TypeScript error messages contain a hint for fixing SDK version mismatches
originalInit: (if_you_get_a_typescript_error_ensure_sdks_use_version_v8_35_0: O) => void = browserInit,
originalInit: (if_you_get_a_typescript_error_ensure_sdks_use_version_v8_37_1: O) => void = browserInit,
): void {
// Ensure the browser SDK is only init'ed once.
if (window?.__SENTRY__RENDERER_INIT__) {
Expand Down
2 changes: 2 additions & 0 deletions src/utility/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export {
linkedErrorsIntegration,
localVariablesIntegration,
lruMemoizerIntegration,
// eslint-disable-next-line deprecation/deprecation
metrics,
modulesIntegration,
mongoIntegration,
Expand All @@ -93,6 +94,7 @@ export {
parameterize,
postgresIntegration,
prismaIntegration,
processThreadBreadcrumbIntegration,
profiler,
redisIntegration,
requestDataIntegration,
Expand Down
Loading

0 comments on commit 76d0aaa

Please sign in to comment.