[VOL-3199] Added support for dynamic enable/disable of Trace Publishing
Change-Id: I920b2964c89ad823985da29d7f8279689a62d3b6
diff --git a/rw_core/core/core.go b/rw_core/core/core.go
index 01543ff..5a18411 100644
--- a/rw_core/core/core.go
+++ b/rw_core/core/core.go
@@ -82,6 +82,7 @@
// sync logging config with kv store
cm := conf.NewConfigManager(ctx, kvClient, cf.KVStoreType, cf.KVStoreAddress, cf.KVStoreTimeout)
go conf.StartLogLevelConfigProcessing(cm, ctx)
+ go conf.StartLogFeaturesConfigProcessing(cm, ctx)
backend := cm.Backend
backend.LivenessChannelInterval = cf.LiveProbeInterval / 2
diff --git a/rw_core/core/device/agent.go b/rw_core/core/device/agent.go
index ebfb641..b6bd0ec 100755
--- a/rw_core/core/device/agent.go
+++ b/rw_core/core/device/agent.go
@@ -671,7 +671,7 @@
agent.requestQueue.RequestComplete()
if err := agent.deviceMgr.processTransition(log.WithSpanFromContext(context.Background(), ctx), device, previousState); err != nil {
- log.Errorw("failed-process-transition", log.Fields{"device-id": device.Id, "previousAdminState": previousState.Admin, "currentAdminState": device.AdminState})
+ logger.Errorw(ctx, "failed-process-transition", log.Fields{"device-id": device.Id, "previousAdminState": previousState.Admin, "currentAdminState": device.AdminState})
}
return nil
}
diff --git a/rw_core/core/device/remote/adapter_proxy_test.go b/rw_core/core/device/remote/adapter_proxy_test.go
index 151483a..fd6b94d 100755
--- a/rw_core/core/device/remote/adapter_proxy_test.go
+++ b/rw_core/core/device/remote/adapter_proxy_test.go
@@ -52,8 +52,9 @@
)
func init() {
+ ctx := context.Background()
if _, err := log.SetDefaultLogger(log.JSON, 0, log.Fields{"instanceId": coreInstanceID}); err != nil {
- log.With(log.Fields{"error": err}).Fatal("Cannot setup logging")
+ logger.With(log.Fields{"error": err}).Fatal(ctx, "Cannot setup logging")
}
// Set the log level to Warning
log.SetAllLogLevel(log.WarnLevel)
@@ -68,8 +69,6 @@
kafka.MsgClient(kc),
kafka.DefaultTopic(&kafka.Topic{Name: coreName}))
- ctx := context.Background()
-
if err = coreKafkaICProxy.Start(ctx); err != nil {
logger.Fatalw(ctx, "Failure-starting-core-kafka-intercontainerProxy", log.Fields{"error": err})
}
diff --git a/rw_core/main.go b/rw_core/main.go
index 98d3985..35472e5 100644
--- a/rw_core/main.go
+++ b/rw_core/main.go
@@ -141,7 +141,7 @@
// Add the probe to the context to pass to all the services started
probeCtx := context.WithValue(ctx, probe.ProbeContextKey, p)
- closer, err := log.InitTracingAndLogCorrelation(cf.TraceEnabled, cf.TraceAgentAddress, cf.LogCorrelationEnabled)
+ closer, err := log.GetGlobalLFM().InitTracingAndLogCorrelation(cf.TraceEnabled, cf.TraceAgentAddress, cf.LogCorrelationEnabled)
if err != nil {
logger.Warnw(ctx, "unable-to-initialize-tracing-and-log-correlation-module", log.Fields{"error": err})
} else {