11import * as Sentry from "@sentry/browser" ;
22import { getCurrentVersionSlug , getUrlConfig , parseRoute } from "./routing" ;
3- import { RUNNING_MODE } from "./utils/env" ;
3+ import { isProd , RUNNING_MODE } from "./utils/env" ;
44
55/**
66 * Metric attributes type for Sentry metrics.
@@ -45,6 +45,7 @@ export const metrics = {
4545 * This sends a delta to Sentry without local accumulation.
4646 */
4747 count ( name : string , value : number = 1 , attributes : MetricAttributes = { } ) {
48+ if ( ! isProd ) return ;
4849 Sentry . metrics . count ( name , value , {
4950 attributes : { ...getCommonAttributes ( ) , ...attributes } ,
5051 } ) ;
@@ -54,6 +55,7 @@ export const metrics = {
5455 * Track current values or state (e.g., resource usage, resolved version).
5556 */
5657 gauge ( name : string , value : number , attributes : MetricAttributes = { } ) {
58+ if ( ! isProd ) return ;
5759 Sentry . metrics . gauge ( name , value , {
5860 attributes : { ...getCommonAttributes ( ) , ...attributes } ,
5961 } ) ;
@@ -63,6 +65,7 @@ export const metrics = {
6365 * Track distributions for statistical analysis (e.g., durations, latency).
6466 */
6567 distribution ( name : string , value : number , attributes : MetricAttributes = { } ) {
68+ if ( ! isProd ) return ;
6669 Sentry . metrics . distribution ( name , value , {
6770 attributes : { ...getCommonAttributes ( ) , ...attributes } ,
6871 } ) ;
0 commit comments