Skip to content

Add more details to logs to improve debugging.#43

Merged
antstorm merged 15 commits intocoinbase:masterfrom
opus-grove:rh-heartbeat-log
May 10, 2021
Merged

Add more details to logs to improve debugging.#43
antstorm merged 15 commits intocoinbase:masterfrom
opus-grove:rh-heartbeat-log

Conversation

@robholland
Copy link
Copy Markdown
Contributor

No description provided.

@robholland
Copy link
Copy Markdown
Contributor Author

If you're happy with the approach I'll extend this to the workflow processor also.

@robholland
Copy link
Copy Markdown
Contributor Author

Sample from the examples:

I, [2021-02-17T11:45:33.322764 #30755] INFO -- temporal_client: Activity task completed (ruby-samples / HelloWorldWorkflow[852345e6-30e9-4860-8ad8-690d7f9f580a:025964be-877a-43a5-9ba2-06e647de9f55] / HelloWorldActivity[5]#1)

Copy link
Copy Markdown

@tomharrisonjr tomharrisonjr left a comment

Choose a reason for hiding this comment

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

Nice additions!

Copy link
Copy Markdown
Contributor

@antstorm antstorm left a comment

Choose a reason for hiding this comment

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

I like the general direction of adding more info, but let's do this slightly differently. Unstructured logging is difficult to parse and work with. Instead let's add an optional hash to the log calls with all the additional information we want to pass.

Many companies are already doing structured logging, so when implementing their own adapter everyone should be able to format the log lines as they prefer

Rob Holland added 5 commits May 4, 2021 12:03
Defaults to 25 seconds to fit inside the default grace period for
kubernetes pod shutdown which is 30 seconds.
@robholland robholland requested a review from antstorm May 5, 2021 12:44
Rob Holland added 2 commits May 6, 2021 14:10
Convert some missed logging calls to metadata versions.
Copy link
Copy Markdown
Contributor

@antstorm antstorm left a comment

Choose a reason for hiding this comment

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

Found a couple of potential issues. Also can you please add a spec for the new logger class?

Rob Holland added 5 commits May 7, 2021 11:25
The user can log from their own code if needed for debugging.
Ensure JSON is in strict mode.
@robholland robholland requested a review from antstorm May 10, 2021 10:35

SEVERITIES.each do |severity|
define_method severity do |message|
define_method severity do |*args|
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we keep this interface same as our main logger? E.g.:

define_method severity do |message, details = {}|
  ...
end

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated.

end

def log(severity, message)
def log(severity, *args)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

And this.

@robholland robholland requested a review from antstorm May 10, 2021 11:43
Copy link
Copy Markdown
Contributor

@antstorm antstorm left a comment

Choose a reason for hiding this comment

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

Brilliant! 👍

@antstorm antstorm merged commit aeb9c16 into coinbase:master May 10, 2021
@tristan-instacart
Copy link
Copy Markdown

This change meant that a standard logger passed into config will no longer function and all loggers in effect must be of type Temporal::Logger because of the signature change on the standard log methods.

This makes things a little awkward if you have standard log practices in your organization. It is probably worth a call out in the README that while logger is exposed in Temporal.configure, you should use caution overriding it.

@antstorm
Copy link
Copy Markdown
Contributor

@tristan-instacart you're right, apologies for this. Hopefully the new interface is very easily adoptable.

@robholland would you mind updating the README with the mention of the new interface?

@antstorm antstorm added the sync pending Needs to be ported to cadence-ruby label Jun 29, 2021
christopherb-stripe pushed a commit to christopherb-stripe/temporal-ruby that referenced this pull request Jan 19, 2022
…ner/workflow-started-metadata

Run start time available to running workflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sync pending Needs to be ported to cadence-ruby

Development

Successfully merging this pull request may close these issues.

4 participants