mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 01:57:45 +08:00 
			
		
		
		
	feat(router_env): add sampling_rate for traces (#335)
This commit is contained in:
		| @ -63,6 +63,11 @@ log_format = "default"  # Log format. "default" or "json" | ||||
| # defaults to "WARN" | ||||
| level = "DEBUG" | ||||
|  | ||||
| # Telemetry configuration for traces | ||||
| [log.telemetry] | ||||
| enabled = false # boolean [true or false] | ||||
| sampling_rate = 0.1 # decimal rate between 0.0 - 1.0 | ||||
|  | ||||
| # This section provides configuration details for using AWS KMS to encrypt | ||||
| # data like payment method details being sent over a network. | ||||
| [keys] | ||||
|  | ||||
| @ -90,6 +90,8 @@ pub struct LogConsole { | ||||
| pub struct LogTelemetry { | ||||
|     /// Whether tracing/telemetry is enabled. | ||||
|     pub enabled: bool, | ||||
|     /// Sampling rate for traces | ||||
|     pub sampling_rate: Option<f64>, | ||||
| } | ||||
|  | ||||
| /// Telemetry / tracing. | ||||
|  | ||||
| @ -42,6 +42,9 @@ pub fn setup<Str: AsRef<str>>( | ||||
|  | ||||
|     let telemetry = if conf.telemetry.enabled { | ||||
|         let trace_config = trace::config() | ||||
|             .with_sampler(trace::Sampler::TraceIdRatioBased( | ||||
|                 conf.telemetry.sampling_rate.unwrap_or(1.0), | ||||
|             )) | ||||
|             .with_resource(Resource::new(vec![KeyValue::new("service.name", "router")])); | ||||
|         let tracer = opentelemetry_otlp::new_pipeline() | ||||
|             .tracing() | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Sampras Lopes
					Sampras Lopes