[VOL-3142] Enabled tracing for rw-core and added config parameters
Change-Id: I0c5faa104f35b2af694f32785ec031c5277e3f64
diff --git a/rw_core/config/config.go b/rw_core/config/config.go
index 3d95f33..03abc67 100644
--- a/rw_core/config/config.go
+++ b/rw_core/config/config.go
@@ -50,6 +50,9 @@
defaultLiveProbeInterval = 60 * time.Second
defaultNotLiveProbeInterval = 5 * time.Second // Probe more frequently when not alive
defaultProbeAddress = ":8080"
+ defaultTraceEnabled = false
+ defaultTraceAgentAddress = "127.0.0.1:6831"
+ defaultLogCorrelationEnabled = true
)
// RWCoreFlags represents the set of configurations used by the read-write core service
@@ -79,6 +82,9 @@
LiveProbeInterval time.Duration
NotLiveProbeInterval time.Duration
ProbeAddress string
+ TraceEnabled bool
+ TraceAgentAddress string
+ LogCorrelationEnabled bool
}
// NewRWCoreFlags returns a new RWCore config
@@ -108,6 +114,9 @@
LiveProbeInterval: defaultLiveProbeInterval,
NotLiveProbeInterval: defaultNotLiveProbeInterval,
ProbeAddress: defaultProbeAddress,
+ TraceEnabled: defaultTraceEnabled,
+ TraceAgentAddress: defaultTraceAgentAddress,
+ LogCorrelationEnabled: defaultLogCorrelationEnabled,
}
return &rwCoreFlag
}
@@ -180,5 +189,14 @@
help = fmt.Sprintf("The address on which to listen to answer liveness and readiness probe queries over HTTP.")
flag.StringVar(&(cf.ProbeAddress), "probe_address", defaultProbeAddress, help)
+ help = fmt.Sprintf("Whether to send logs to tracing agent?")
+ flag.BoolVar(&(cf.TraceEnabled), "trace_enabled", defaultTraceEnabled, help)
+
+ help = fmt.Sprintf("The address of tracing agent to which span info should be sent.")
+ flag.StringVar(&(cf.TraceAgentAddress), "trace_agent_address", defaultTraceAgentAddress, help)
+
+ help = fmt.Sprintf("Whether to enrich log statements with fields denoting operation being executed for achieving correlation?")
+ flag.BoolVar(&(cf.LogCorrelationEnabled), "log_correlation_enabled", defaultLogCorrelationEnabled, help)
+
flag.Parse()
}