File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed 
platform-includes/metrics/options Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 11The Sentry JavaScript SDK provides several options to configure how metrics are captured and sent to Sentry.
22
3+ ### Filtering and Modifying Metrics  
4+ 
5+ Use the ` beforeSendMetric `  callback to filter or modify metrics before they're sent to Sentry. This is useful for:
6+ 
7+ -  Removing sensitive data from metric attributes
8+ -  Dropping metrics you don't want to send
9+ -  Adding or modifying attributes
10+ 
11+ The callback receives a metric object and must return either a modified metric or ` null `  to drop it.
12+ 
13+ ``` javascript 
14+ Sentry .init ({
15+   //  ...
16+   beforeSendMetric :  (metric ) =>  {
17+     //  Drop metrics with specific attributes
18+     if  (metric .attributes ? .dropMe  ===  true ) {
19+       return  null ;
20+     }
21+ 
22+     //  Modify metric attributes
23+     metric .tags  =  {
24+       ... metric .tags ,
25+       processed:  true ,
26+     };
27+ 
28+     return  metric;
29+   },
30+ });
31+ ` ` ` 
32+ 
333### Disabling Metrics 
434
535If you want to disable metrics collection entirely, you can do so by disabling the `  _experimental .enableMetrics `  flag:
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments