Skip to content

Commit 36e7b1d

Browse files
committed
Revert "fix(bun): Inline collection interval normalization, remove from node public API"
This reverts commit 6fc3c7a.
1 parent 6fc3c7a commit 36e7b1d

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

packages/bun/src/integrations/bunRuntimeMetrics.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { performance } from 'perf_hooks';
22
import { _INTERNAL_safeDateNow, _INTERNAL_safeUnref, defineIntegration, metrics } from '@sentry/core';
3-
import type { NodeRuntimeMetricsOptions } from '@sentry/node';
3+
import { _INTERNAL_normalizeCollectionInterval, type NodeRuntimeMetricsOptions } from '@sentry/node';
44

55
const INTEGRATION_NAME = 'BunRuntimeMetrics';
66
const DEFAULT_INTERVAL_MS = 30_000;
7-
const MIN_COLLECTION_INTERVAL_MS = 1_000;
87

98
/**
109
* Which metrics to collect in the Bun runtime metrics integration.
@@ -65,16 +64,10 @@ export interface BunRuntimeMetricsOptions {
6564
* ```
6665
*/
6766
export const bunRuntimeMetricsIntegration = defineIntegration((options: BunRuntimeMetricsOptions = {}) => {
68-
const rawInterval = options.collectionIntervalMs ?? DEFAULT_INTERVAL_MS;
69-
if (!Number.isFinite(rawInterval) || rawInterval < MIN_COLLECTION_INTERVAL_MS) {
70-
// eslint-disable-next-line no-console
71-
console.warn(
72-
`[Sentry] ${INTEGRATION_NAME}: collectionIntervalMs (${rawInterval}) is below the minimum of ${MIN_COLLECTION_INTERVAL_MS}ms. Using minimum of ${MIN_COLLECTION_INTERVAL_MS}ms.`,
73-
);
74-
}
75-
const collectionIntervalMs = Number.isFinite(rawInterval)
76-
? Math.max(rawInterval, MIN_COLLECTION_INTERVAL_MS)
77-
: MIN_COLLECTION_INTERVAL_MS;
67+
const collectionIntervalMs = _INTERNAL_normalizeCollectionInterval(
68+
options.collectionIntervalMs ?? DEFAULT_INTERVAL_MS,
69+
INTEGRATION_NAME,
70+
);
7871
const collect = {
7972
// Default on
8073
cpuUtilization: true,

packages/node-core/src/common-exports.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ import * as logger from './logs/exports';
1212

1313
// Node-core integrations (not OTel-dependent)
1414
export { nodeContextIntegration } from './integrations/context';
15-
export { nodeRuntimeMetricsIntegration, type NodeRuntimeMetricsOptions } from './integrations/nodeRuntimeMetrics';
15+
export {
16+
nodeRuntimeMetricsIntegration,
17+
type NodeRuntimeMetricsOptions,
18+
_INTERNAL_normalizeCollectionInterval,
19+
} from './integrations/nodeRuntimeMetrics';
1620
export { contextLinesIntegration } from './integrations/contextlines';
1721
export { localVariablesIntegration } from './integrations/local-variables';
1822
export { modulesIntegration } from './integrations/modules';

packages/node/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,5 @@ export {
203203
cron,
204204
NODE_VERSION,
205205
validateOpenTelemetrySetup,
206+
_INTERNAL_normalizeCollectionInterval,
206207
} from '@sentry/node-core';

0 commit comments

Comments
 (0)