-
Notifications
You must be signed in to change notification settings - Fork 721
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
Trace Configuration Trace Message Enhancement #5480
Conversation
667130c
to
0169fe2
Compare
} | ||
deriving (Eq, Ord, Show, Generic) | ||
|
||
instance AE.FromJSON ConfigOptionRep where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason why deriving (FromJSON, ToJSON)
isn't used? I can't really spot a difference in the handcrafted instances.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The maybe fields are only printed, when the value is not Nothing. This is hand coded, so that I used handcrafted instances here. I think this is only possible with Template Haskell automatically, but in my opinion the handwritten stuff is preferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, don't use TH for that; Generics is preferrable. With the latter, you can use:
instance ToJSON ConfigRepresentation where
toJSON = genericToJSON defaultOptions {omitNothingFields = True}
, "traceOptionNodeName" .= traceOptionNodeName | ||
, "TraceOptionPeerFrequency" .= traceOptionPeerFrequency | ||
, "traceOptionResourceFrequency" .= traceOptionResourceFrequency | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The capitalization of object keys doesn't align between FromJSON
and ToJSON
, is that intentional?
If there's a Generic
instance for everything (not sure), one could use derived instances, or for capital initials something like:
instance FromJSON ConfigRepresentation where
parseJSON = genericParseJSON defaultOptions {fieldLabelModifier = <capitalize first letter>}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected the capitalisation. Thanks for pointing this out. It is only one unused Generic instance here, which I remove.
287d2bd
to
71200e5
Compare
71200e5
to
4b373fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jutaro LGTM!
This pull request aims to enhance our codebase by adding trace messages that provide valuable insights into the effective trace configuration used during program execution. Trace messages are essential for debugging and monitoring our application, and this enhancement will make it easier for developers and operators to understand and troubleshoot any issues related to tracing.