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

Addition of a /suspend endpoint to Loki Canary #1891

Merged
merged 7 commits into from
Apr 6, 2020

Conversation

joe-elliott
Copy link
Member

@joe-elliott joe-elliott commented Apr 3, 2020

What this PR does / why we need it:
Adds a suspend endpoint to accomodate a way to permanently stop a canary without killing the process. Canary now honors SIGINT as expected.

Which issue(s) this PR fixes:
Fixes #1700

Special notes for your reviewer:

Checklist

  • Documentation added
  • Tests updated

Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
@joe-elliott joe-elliott changed the title Loki canary pause Addition of a /suspend endpoint to Loki Canary Apr 3, 2020
@slim-bean
Copy link
Collaborator

thoughts on adding /resume too?

k8s folks can kill the pod but more people are using this now standalone and a /resume might be helpful, maybe we just need to expose the Run methods as public?

@joe-elliott
Copy link
Member Author

Good idea. Looking into it!

Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
@joe-elliott
Copy link
Member Author

  • Fixed bug related to SIGINT processing
  • Added /resume endpoint to complement /suspend
  • Documented new endpoints

Signed-off-by: Joe Elliott <number101010@gmail.com>
cmd/loki-canary/main.go Outdated Show resolved Hide resolved
w := writer.NewWriter(os.Stdout, sentChan, *interval, *size)
r := reader.NewReader(os.Stderr, receivedChan, *tls, *addr, *user, *pass, *lName, *lVal)
c := comparator.NewComparator(os.Stderr, *wait, *pruneInterval, *buckets, sentChan, receivedChan, r, true)
c := &canary{}
Copy link
Contributor

Choose a reason for hiding this comment

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

you could make start a function of c too no ? like stop ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was considering it but decided against it b/c it would have to take like 10 parameters. This seemed less gross.

Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

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

LGTM

2 nits nothing major.

Signed-off-by: Joe Elliott <number101010@gmail.com>
@joe-elliott joe-elliott merged commit 383eb6e into grafana:master Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loki Canary should have a better way to be suspended
3 participants