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

Move debug log to trace #355

Merged
merged 1 commit into from
Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions controller/generic_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,14 @@ func (g *genericController) sync(ctx context.Context) (retErr error) {
DeleteFunc: g.queueObject,
})

logrus.Debugf("Syncing %s Controller", g.name)
logrus.Tracef("Syncing %s Controller", g.name)

go g.informer.Run(ctx.Done())

if !cache.WaitForCacheSync(ctx.Done(), g.informer.HasSynced) {
return fmt.Errorf("failed to sync controller %s", g.name)
}
logrus.Debugf("Syncing %s Controller Done", g.name)
logrus.Tracef("Syncing %s Controller Done", g.name)

g.synced = true
return nil
Expand Down Expand Up @@ -300,7 +300,7 @@ func (g *genericController) processNextWorkItem() bool {
}
if _, ok := checkErr.(*ForgetError); err == nil || ok {
if ok {
logrus.Debugf("%v %v completed with dropped err: %v", g.name, key, err)
logrus.Tracef("%v %v completed with dropped err: %v", g.name, key, err)
}
g.queue.Forget(key)
return true
Expand Down Expand Up @@ -381,7 +381,7 @@ func (g *genericController) syncHandler(key interface{}) (err error) {
continue
}

logrus.Debugf("%s calling handler %s %s", g.name, handler.name, s)
logrus.Tracef("%s calling handler %s %s", g.name, handler.name, s)
metrics.IncTotalHandlerExecution(g.name, handler.name)
var newObj interface{}
if newObj, err = handler.handler(s, obj); err != nil {
Expand Down
16 changes: 8 additions & 8 deletions objectclient/object_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (p *ObjectClient) Create(o runtime.Object) (runtime.Object, error) {
}
}
result := p.Factory.Object()
logrus.Debugf("REST CREATE %s/%s/%s/%s/%s", p.getAPIPrefix(), p.gvk.Group, p.gvk.Version, ns, p.resource.Name)
logrus.Tracef("REST CREATE %s/%s/%s/%s/%s", p.getAPIPrefix(), p.gvk.Group, p.gvk.Version, ns, p.resource.Name)
err := p.restClient.Post().
Prefix(p.getAPIPrefix(), p.gvk.Group, p.gvk.Version).
NamespaceIfScoped(ns, p.resource.Namespaced).
Expand All @@ -151,7 +151,7 @@ func (p *ObjectClient) GetNamespaced(namespace, name string, opts metav1.GetOpti
Name(name).
Do().
Into(result)
logrus.Debugf("REST GET %s/%s/%s/%s/%s/%s", p.getAPIPrefix(), p.gvk.Group, p.gvk.Version, namespace, p.resource.Name, name)
logrus.Tracef("REST GET %s/%s/%s/%s/%s/%s", p.getAPIPrefix(), p.gvk.Group, p.gvk.Version, namespace, p.resource.Name, name)
return result, err

}
Expand All @@ -166,7 +166,7 @@ func (p *ObjectClient) Get(name string, opts metav1.GetOptions) (runtime.Object,
Name(name).
Do().
Into(result)
logrus.Debugf("REST GET %s/%s/%s/%s/%s/%s", p.getAPIPrefix(), p.gvk.Group, p.gvk.Version, p.ns, p.resource.Name, name)
logrus.Tracef("REST GET %s/%s/%s/%s/%s/%s", p.getAPIPrefix(), p.gvk.Group, p.gvk.Version, p.ns, p.resource.Name, name)
return result, err
}

Expand All @@ -179,7 +179,7 @@ func (p *ObjectClient) Update(name string, o runtime.Object) (runtime.Object, er
if len(name) == 0 {
return result, errors.New("object missing name")
}
logrus.Debugf("REST UPDATE %s/%s/%s/%s/%s/%s", p.getAPIPrefix(), p.gvk.Group, p.gvk.Version, ns, p.resource.Name, name)
logrus.Tracef("REST UPDATE %s/%s/%s/%s/%s/%s", p.getAPIPrefix(), p.gvk.Group, p.gvk.Version, ns, p.resource.Name, name)
err := p.restClient.Put().
Prefix(p.getAPIPrefix(), p.gvk.Group, p.gvk.Version).
NamespaceIfScoped(ns, p.resource.Namespaced).
Expand All @@ -197,7 +197,7 @@ func (p *ObjectClient) DeleteNamespaced(namespace, name string, opts *metav1.Del
if namespace != "" {
req = req.Namespace(namespace)
}
logrus.Debugf("REST DELETE %s/%s/%s/%s/%s/%s", p.getAPIPrefix(), p.gvk.Group, p.gvk.Version, namespace, p.resource.Name, name)
logrus.Tracef("REST DELETE %s/%s/%s/%s/%s/%s", p.getAPIPrefix(), p.gvk.Group, p.gvk.Version, namespace, p.resource.Name, name)
return req.Resource(p.resource.Name).
Name(name).
Body(opts).
Expand All @@ -206,7 +206,7 @@ func (p *ObjectClient) DeleteNamespaced(namespace, name string, opts *metav1.Del
}

func (p *ObjectClient) Delete(name string, opts *metav1.DeleteOptions) error {
logrus.Debugf("REST DELETE %s/%s/%s/%s/%s/%s", p.getAPIPrefix(), p.gvk.Group, p.gvk.Version, p.ns, p.resource.Name, name)
logrus.Tracef("REST DELETE %s/%s/%s/%s/%s/%s", p.getAPIPrefix(), p.gvk.Group, p.gvk.Version, p.ns, p.resource.Name, name)
return p.restClient.Delete().
Prefix(p.getAPIPrefix(), p.gvk.Group, p.gvk.Version).
NamespaceIfScoped(p.ns, p.resource.Namespaced).
Expand All @@ -219,7 +219,7 @@ func (p *ObjectClient) Delete(name string, opts *metav1.DeleteOptions) error {

func (p *ObjectClient) List(opts metav1.ListOptions) (runtime.Object, error) {
result := p.Factory.List()
logrus.Debugf("REST LIST %s/%s/%s/%s/%s", p.getAPIPrefix(), p.gvk.Group, p.gvk.Version, p.ns, p.resource.Name)
logrus.Tracef("REST LIST %s/%s/%s/%s/%s", p.getAPIPrefix(), p.gvk.Group, p.gvk.Version, p.ns, p.resource.Name)
return result, p.restClient.Get().
Prefix(p.getAPIPrefix(), p.gvk.Group, p.gvk.Version).
NamespaceIfScoped(p.ns, p.resource.Namespaced).
Expand All @@ -231,7 +231,7 @@ func (p *ObjectClient) List(opts metav1.ListOptions) (runtime.Object, error) {

func (p *ObjectClient) ListNamespaced(namespace string, opts metav1.ListOptions) (runtime.Object, error) {
result := p.Factory.List()
logrus.Debugf("REST LIST %s/%s/%s/%s/%s", p.getAPIPrefix(), p.gvk.Group, p.gvk.Version, namespace, p.resource.Name)
logrus.Tracef("REST LIST %s/%s/%s/%s/%s", p.getAPIPrefix(), p.gvk.Group, p.gvk.Version, namespace, p.resource.Name)
return result, p.restClient.Get().
Prefix(p.getAPIPrefix(), p.gvk.Group, p.gvk.Version).
NamespaceIfScoped(namespace, p.resource.Namespaced).
Expand Down
2 changes: 1 addition & 1 deletion pkg/subscribe/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func streamStore(ctx context.Context, eg *errgroup.Group, apiContext *types.APIC
return err
}

logrus.Debugf("watching %s", schema.ID)
logrus.Tracef("watching %s", schema.ID)

for e := range events {
result <- e
Expand Down
10 changes: 5 additions & 5 deletions store/proxy/proxy_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (s *Store) getUser(apiContext *types.APIContext) string {
func (s *Store) doAuthed(apiContext *types.APIContext, request *rest.Request) rest.Result {
start := time.Now()
defer func() {
logrus.Debug("GET: ", time.Now().Sub(start), s.resourcePlural)
logrus.Tracef("GET: %v, %v", time.Now().Sub(start), s.resourcePlural)
}()

for _, header := range authHeaders {
Expand Down Expand Up @@ -251,7 +251,7 @@ func (s *Store) retryList(namespace string, apiContext *types.APIContext) (*unst
start := time.Now()
resultList = &unstructured.UnstructuredList{}
err = req.Do().Into(resultList)
logrus.Debugf("LIST: %v, %v", time.Now().Sub(start), s.resourcePlural)
logrus.Tracef("LIST: %v, %v", time.Now().Sub(start), s.resourcePlural)
if err != nil {
if i < 2 && strings.Contains(err.Error(), "Client.Timeout exceeded") {
logrus.Infof("Error on LIST %v: %v. Attempt: %v. Retrying", s.resourcePlural, err, i+1)
Expand Down Expand Up @@ -307,7 +307,7 @@ func (s *Store) realWatch(apiContext *types.APIContext, schema *types.Schema, op
watchingContext, cancelWatchingContext := context.WithCancel(apiContext.Request.Context())
go func() {
<-watchingContext.Done()
logrus.Debugf("stopping watcher for %s", schema.ID)
logrus.Tracef("stopping watcher for %s", schema.ID)
watcher.Stop()
}()

Expand All @@ -316,7 +316,7 @@ func (s *Store) realWatch(apiContext *types.APIContext, schema *types.Schema, op
for event := range watcher.ResultChan() {
if data, ok := event.Object.(*metav1.Status); ok {
// just logging it, keeping the same behavior as before
logrus.Debugf("watcher status for %s: %s", schema.ID, data.Message)
logrus.Tracef("watcher status for %s: %s", schema.ID, data.Message)
} else {
data := event.Object.(*unstructured.Unstructured)
s.fromInternal(apiContext, schema, data.Object)
Expand All @@ -326,7 +326,7 @@ func (s *Store) realWatch(apiContext *types.APIContext, schema *types.Schema, op
result <- data.Object
}
}
logrus.Debugf("closing watcher for %s", schema.ID)
logrus.Tracef("closing watcher for %s", schema.ID)
close(result)
cancelWatchingContext()
}()
Expand Down
10 changes: 5 additions & 5 deletions types/reflection.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ func (s *Schemas) importType(version *APIVersion, t reflect.Type, overrides ...r
}

if s, ok := s.processingTypes[t]; ok {
logrus.Debugf("Returning half built schema %s for %v", typeName, t)
logrus.Tracef("Returning half built schema %s for %v", typeName, t)
return s, nil
}

logrus.Debugf("Inspecting schema %s for %v", typeName, t)
logrus.Tracef("Inspecting schema %s for %v", typeName, t)

schema, err := s.newSchemaFromType(version, t, typeName)
if err != nil {
Expand Down Expand Up @@ -274,11 +274,11 @@ func (s *Schemas) readFields(schema *Schema, t reflect.Type) error {
}

if blacklistNames[fieldName] {
logrus.Debugf("Ignoring blacklisted field %s.%s for %v", schema.ID, fieldName, field)
logrus.Tracef("Ignoring blacklisted field %s.%s for %v", schema.ID, fieldName, field)
continue
}

logrus.Debugf("Inspecting field %s.%s for %v", schema.ID, fieldName, field)
logrus.Tracef("Inspecting field %s.%s for %v", schema.ID, fieldName, field)

schemaField := Field{
Create: true,
Expand Down Expand Up @@ -336,7 +336,7 @@ func (s *Schemas) readFields(schema *Schema, t reflect.Type) error {
}
}

logrus.Debugf("Setting field %s.%s: %#v", schema.ID, fieldName, schemaField)
logrus.Tracef("Setting field %s.%s: %#v", schema.ID, fieldName, schemaField)
schema.ResourceFields[fieldName] = schemaField
}

Expand Down