Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve logging documentation of configs #1217

Closed

Conversation

paweljakubas
Copy link
Contributor

@paweljakubas paweljakubas commented Dec 22, 2019

Issue Number

#961

Overview

  • I have replicated (tried to do it) monitoring config needed to retrieve what happens when just defaultConfigStdout from iohk-monitoring-framework is called
  • I have replicated (tried to do it) monitoring config needed to retrieve what happens when initTracer with Nothing from cli is called
  • I have updated CLI Manual

Comments

In order to test do :

$ stack test --ta '-m "initTracer"' cardano-wallet-cli:unit

- - StdoutSK
- text

# this is probably a bug of parsing, cannot enforce cgBindAddrPrometheus = Nothing
Copy link
Contributor Author

@paweljakubas paweljakubas Dec 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is something I cannot go through :
so when I put hasPrometheus: or when I omit it at all to specify this option I end up with:

cgBindAddrPrometheus = Just ("127.0.0.1",12799)

When I hasPrometheus: ["",0] I end up with

cgBindAddrPrometheus = Just ("",0)

which is wrong (it should be validated). And it is expected to have cgBindAddrPrometheus = Nothing
BTW. it is inconsistent with example configuration specified here : https://github.com/input-output-hk/iohk-monitoring-framework/blob/bea0e079fc32ed316ce352d17d14199a680e3f6c/iohk-monitoring/test/config.yaml
When we put hasPrometheus: 12799 we end up with parsing error

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to open an issue on the iohk-monitoring-framework. Fixing this is not part of our scope, but reporting it is :)

- KatipBK

# more options which can be passed as key-value pairs:
options:
Copy link
Contributor Author

@paweljakubas paweljakubas Dec 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed in order to have set :

cgMapSubtrace = fromList [("#messagecounters.monitoring",NoTrace),("#messagecounters.ekgview",NoTrace),("#messagecounters.aggregation",NoTrace),("#messagecounters.graylog",NoTrace),("#messagecounters.katip",NoTrace),("#messagecounters.switchboard",NoTrace)]

but it also sets :

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")]))])],

which is maybe as it should be. BUT, it is expected in empty configuration that cgOptions = fromList [] So it is inconsistent in such a sense, That empty is set like : https://github.com/input-output-hk/iohk-monitoring-framework/blob/master/iohk-monitoring/src/Cardano/BM/Configuration/Model.lhs#L543
and then on top of it is https://github.com/input-output-hk/iohk-monitoring-framework/blob/1ebe57df3a76a8ae4e3b5a31a9b85132f71534fc/iohk-monitoring/src/Cardano/BM/Configuration/Static.lhs#L26
So it behaves differently when yaml setting and in the code.

@paweljakubas paweljakubas changed the title Paweljakubas/961/improve logging file handling Improve logging documentation of configs Dec 22, 2019
@paweljakubas paweljakubas force-pushed the paweljakubas/961/improve-logging-file-handling branch from a79f7d2 to 84f0c6f Compare December 22, 2019 19:24
@rvl
Copy link
Contributor

rvl commented Dec 23, 2019

It seems like it will be difficult for us to test and document the entire log config format, and that is really a job for the iohk-monitoring team.

The main use for this --logging-config option would probably be as a way to enable logging to file with rotation by log file size.

@paweljakubas
Copy link
Contributor Author

@rvl @KtorZ exactly, we probably should resign from giving user possibility of setting whole logging config, but expose some features like rotation, etc.

Nevertheless, the above findings may be of interest to iohk-monitoring-framework team

describe "initTracer" $ do
it "no settings" $ do
defaultConfig <- getCG <$> defaultConfigStdout
let fp = "../../specifications/logging/empty.yaml"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[change required]

Use (</>) from System.FilePath instead of hard-coded separators.

Why

Hard-coded path don't play well with cross-compiled code :s, so, always rely on platform-agnostic combinator like (</>) to combine paths.

- - StdoutSK
- text

# this is probably a bug of parsing, cannot enforce cgBindAddrPrometheus = Nothing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to open an issue on the iohk-monitoring-framework. Fixing this is not part of our scope, but reporting it is :)

@KtorZ
Copy link
Member

KtorZ commented Dec 23, 2019

Hmmm. @paweljakubas , the goal for #961 I believe is simply to get some degree of documentation on our side. Pointing to some existing documentation / examples on the iohk-monitoring-framework would probably be sufficient.
For testing, I concur @rvl's remark, it's not our scope to check whether the framework works as intended. We already have a few test cases regarding logging and it's quite okay for the wallet backend already.

@paweljakubas
Copy link
Contributor Author

closing in favor of #1253

@KtorZ KtorZ deleted the paweljakubas/961/improve-logging-file-handling branch January 22, 2020 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants