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

Add structured logging (first version) #254

Merged
merged 6 commits into from
Nov 23, 2022
Merged

Add structured logging (first version) #254

merged 6 commits into from
Nov 23, 2022

Conversation

ChrisKujawa
Copy link
Member

@ChrisKujawa ChrisKujawa commented Nov 23, 2022

Future: Worker can add variables to the logger, like experiment name etc.


Example:

With json logging

$ ./zbchaos restart broker -v --jsonLogging
{"level":"debug","cli":"zbchaos","time":"2022-11-23T10:58:07+01:00","message":"Connecting to zell-chaos"}
{"level":"debug","cli":"zbchaos","time":"2022-11-23T10:58:07+01:00","message":"Running experiment in self-managed environment."}
{"level":"debug","cli":"zbchaos","time":"2022-11-23T10:58:07+01:00","message":"Successfully created port forwarding tunnel"}
{"level":"debug","cli":"zbchaos","time":"2022-11-23T10:58:07+01:00","message":"Found Broker zell-chaos-zeebe-1 as LEADER for partition 1."}
{"level":"debug","cli":"zbchaos","time":"2022-11-23T10:58:07+01:00","message":"Restarted zell-chaos-zeebe-1"}

Normal:

$ ./zbchaos restart broker -v
Connecting to zell-chaos
Running experiment in self-managed environment.
Successfully created port forwarding tunnel
Found Broker zell-chaos-zeebe-0 as LEADER for partition 1.
Restarted zell-chaos-zeebe-0

Copy link
Contributor

@lenaschoenburg lenaschoenburg left a comment

Choose a reason for hiding this comment

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

Fantastic! 🤩
Does that mean that logs are automatically parsed in google cloud log explorer or is there additional setup needed?

"fmt"
)

func VerbosityLogging(text string, a ...any) {
Copy link
Contributor

Choose a reason for hiding this comment

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

🙃 names are too long IMO, I'd either move them to a new package called log so calls can look like log.Verbose(...) and log.Info(...), or leave them in the internal package but rename the function to LogInfo(...) and LogVerbose(...) or similar.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah was also not sure about them. I didn't wanted to conflict to much with the normal log package and functions

@ChrisKujawa
Copy link
Member Author

Does that mean that logs are automatically parsed in google cloud log explorer or is there additional setup needed?

If it is deployed in gke it will automatically pushed to stackdriver, which will parse it afaik.

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.

2 participants