2020-11-12 19:29:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								package  setting  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-14 20:48:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  "github.com/go-kit/log/level"  
						 
					
						
							
								
									
										
										
										
											2022-12-13 22:41:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-12 19:29:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								type  Sentry  struct  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Enabled         bool     ` json:"enabled" ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DSN             string   ` json:"dsn" ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CustomEndpoint  string   ` json:"customEndpoint" ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									SampleRate      float64  ` json:"sampleRate" ` 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-09 23:22:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EndpointRPS     int      ` json:"-" ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									EndpointBurst   int      ` json:"-" ` 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-12 19:29:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  ( cfg  * Cfg )  readSentryConfig ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									raw  :=  cfg . Raw . Section ( "log.frontend" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-28 15:25:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									provider  :=  raw . Key ( "provider" ) . MustString ( "sentry" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  provider  ==  "sentry"  ||  provider  !=  "grafana"  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-13 22:41:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										_  =  level . Warn ( cfg . Logger ) . Log ( "msg" ,  "\"sentry\" frontend logging provider is deprecated and will be removed in the next major version. Use \"grafana\" provider instead." ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-28 15:25:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										cfg . Sentry  =  Sentry { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Enabled :         raw . Key ( "enabled" ) . MustBool ( true ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											DSN :             raw . Key ( "sentry_dsn" ) . String ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											CustomEndpoint :  raw . Key ( "custom_endpoint" ) . MustString ( "/log" ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											SampleRate :      raw . Key ( "sample_rate" ) . MustFloat64 ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EndpointRPS :     raw . Key ( "log_endpoint_requests_per_second_limit" ) . MustInt ( 3 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EndpointBurst :   raw . Key ( "log_endpoint_burst_limit" ) . MustInt ( 15 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-12 19:29:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}