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

[KS-368] keystone/workflow engine logging #13563

Merged
merged 12 commits into from
Jun 26, 2024

Conversation

HenryNguyen5
Copy link
Contributor

@HenryNguyen5 HenryNguyen5 commented Jun 15, 2024

  • Remove unused logger arg
  • Make capability id logging consistent
  • Clean up init logs
  • Normalize executionID and capabilityID
  • Adding store level logging
  • Added custom errors to engine
  • Remove wrapped logging variants

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]"}.

@HenryNguyen5 HenryNguyen5 requested a review from a team as a code owner June 15, 2024 00:41
@HenryNguyen5 HenryNguyen5 requested a review from a team June 15, 2024 00:42
@@ -15,13 +15,15 @@ import (
type LocalTargetCapability struct {
lggr logger.Logger
capabilities.TargetCapability
peerID p2ptypes.PeerID
don capabilities.DON
capabilityID string
Copy link
Contributor Author

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())
Copy link
Contributor Author

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

core/services/workflows/engine.go Outdated Show resolved Hide resolved
@@ -78,6 +80,25 @@ type testHooks struct {
executionFinished chan string
}

func newTestDBStore(t *testing.T, clock clockwork.Clock) store.Store {
Copy link
Contributor Author

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

@HenryNguyen5 HenryNguyen5 force-pushed the keystone/workflow_engine_logging branch from 89fe331 to 3e92fc6 Compare June 17, 2024 23:33
@HenryNguyen5 HenryNguyen5 requested review from cedric-cordenier, ettec and a team June 17, 2024 23:34
@HenryNguyen5 HenryNguyen5 enabled auto-merge June 25, 2024 19:53
@HenryNguyen5 HenryNguyen5 added this pull request to the merge queue Jun 26, 2024
Merged via the queue into develop with commit 99fa0e6 Jun 26, 2024
113 checks passed
@HenryNguyen5 HenryNguyen5 deleted the keystone/workflow_engine_logging branch June 26, 2024 13:41
@HenryNguyen5 HenryNguyen5 changed the title keystone/workflow engine logging [KS-368] keystone/workflow engine logging Jul 2, 2024
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.

5 participants