Files
klz-cables.com/.pnpm-store/v10/files/a8/87076942bdc88ef1e5c15934be8ed33ba86a5631b2a2a8e3098a65f8ac1be6ac8701b8158de55ce139006272c444f97bce5204c19f3e94988fcf16854a707f
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

126 lines
2.7 KiB
Plaintext

import { _INTERNAL_captureMetric } from './internal.js';
/**
* Options for capturing a metric.
*/
/**
* Capture a metric with the given type, name, and value.
*
* @param type - The type of the metric.
* @param name - The name of the metric.
* @param value - The value of the metric.
* @param options - Options for capturing the metric.
*/
function captureMetric(type, name, value, options) {
_INTERNAL_captureMetric(
{ type, name, value, unit: options?.unit, attributes: options?.attributes },
{ scope: options?.scope },
);
}
/**
* @summary Increment a counter metric.
*
* @param name - The name of the counter metric.
* @param value - The value to increment by (defaults to 1).
* @param options - Options for capturing the metric.
*
* @example
*
* ```
* Sentry.metrics.count('api.requests', 1, {
* attributes: {
* endpoint: '/api/users',
* method: 'GET',
* status: 200
* }
* });
* ```
*
* @example With custom value
*
* ```
* Sentry.metrics.count('items.processed', 5, {
* attributes: {
* processor: 'batch-processor',
* queue: 'high-priority'
* }
* });
* ```
*/
function count(name, value = 1, options) {
captureMetric('counter', name, value, options);
}
/**
* @summary Set a gauge metric to a specific value.
*
* @param name - The name of the gauge metric.
* @param value - The current value of the gauge.
* @param options - Options for capturing the metric.
*
* @example
*
* ```
* Sentry.metrics.gauge('memory.usage', 1024, {
* unit: 'megabyte',
* attributes: {
* process: 'web-server',
* region: 'us-east-1'
* }
* });
* ```
*
* @example Without unit
*
* ```
* Sentry.metrics.gauge('active.connections', 42, {
* attributes: {
* server: 'api-1',
* protocol: 'websocket'
* }
* });
* ```
*/
function gauge(name, value, options) {
captureMetric('gauge', name, value, options);
}
/**
* @summary Record a value in a distribution metric.
*
* @param name - The name of the distribution metric.
* @param value - The value to record in the distribution.
* @param options - Options for capturing the metric.
*
* @example
*
* ```
* Sentry.metrics.distribution('task.duration', 500, {
* unit: 'millisecond',
* attributes: {
* task: 'data-processing',
* priority: 'high'
* }
* });
* ```
*
* @example Without unit
*
* ```
* Sentry.metrics.distribution('batch.size', 100, {
* attributes: {
* processor: 'batch-1',
* type: 'async'
* }
* });
* ```
*/
function distribution(name, value, options) {
captureMetric('distribution', name, value, options);
}
export { count, distribution, gauge };
//# sourceMappingURL=public-api.js.map