package.build.npm.cjs.metrics.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of browser Show documentation
Show all versions of browser Show documentation
Official Sentry SDK for browsers
{"version":3,"file":"metrics.js","sources":["../../../src/metrics.ts"],"sourcesContent":["import { BrowserMetricsAggregator, metrics as metricsCore } from '@sentry/core';\nimport type { DurationUnit, MetricData, Metrics } from '@sentry/types';\n\n/**\n * Adds a value to a counter metric\n *\n * @experimental This API is experimental and might have breaking changes in the future.\n */\nfunction increment(name: string, value: number = 1, data?: MetricData): void {\n metricsCore.increment(BrowserMetricsAggregator, name, value, data);\n}\n\n/**\n * Adds a value to a distribution metric\n *\n * @experimental This API is experimental and might have breaking changes in the future.\n */\nfunction distribution(name: string, value: number, data?: MetricData): void {\n metricsCore.distribution(BrowserMetricsAggregator, name, value, data);\n}\n\n/**\n * Adds a value to a set metric. Value must be a string or integer.\n *\n * @experimental This API is experimental and might have breaking changes in the future.\n */\nfunction set(name: string, value: number | string, data?: MetricData): void {\n metricsCore.set(BrowserMetricsAggregator, name, value, data);\n}\n\n/**\n * Adds a value to a gauge metric\n *\n * @experimental This API is experimental and might have breaking changes in the future.\n */\nfunction gauge(name: string, value: number, data?: MetricData): void {\n metricsCore.gauge(BrowserMetricsAggregator, name, value, data);\n}\n\n/**\n * Adds a timing metric.\n * The metric is added as a distribution metric.\n *\n * You can either directly capture a numeric `value`, or wrap a callback function in `timing`.\n * In the latter case, the duration of the callback execution will be captured as a span & a metric.\n *\n * @experimental This API is experimental and might have breaking changes in the future.\n */\nfunction timing(name: string, value: number, unit?: DurationUnit, data?: Omit): void;\nfunction timing(name: string, callback: () => T, unit?: DurationUnit, data?: Omit): T;\nfunction timing(\n name: string,\n value: number | (() => T),\n unit: DurationUnit = 'second',\n data?: Omit,\n): T | void {\n return metricsCore.timing(BrowserMetricsAggregator, name, value, unit, data);\n}\n\nexport const metrics: Metrics = {\n increment,\n distribution,\n set,\n gauge,\n timing,\n};\n"],"names":["metricsCore","Br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