mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 09:38:33 +08:00
feat(traces): add support for aws xray (#1194)
This commit is contained in:
@ -92,6 +92,7 @@ ignore_errors = false # boolean [true or false],
|
||||
sampling_rate = 0.1 # decimal rate between 0.0 - 1.0
|
||||
otel_exporter_otlp_endpoint = "http://localhost:4317" # endpoint to send metrics and traces to, can include port number
|
||||
otel_exporter_otlp_timeout = 5000 # timeout (in milliseconds) for sending metrics and traces
|
||||
use_xray_generator = false # Set this to true for AWS X-ray compatible traces
|
||||
|
||||
# This section provides some secret values.
|
||||
[secrets]
|
||||
|
||||
@ -9,6 +9,7 @@ log_format = "default"
|
||||
[log.telemetry]
|
||||
traces_enabled = false
|
||||
metrics_enabled = false
|
||||
use_xray_generator = false
|
||||
|
||||
# TODO: Update database credentials before running application
|
||||
[master_database]
|
||||
|
||||
@ -18,6 +18,7 @@ traces_enabled = false # Whether traces are
|
||||
metrics_enabled = false # Whether metrics are enabled.
|
||||
ignore_errors = false # Whether to ignore errors during traces or metrics pipeline setup.
|
||||
otel_exporter_otlp_endpoint = "https://otel-collector:4317" # Endpoint to send metrics and traces to.
|
||||
use_xray_generator = false
|
||||
|
||||
[master_database]
|
||||
username = "db_user"
|
||||
|
||||
@ -99,6 +99,8 @@ pub struct LogTelemetry {
|
||||
pub otel_exporter_otlp_endpoint: Option<String>,
|
||||
/// Timeout (in milliseconds) for sending metrics and traces.
|
||||
pub otel_exporter_otlp_timeout: Option<u64>,
|
||||
/// Whether to use xray ID generator, (enable this if you plan to use AWS-XRAY)
|
||||
pub use_xray_generator: bool,
|
||||
}
|
||||
|
||||
/// Telemetry / tracing.
|
||||
|
||||
@ -134,7 +134,7 @@ fn setup_tracing_pipeline(
|
||||
{
|
||||
global::set_text_map_propagator(TraceContextPropagator::new());
|
||||
|
||||
let trace_config = trace::config()
|
||||
let mut trace_config = trace::config()
|
||||
.with_sampler(trace::Sampler::TraceIdRatioBased(
|
||||
config.sampling_rate.unwrap_or(1.0),
|
||||
))
|
||||
@ -142,6 +142,9 @@ fn setup_tracing_pipeline(
|
||||
"service.name",
|
||||
service_name,
|
||||
)]));
|
||||
if config.use_xray_generator {
|
||||
trace_config = trace_config.with_id_generator(trace::XrayIdGenerator::default());
|
||||
}
|
||||
let traces_layer_result = opentelemetry_otlp::new_pipeline()
|
||||
.tracing()
|
||||
.with_exporter(get_opentelemetry_exporter(config))
|
||||
|
||||
Reference in New Issue
Block a user