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

Avoid log flooding with messages about missing missing registry/services #732

Merged
merged 1 commit into from Aug 13, 2014

Conversation

mfojtik
Copy link
Contributor

@mfojtik mfojtik commented Aug 1, 2014

Prevents this to appear in log every 2s:

26.314664 13972 etcd.go:118] Failed to get the key registry/services: 100: Key not found (/registry/services) [23]
26.314689 13972 etcd.go:78] Failed to get any services: 100: Key not found (/registry/services) [23]

@@ -115,7 +120,7 @@ func (s ConfigSourceEtcd) Run() {
func (s ConfigSourceEtcd) GetServices() ([]api.Service, []api.Endpoints, error) {
response, err := s.client.Get(registryRoot+"/specs", true, false)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Check for tools.IsEtcdNotFound(err) and return empty arrays (which should be []api.Service{}, not make(...)) without an error.

@mfojtik
Copy link
Contributor Author

mfojtik commented Aug 4, 2014

@brendandburns thanks for suggestion. I think decreasing verbosity of the log is the right thing to do here. I updated the PR.

@@ -134,6 +137,9 @@ func (s ConfigSourceEtcd) GetServices() ([]api.Service, []api.Endpoints, error)
retServices[i] = svc
endpoints, err := s.GetEndpoints(svc.ID)
if err != nil {
if tools.IsEtcdNotFound(err) {
return []api.Service{}, []api.Endpoints{}, err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You need the log message to be in the if block, and the return to be outside the if block.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you sure? I thought we want to return when the err == IsEtcdNotFound, but in other cases just log the error and continue.

@brendandburns
Copy link
Contributor

Friendly ping on this PR. Address comments and rebase, and we'll get it merged.

Thanks!
--brendan

@@ -137,6 +140,9 @@ func (s ConfigSourceEtcd) GetServices() ([]api.Service, []api.Endpoints, error)
endpoints, err := s.GetEndpoints(svc.ID)
if err != nil {
glog.Errorf("Couldn't get endpoints for %s : %v skipping", svc.ID, err)
if tools.IsEtcdNotFound(err) {
return []api.Service{}, []api.Endpoints{}, err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

So if the endpoints were deleted from etcd, then there are truly no endpoints. You don't need to log in that case. If any other error occurs, we need to go to the next service (continue). So seems like it should be:

if err != nil  {
  if !isEtcdNotFound(err) {
    log
    continue
  }
  endpoints = []api.Endpoints{}
}

@mfojtik
Copy link
Contributor Author

mfojtik commented Aug 6, 2014

@smarterclayton @brendanburns fixed all comments and rebased, should be OK to merge now.

@@ -136,7 +139,11 @@ func (s ConfigSourceEtcd) GetServices() ([]api.Service, []api.Endpoints, error)
retServices[i] = svc
endpoints, err := s.GetEndpoints(svc.ID)
if err != nil {
glog.Errorf("Couldn't get endpoints for %s : %v skipping", svc.ID, err)
if tools.IsEtcdNotFound(err) {
glog.Errorf("Couldn't get endpoints for %s : %v skipping", svc.ID, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to be logging if there's an error that isn't IsEtcdNotFound

@brendandburns
Copy link
Contributor

small nits, basically LGTM.

@smarterclayton
Copy link
Contributor

@mfojtik can you correct this last condition?

@mfojtik
Copy link
Contributor Author

mfojtik commented Aug 12, 2014

@smarterclayton @brendandburns done, sorry for this to take so long.

@brendandburns
Copy link
Contributor

LGTM, @smarterclayton are you good? If so, I'll merge.

@smarterclayton
Copy link
Contributor

Yeah LGTM

lavalamp added a commit that referenced this pull request Aug 13, 2014
Avoid log flooding with messages about missing missing registry/services
@lavalamp lavalamp merged commit aeea1b1 into kubernetes:master Aug 13, 2014
@mfojtik mfojtik deleted the etcd_log branch October 22, 2014 09:48
vishh pushed a commit to vishh/kubernetes that referenced this pull request Apr 6, 2016
Add backup text to process table if no processes detected.
seans3 pushed a commit to seans3/kubernetes that referenced this pull request Apr 10, 2019
b3atlesfan pushed a commit to b3atlesfan/kubernetes that referenced this pull request Feb 5, 2021
backend/extension: Allow the backend data to be empty
deads2k pushed a commit to deads2k/kubernetes that referenced this pull request May 6, 2021
Bug 1956895: UPSTREAM: 101593: kubelet: change cgroup move message to log level 3
linxiulei pushed a commit to linxiulei/kubernetes that referenced this pull request Jan 18, 2024
Enforce that `github.com/onsi/ginkgo/ginkgo` is considered dependency
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.

None yet

4 participants