Skip to content

Change default "extra" contents of activity/workflow logs #490

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

Merged
merged 4 commits into from
Apr 2, 2024

Conversation

cretz
Copy link
Member

@cretz cretz commented Mar 19, 2024

What was changed

  • Changed temporalio.activity.logger to add temporal_activity, which is a dict of info, on the log record by default
  • 💥 Changed temporalio.activity.logger to not add activity_info, which is the full info dataclass, on the log record by default
    • This is an incompatible change, temporalio.activity.logger.full_activity_info_on_extra can be set to True to re-enable
  • Changed temporalio.workflow.logger to add temporal_workflow, which is a dict of info, on the log record by default
  • 💥 Changed temporalio.workflow.logger to not add workflow_info, which is the full info dataclass, on the log record by default
    • This is an incompatible change, temporalio.workflow.logger.full_workflow_info_on_extra can be set to True to re-enable

This was done because log handlers like DataDog work much better with nested dictionaries than they do with nested data classes

Checklist

  1. Closes [Feature Request] Make log "extra" have dict instead of info #489

@cretz cretz requested a review from a team as a code owner March 19, 2024 20:20
Copy link
Member

@bergundy bergundy left a comment

Choose a reason for hiding this comment

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

I think this would be friendlier with the dict flattened but I'll leave it up to you to decide.

Comment on lines +434 to +437
full_activity_info_on_extra: Boolean for whether an ``activity_info``
value will be added to the ``extra`` dictionary with the entire
activity info, making it present on the ``LogRecord.__dict__`` for
use by others. Default is False.
Copy link
Member

Choose a reason for hiding this comment

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

I don't think the term full is really clear. Maybe activity_info_data_class_on_extra and clarify this may not be the best option for indexing? I'd also consider deprecating this eventually, no need to have both versions long term, this is just for a transition period.

Copy link
Member Author

@cretz cretz Apr 2, 2024

Choose a reason for hiding this comment

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

I don't think the term full is really clear. Maybe activity_info_data_class_on_extra and clarify this may not be the best option for indexing

I considered removing "full" but it clashed with the other. "full activity info" literally refers to activity.Info, that it's a dataclass shouldn't matter.

I'd also consider deprecating this eventually, no need to have both versions long term, this is just for a transition period.

Considered this, but it's off by default and harmless for the most part, so no reason not to leave it.

@cretz cretz merged commit b07e75e into temporalio:main Apr 2, 2024
@cretz cretz deleted the logger-extra branch April 2, 2024 17:36
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.

[Feature Request] Make log "extra" have dict instead of info
2 participants