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

Move tracers to .yaml files #447

Closed
wants to merge 7 commits into from
Closed

Conversation

Jimbo4350
Copy link
Contributor

Specifying the tracers on the command line is cumbersome and the consensus is to move to them to the configuration .yaml files.

Relevant: #443

@Jimbo4350 Jimbo4350 added the WIP Work In Progress (cannot be merged yet) label Dec 27, 2019
@Jimbo4350 Jimbo4350 requested a review from CodiePP December 27, 2019 15:29
@@ -324,38 +352,27 @@ instance FromJSON ViewMode where
-- which verbosity to the log output.
data TraceOptions = TraceOptions
{ traceVerbosity :: !TracingVerbosity
, traceBlockFetchClient :: !Bool
Copy link
Contributor Author

@Jimbo4350 Jimbo4350 Dec 27, 2019

Choose a reason for hiding this comment

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

This is fragile. Currently if you add a tracer, you would need to make sure that NodeConfiguration's FromJSON instance "aligns" with TraceOptions.

Potential solution: Create a data type isomorphic to bool for each tracer. I'd prefer a more elegant solution to this.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you split this type, you should be able to use Generic FromJSON, and have a nicer config format. Something like this:

data TraceOptions = TraceOptions
  { traceVerbosity :: !TracingVerbosity
  , traceEnable :: !TraceEnable
  }
data TraceEnable = TraceEnable
  { traceBlockFetchClient :: !Bool
  , traceBlockFetchDecisions :: !Bool
  , traceBlockFetchProtocol :: !Bool
  , ...
  }

Then the YAML file could look like:

tracing:
  verbosity: brief
  enable:
  - BlockFetchClient: false
  - BlockFetchDecisions: false
  - BlockFetchProtocol: false
  - ...

Copy link
Contributor Author

@Jimbo4350 Jimbo4350 Dec 30, 2019

Choose a reason for hiding this comment

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

@rvl the plan so far seems to be having the tracers formatted in the yaml file as follows:
(#443 (comment))

TraceBlockFetchClient:
    Enabled: True
    MinSeverity: Debug
    Verbosity: MaximumVerbosity

Splitting TraceOptions doesn't alleviate the potential to mix up of tracers if the FromJSON instance of NodeConfiguration and TraceOptions records aren't aligned. The only way I can see to secure this is to implement a series of sum types per tracer eg:
data TraceBlockFetchClientStatus = TraceBlockFetchClientEnabled | TraceBlockFetchClientDisabled

@Jimbo4350
Copy link
Contributor Author

Failing with:

machine# [   16.724792] bc50mcgyx2rxcw6a1n4dngsvp8mknp48-unit-script-cardano-node_-start[1183]: Error in $: key "TracingVerbosity" not present

Need to update the generation of the config .yaml files in the nix chairman cluster test.

@jbgi
Copy link
Contributor

jbgi commented Jan 14, 2020

95d9fb2 should probably be reverted as part of this PR.

@Jimbo4350 Jimbo4350 force-pushed the jordan/move-tracers-to-yaml branch 2 times, most recently from 99b0cd0 to 5c58e38 Compare January 14, 2020 16:00
@@ -25,11 +25,6 @@ let
"--signing-key ${cfg.signingKey}"}"
"${lib.optionalString (cfg.delegationCertificate != null)
"--delegation-certificate ${cfg.delegationCertificate}"}"
"--tracing-verbosity-${cfg.tracingVerbosity}"
Copy link
Contributor

Choose a reason for hiding this comment

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

the tracingVerbosity option definition could be removed too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jbgi removed. This should pass ci now. Once it does are we good to merge: input-output-hk/iohk-nix#303

@Jimbo4350 Jimbo4350 force-pushed the jordan/move-tracers-to-yaml branch from 5c58e38 to bad484c Compare January 14, 2020 16:30
@Jimbo4350 Jimbo4350 added priority medium issues/PRs that SHOULD be addressed. This should be done for the release, but acceptable if it doesn and removed WIP Work In Progress (cannot be merged yet) labels Jan 14, 2020
iohk-bors bot added a commit to input-output-hk/iohk-nix that referenced this pull request Jan 14, 2020
303: Add tracers to default log configuration r=disassembler a=Jimbo4350

Tracing options are being moved to the configuration `.yaml` files (IntersectMBO/cardano-node#447).

Co-authored-by: Samuel Leathers <[email protected]>
Copy link
Contributor

@disassembler disassembler left a comment

Choose a reason for hiding this comment

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

bors r+

iohk-bors bot added a commit that referenced this pull request Jan 14, 2020
447: Move tracers to `.yaml` files r=disassembler a=Jimbo4350

Specifying the tracers on the command line is cumbersome and the consensus is to move to them to the configuration `.yaml` files. 

Relevant: #443 

Co-authored-by: Jordan Millar <[email protected]>
@Jimbo4350
Copy link
Contributor Author

bors r-

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jan 14, 2020

Canceled

@Jimbo4350
Copy link
Contributor Author

Don't merge yet. I need to re-point iohk-nix at master.

@Jimbo4350 Jimbo4350 force-pushed the jordan/move-tracers-to-yaml branch from bad484c to 6bbe08c Compare January 14, 2020 19:20
@Jimbo4350 Jimbo4350 force-pushed the jordan/move-tracers-to-yaml branch from 6bbe08c to 6197f90 Compare January 14, 2020 19:23
@Jimbo4350
Copy link
Contributor Author

bors r+

iohk-bors bot added a commit that referenced this pull request Jan 14, 2020
447: Move tracers to `.yaml` files r=Jimbo4350 a=Jimbo4350

Specifying the tracers on the command line is cumbersome and the consensus is to move to them to the configuration `.yaml` files. 

Relevant: #443 

Co-authored-by: Jordan Millar <[email protected]>
@Jimbo4350 Jimbo4350 closed this Jan 14, 2020
iohk-bors bot added a commit that referenced this pull request Jan 14, 2020
474: Move tracers to config `.yaml` files  r=Jimbo4350 a=Jimbo4350

Last PR was accidentally closed (#447)

Co-authored-by: Jordan Millar <[email protected]>
@iohk-bors iohk-bors bot deleted the jordan/move-tracers-to-yaml branch January 14, 2020 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority medium issues/PRs that SHOULD be addressed. This should be done for the release, but acceptable if it doesn
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants