Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions packages/core/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,7 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
setupWeightBasedFlushing(this, 'afterCaptureLog', 'flushLogs', estimateLogSizeInBytes, _INTERNAL_flushLogsBuffer);
}

// todo(v11): Remove the experimental flag
// eslint-disable-next-line typescript/no-deprecated
const enableMetrics = this._options.enableMetrics ?? this._options._experiments?.enableMetrics ?? true;
const enableMetrics = this._options.enableMetrics ?? true;

// Setup metric flushing with weight and timeout tracking
if (enableMetrics) {
Expand Down
12 changes: 3 additions & 9 deletions packages/core/src/metrics/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,8 @@ export function _INTERNAL_captureMetric(beforeMetric: Metric, options?: Internal
return;
}

const { _experiments, enableMetrics, beforeSendMetric } = client.getOptions();

// todo(v11): Remove the experimental flag
// eslint-disable-next-line typescript/no-deprecated
const metricsEnabled = enableMetrics ?? _experiments?.enableMetrics ?? true;
const { enableMetrics, beforeSendMetric } = client.getOptions();
const metricsEnabled = enableMetrics ?? true;

if (!metricsEnabled) {
DEBUG_BUILD && debug.warn('metrics option not enabled, metric will not be captured.');
Expand All @@ -190,10 +187,7 @@ export function _INTERNAL_captureMetric(beforeMetric: Metric, options?: Internal

client.emit('processMetric', enrichedMetric);

// todo(v11): Remove the experimental `beforeSendMetric`
// eslint-disable-next-line typescript/no-deprecated
const beforeSendCallback = beforeSendMetric || _experiments?.beforeSendMetric;
const processedMetric = beforeSendCallback ? beforeSendCallback(enrichedMetric) : enrichedMetric;
const processedMetric = beforeSendMetric ? beforeSendMetric(enrichedMetric) : enrichedMetric;

if (!processedMetric) {
DEBUG_BUILD && debug.log('`beforeSendMetric` returned `null`, will not send metric.');
Expand Down
25 changes: 0 additions & 25 deletions packages/core/src/types/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,31 +411,6 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
_experiments?: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;

/**
* If metrics support should be enabled.
*
* @default false
* @experimental
* @deprecated Use the top level`enableMetrics` option instead.
*/
enableMetrics?: boolean;

/**
* An event-processing callback for metrics, guaranteed to be invoked after all other metric
* processors. This allows a metric to be modified or dropped before it's sent.
*
* Note that you must return a valid metric from this callback. If you do not wish to modify the metric, simply return
* it at the end. Returning `null` will cause the metric to be dropped.
*
* @default undefined
* @experimental
*
* @param metric The metric generated by the SDK.
* @returns A new metric that will be sent | null.
* @deprecated Use the top level`beforeSendMetric` option instead.
*/
beforeSendMetric?: (metric: Metric) => Metric | null;
};

/**
Expand Down
Loading