CAD-403 Configs setting and getting does not work as expected
paweljakubas opened this issue · 0 comments
paweljakubas commented
Hi,
I experimented with the project in the context of cardano-wallet project. The idea was to deliver/document minimal configs for --logging-config
. I did the following:
- Initialized logging (using
defaultConfigStdout
and cardano-wallet'sinitTracer
: https://github.com/input-output-hk/cardano-wallet/blob/d150ed680d376be2306c93e69ba63e06cacc5c7f/lib/cli/src/Cardano/CLI.hs#L1149) - Dumped the configuration to yaml (using
exportConfiguration
) - Then read the obtained yaml configurations and
- Compared the configuration values of 1 and 3 (I expect them to be the same). To achieve that I used something like that :
compareCfgs cfg1 cfg2 = do
cfgI1 <- readMVar cfg1
cfgI2 <- readMVar cfg2
cfgI1 `shouldBe` cfgI2
Here, I rely on the fact that ConfigurationInternal
has Eq
instance.
And, for the initTracer
case I got the following yaml:
rotation: null
defaultBackends:
- KatipBK
setupBackends:
- KatipBK
- AggregationBK
hasPrometheus: null
hasGraylog: null
hasGUI: null
defaultScribes:
- - StdoutSK
- text
options:
mapSubtrace:
'#messagecounters.monitoring':
subtrace: NoTrace
'#messagecounters.ekgview':
subtrace: NoTrace
'#messagecounters.aggregation':
subtrace: NoTrace
'#messagecounters.graylog':
subtrace: NoTrace
'#messagecounters.katip':
subtrace: NoTrace
'#messagecounters.switchboard':
subtrace: NoTrace
setupScribes:
- scName: text
scRotation: null
scKind: StdoutSK
scFormat: ScText
scPrivacy: ScPublic
- scName: json
scRotation: null
scKind: StdoutSK
scFormat: ScJson
scPrivacy: ScPublic
logOutput: null
hasEKG: null
minSeverity: Debug
For the defaultConfigStdout
the following :
rotation: null
defaultBackends:
- KatipBK
setupBackends:
- KatipBK
hasPrometheus: null
hasGraylog: null
hasGUI: null
defaultScribes:
- - StdoutSK
- text
options:
mapSubtrace:
'#messagecounters.monitoring':
subtrace: NoTrace
'#messagecounters.ekgview':
subtrace: NoTrace
'#messagecounters.aggregation':
subtrace: NoTrace
'#messagecounters.graylog':
subtrace: NoTrace
'#messagecounters.katip':
subtrace: NoTrace
'#messagecounters.switchboard':
subtrace: NoTrace
setupScribes:
- scName: text
scRotation: null
scKind: StdoutSK
scFormat: ScText
scPrivacy: ScPublic
- scName: json
scRotation: null
scKind: StdoutSK
scFormat: ScJson
scPrivacy: ScPublic
logOutput: null
hasEKG: null
minSeverity: Debug
And when using the above yaml files and reading them using CM.setup configFile
we endup with different values of ConfigurationInternal
values.
To be specific, for defaultConfigStdout
we have the following discrepancy:
1) Cardano.CLI.initTracer no settings
expected: ConfigurationInternal {cgMinSeverity = Debug, cgDefRotation = Nothing, cgMapSeverity = fromList [], cgMapSubtrace = fromList [("#messagecounters.monitoring",NoTrace),("#messagecounters.ekgview",NoTrace),("#messagecounters.aggregation",NoTrace),("#messagecounters.graylog",NoTrace),("#messagecounters.katip",NoTrace),("#messagecounters.switchboard",NoTrace)], cgOptions = fromList [("mapSubtrace",fromList [("#messagecounters.monitoring",Object (fromList [("subtrace",String "NoTrace")])),("#messagecounters.ekgview",Object (fromList [("subtrace",String "NoTrace")])),("#messagecounters.aggregation",Object (fromList [("subtrace",String "NoTrace")])),("#messagecounters.graylog",Object (fromList [("subtrace",String "NoTrace")])),("#messagecounters.katip",Object (fromList [("subtrace",String "NoTrace")])),("#messagecounters.switchboard",Object (fromList [("subtrace",String "NoTrace")]))])], cgMapBackend = fromList [], cgDefBackendKs = [KatipBK], cgSetupBackends = [KatipBK], cgMapScribe = fromList [], cgMapScribeCache = fromList [], cgDefScribes = ["StdoutSK::text"], cgSetupScribes = [ScribeDefinition {scKind = StdoutSK, scFormat = ScText, scName = "text", scPrivacy = ScPublic, scRotation = Nothing},ScribeDefinition {scKind = StdoutSK, scFormat = ScJson, scName = "json", scPrivacy = ScPublic, scRotation = Nothing}], cgMapAggregatedKind = fromList [], cgDefAggregatedKind = StatsAK, cgMonitors = fromList [], cgPortEKG = 0, cgPortGraylog = 0, cgBindAddrPrometheus = Just ("127.0.0.1",12799), cgPortGUI = 0, cgLogOutput = Nothing}
but got: ConfigurationInternal {cgMinSeverity = Debug, cgDefRotation = Nothing, cgMapSeverity = fromList [], cgMapSubtrace = fromList [("#messagecounters.monitoring",NoTrace),("#messagecounters.ekgview",NoTrace),("#messagecounters.aggregation",NoTrace),("#messagecounters.graylog",NoTrace),("#messagecounters.katip",NoTrace),("#messagecounters.switchboard",NoTrace)], cgOptions = fromList [], cgMapBackend = fromList [], cgDefBackendKs = [KatipBK], cgSetupBackends = [KatipBK], cgMapScribe = fromList [], cgMapScribeCache = fromList [], cgDefScribes = ["StdoutSK::text"], cgSetupScribes = [ScribeDefinition {scKind = StdoutSK, scFormat = ScText, scName = "text", scPrivacy = ScPublic, scRotation = Nothing},ScribeDefinition {scKind = StdoutSK, scFormat = ScJson, scName = "json", scPrivacy = ScPublic, scRotation = Nothing}], cgMapAggregatedKind = fromList [], cgDefAggregatedKind = StatsAK, cgMonitors = fromList [], cgPortEKG = 0, cgPortGraylog = 0, cgBindAddrPrometheus = Nothing, cgPortGUI = 0, cgLogOutput = Nothing}
And for initTracer
situation the following discrepancy :
expected: ConfigurationInternal {cgMinSeverity = Debug, cgDefRotation = Nothing, cgMapSeverity = fromList [], cgMapSubtrace = fromList [("#messagecounters.monitoring",NoTrace),("#messagecounters.ekgview",NoTrace),("#messagecounters.aggregation",NoTrace),("#messagecounters.graylog",NoTrace),("#messagecounters.katip",NoTrace),("#messagecounters.switchboard",NoTrace)], cgOptions = fromList [("mapSubtrace",fromList [("#messagecounters.monitoring",Object (fromList [("subtrace",String "NoTrace")])),("#messagecounters.ekgview",Object (fromList [("subtrace",String "NoTrace")])),("#messagecounters.aggregation",Object (fromList [("subtrace",String "NoTrace")])),("#messagecounters.graylog",Object (fromList [("subtrace",String "NoTrace")])),("#messagecounters.katip",Object (fromList [("subtrace",String "NoTrace")])),("#messagecounters.switchboard",Object (fromList [("subtrace",String "NoTrace")]))])], cgMapBackend = fromList [], cgDefBackendKs = [KatipBK], cgSetupBackends = [AggregationBK,KatipBK], cgMapScribe = fromList [], cgMapScribeCache = fromList [], cgDefScribes = ["StdoutSK::text"], cgSetupScribes = [ScribeDefinition {scKind = StdoutSK, scFormat = ScText, scName = "text", scPrivacy = ScPublic, scRotation = Nothing},ScribeDefinition {scKind = StdoutSK, scFormat = ScJson, scName = "json", scPrivacy = ScPublic, scRotation = Nothing}], cgMapAggregatedKind = fromList [], cgDefAggregatedKind = StatsAK, cgMonitors = fromList [], cgPortEKG = 0, cgPortGraylog = 0, cgBindAddrPrometheus = Just ("127.0.0.1",12799), cgPortGUI = 0, cgLogOutput = Nothing}
but got: ConfigurationInternal {cgMinSeverity = Debug, cgDefRotation = Nothing, cgMapSeverity = fromList [], cgMapSubtrace = fromList [("#messagecounters.monitoring",NoTrace),("#messagecounters.ekgview",NoTrace),("#messagecounters.aggregation",NoTrace),("#messagecounters.graylog",NoTrace),("#messagecounters.katip",NoTrace),("#messagecounters.switchboard",NoTrace)], cgOptions = fromList [], cgMapBackend = fromList [], cgDefBackendKs = [KatipBK], cgSetupBackends = [KatipBK,AggregationBK], cgMapScribe = fromList [], cgMapScribeCache = fromList [], cgDefScribes = ["StdoutSK::text"], cgSetupScribes = [ScribeDefinition {scKind = StdoutSK, scFormat = ScText, scName = "text", scPrivacy = ScPublic, scRotation = Nothing},ScribeDefinition {scKind = StdoutSK, scFormat = ScJson, scName = "json", scPrivacy = ScPublic, scRotation = Nothing}], cgMapAggregatedKind = fromList [], cgDefAggregatedKind = StatsAK, cgMonitors = fromList [], cgPortEKG = 0, cgPortGraylog = 0, cgBindAddrPrometheus = Nothing, cgPortGUI = 0, cgLogOutput = Nothing}
There is problem with cgBindAddrPrometheus
and cgOptions
.