mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	sentry: More gracefully handle a value of 0.
If the value at runtime is actually an int, not a float, we should not try to treat it as a dict.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							959c78e1e1
						
					
				
				
					commit
					5f3d6ac983
				
			@@ -55,10 +55,10 @@ def traces_sampler(sampling_context: Dict[str, Any]) -> Union[float, bool]:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    queue = sampling_context.get("queue")
 | 
					    queue = sampling_context.get("queue")
 | 
				
			||||||
    if queue is not None and isinstance(queue, str):
 | 
					    if queue is not None and isinstance(queue, str):
 | 
				
			||||||
        if isinstance(settings.SENTRY_TRACE_WORKER_RATE, float):
 | 
					        if isinstance(settings.SENTRY_TRACE_WORKER_RATE, dict):
 | 
				
			||||||
            return settings.SENTRY_TRACE_WORKER_RATE
 | 
					 | 
				
			||||||
        else:
 | 
					 | 
				
			||||||
            return settings.SENTRY_TRACE_WORKER_RATE.get(queue, 0.0)
 | 
					            return settings.SENTRY_TRACE_WORKER_RATE.get(queue, 0.0)
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            return settings.SENTRY_TRACE_WORKER_RATE
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        return settings.SENTRY_TRACE_RATE
 | 
					        return settings.SENTRY_TRACE_RATE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user