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

Log improvements #24

Merged
merged 10 commits into from
Jan 8, 2018
Merged

Log improvements #24

merged 10 commits into from
Jan 8, 2018

Conversation

Aergonus
Copy link
Collaborator

@Aergonus Aergonus commented Dec 27, 2017

The commits contain detailed info which I'll copy below.

tl;dr

  • Standardized log levels
  • Added descriptive prepend to logs
  • Added ability to fmt.Println(schedule)
  • Added descriptive Logging glog style for schedule

Log status and schedule per line

Converted some logs to their appropriate type (i.e. error to info or vice versa)
Reworked schedule print
Standardized glog levels grep -r V\([0-9]\) *
L0: None
L1: Highest Level current status info and Errors with Terminations
L2: Successful terminations
L3: More detailed schedule status info
L4: Debugging verbose schedule and config info
L5: Auto-resolved inconsequential issues

Schedule String()

Allows for fmt.Println(schedule)

Switch Print() and String()

Since we should glog the single line info
and make the table version isolated and readable

Sample output

I1227 21:05:01.763272       1 schedule.go:54] Status Update: Generating schedule for terminations
E1227 21:05:01.763418       1 config.go:269] Expected to load root CA config from /var/run/secrets/kubernetes.io/serviceaccount/ca.crt, but got err: open /var/run/secrets/kubernetes.io/serviceaccount/ca.crt: no such file or directory
I1227 21:05:01.763447       1 kubernetes.go:20] API server host overriden to: http://<excerpted>
I1227 21:05:01.771145       1 schedule.go:47] Status Update: 3 terminations scheduled today
I1227 21:05:01.771159       1 schedule.go:49] Deployment counter scheduled for termination at 12/12/27127 128:2427:00 -0500 UTC
I1227 21:05:01.771165       1 schedule.go:49] Deployment fail-deploy scheduled for termination at 12/12/27127 128:3327:00 -0500 UTC
I1227 21:05:01.771168       1 schedule.go:49] Deployment secret-pod scheduled for termination at 12/12/27127 128:4627:00 -0500 UTC
I1227 21:05:01.771203       1 kubemonkey.go:67] Status Update: Waiting to run scheduled terminations.
E1227 21:05:01.771266       1 config.go:269] Expected to load root CA config from /var/run/secrets/kubernetes.io/serviceaccount/ca.crt, but got err: open /var/run/secrets/kubernetes.io/serviceaccount/ca.crt: no such file or directory
        ********** Today's schedule **********
        Deployment                      Termination time
        ----------                      ----------------
        counter                 12/12/27127 128:2427:00 -0500 UTC
        fail-deploy                     12/12/27127 128:3327:00 -0500 UTC
        secret-pod                      12/12/27127 128:4627:00 -0500 UTC
        ********** End of schedule **********
E1227 21:05:01.771269       1 config.go:269] Expected to load root CA config from /var/run/secrets/kubernetes.io/serviceaccount/ca.crt, but got err: open /var/run/secrets/kubernetes.io/serviceaccount/ca.crt: no such file or directory
E1227 21:05:01.771300       1 config.go:269] Expected to load root CA config from /var/run/secrets/kubernetes.io/serviceaccount/ca.crt, but got err: open /var/run/secrets/kubernetes.io/serviceaccount/ca.crt: no such file or directory
I1227 21:05:01.771398       1 kubernetes.go:20] API server host overriden to: http://<excerpted>
I1227 21:05:01.771329       1 kubernetes.go:20] API server host overriden to: http://<excerpted>
I1227 21:05:01.771330       1 kubernetes.go:20] API server host overriden to: http://<excerpted>
I1227 21:05:01.776494       1 chaos.go:120] Terminating ALL pods for deployment counter
E1227 21:05:01.779495       1 kubemonkey.go:73] Failed to execute termination for deployment fail-deploy. Error: Deployment fail-deploy has no running pods at the moment
I1227 21:05:01.779518       1 kubemonkey.go:78] Status Update: 2 scheduled terminations left.
E1227 21:05:01.779557       1 kubemonkey.go:73] Failed to execute termination for deployment secret-pod. Error: Deployment secret-pod has no running pods at the moment
I1227 21:05:01.779565       1 kubemonkey.go:78] Status Update: 1 scheduled terminations left.
I1227 21:05:01.783958       1 kubemonkey.go:75] Termination successfully executed for deployment counter
I1227 21:05:01.783968       1 kubemonkey.go:78] Status Update: 0 scheduled terminations left.
I1227 21:05:01.783973       1 kubemonkey.go:81] Status Update: All terminations done.
I1227 21:05:01.784025       1 kubemonkey.go:23] Debug mode detected!
I1227 21:05:01.784040       1 kubemonkey.go:24] Status Update: Generating next schedule in 60 sec

Converted some logs to their appropriate type (i.e. error to info or vice versa)
Reworked schedule print
Standardized glog levels `grep -r V\([0-9]\) *`
L0: None
L1: Highest Level current status info and Errors with Terminations
L2: Successful terminations
L3: More detailed schedule status info
L4: Debugging verbose schedule and config info
L5: Auto-resolved inconsequential issues
Allows for fmt.Println(schedule)
Since we should glog the single line info
and make the table version isolated and readable
@Aergonus Aergonus mentioned this pull request Dec 27, 2017
Aergonus added a commit to Aergonus/kube-monkey that referenced this pull request Dec 27, 2017
@@ -45,6 +47,7 @@ func Run() error {
glog.Fatal(err.Error())
}
schedule.Print()
fmt.Println(schedule)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would omit this in the final version since it's really intended for someone debugging and expects that this should work

@Aergonus Aergonus mentioned this pull request Jan 3, 2018
@asobti asobti merged commit b44d4e1 into asobti:master Jan 8, 2018
@Aergonus Aergonus deleted the log_improvements branch January 8, 2018 22:09
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