-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[KS-368] keystone/workflow engine logging #13563
Conversation
@@ -15,13 +15,15 @@ import ( | |||
type LocalTargetCapability struct { | |||
lggr logger.Logger | |||
capabilities.TargetCapability | |||
peerID p2ptypes.PeerID | |||
don capabilities.DON | |||
capabilityID string |
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.
Added this so we can log the capability ID that is being wrapped. I didn't want to waste a grpc call on Info
when we already have this information
@@ -350,7 +350,7 @@ func NewApplication(opts ApplicationOpts) (Application, error) { | |||
jobORM = job.NewORM(opts.DS, pipelineORM, bridgeORM, keyStore, globalLogger) | |||
txmORM = txmgr.NewTxStore(opts.DS, globalLogger) | |||
streamRegistry = streams.NewRegistry(globalLogger, pipelineRunner) | |||
workflowORM = workflowstore.NewDBStore(opts.DS, clockwork.NewRealClock()) | |||
workflowORM = workflowstore.NewDBStore(opts.DS, globalLogger, clockwork.NewRealClock()) |
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.
This adds a logger to our ORM, i found it pretty useful when debugging failing tests
@@ -78,6 +80,25 @@ type testHooks struct { | |||
executionFinished chan string | |||
} | |||
|
|||
func newTestDBStore(t *testing.T, clock clockwork.Clock) store.Store { |
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.
I added this so we can see a workflow id field in test logs, it was just empty before which made it awkward to read test logs. When the wfid was empty, it would pass the fk constraint, so i had to add this function to make sure that the constraint stays valid with a non empty workflow id
89fe331
to
3e92fc6
Compare
360fa4b
to
cef3bb2
Compare
Quality Gate passedIssues Measures |
I ended up creating custom error structs at the workflow engine level, so that we're able to resurface lower level errors as wrapped ones which have fields such as execution id, workflow id, and capability id.
If i didnt do this, there's a mismatch in how we log errors. There are functions that we have which return errors rather than log them. This results in errors which store the context as plaintext inside the error message itself, rather than having them as separate fields.
Ex
Without custom errors you'd get a log message like:
capability id: [email protected] could not find capability in registry.
.With custom errors, we can log them as:
could not find capability in registry {"capabilityID": "[email protected]"}
.