VOL-2861 replace uint64 kafka interadapter timestamps with timestamp proto
Change-Id: I7b0fe854ff7c91984237a111789603129151dba3
diff --git a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/config/logcontroller.go b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/config/logcontroller.go
index 9c36241..b00569f 100644
--- a/vendor/github.com/opencord/voltha-lib-go/v3/pkg/config/logcontroller.go
+++ b/vendor/github.com/opencord/voltha-lib-go/v3/pkg/config/logcontroller.go
@@ -28,13 +28,15 @@
"errors"
"github.com/opencord/voltha-lib-go/v3/pkg/log"
"os"
+ "sort"
"strings"
)
const (
- defaultLogLevelKey = "default" // kvstore key containing default loglevel
- globalConfigRootNode = "global" // Root Node in kvstore containing global config
- initialGlobalDefaultLogLevelValue = "WARN" // Hard-coded Global Default loglevel pushed at PoD startup
+ defaultLogLevelKey = "default" // kvstore key containing default loglevel
+ globalConfigRootNode = "global" // Root Node in kvstore containing global config
+ initialGlobalDefaultLogLevelValue = "WARN" // Hard-coded Global Default loglevel pushed at PoD startup
+ logPackagesListKey = "log_package_list" // kvstore key containing list of allowed log packages
)
// ComponentLogController represents a Configuration for Logging Config of specific Voltha component type
@@ -92,6 +94,8 @@
cc.persistInitialDefaultLogConfigs(ctx)
+ cc.persistRegisteredLogPackageList(ctx)
+
cc.processLogConfig(ctx)
}
@@ -120,6 +124,28 @@
}
}
+// Method to save list of all registered packages for component into config kvstore. A single string
+// is constructed with comma-separated package names in sorted order and persisted
+func (c *ComponentLogController) persistRegisteredLogPackageList(ctx context.Context) {
+
+ componentMetadataConfig := c.configManager.InitComponentConfig(c.ComponentName, ConfigTypeMetadata)
+ logger.Debugw("component-metadata-config", log.Fields{"component-metadata-config": componentMetadataConfig})
+
+ packageList := log.GetPackageNames()
+ packageList = append(packageList, defaultLogLevelKey)
+ sort.Strings(packageList)
+
+ packageNames, err := json.Marshal(packageList)
+ if err != nil {
+ logger.Errorw("failed-to-marshal-log-package-list-for-storage", log.Fields{"error": err, "packageList": packageList})
+ return
+ }
+
+ if err := componentMetadataConfig.Save(ctx, logPackagesListKey, string(packageNames)); err != nil {
+ logger.Errorw("failed-to-persist-component-registered-log-package-list-at-startup", log.Fields{"error": err, "packageNames": packageNames})
+ }
+}
+
// ProcessLogConfig will first load and apply log config and then start waiting on component config and global config
// channels for any changes. Event channel will be recieved from Backend for valid change type
// Then data for componentn log config and global log config will be retrieved from Backend and stored in updatedLogConfig in precedence order