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

Reduce logs #2695

Merged
merged 4 commits into from
Jul 7, 2022
Merged

Reduce logs #2695

merged 4 commits into from
Jul 7, 2022

Conversation

giggsoff
Copy link
Contributor

@giggsoff giggsoff commented Jun 30, 2022

Changes aimed to reduce odd logs:

  1. Ensure that local profile checkpoint exists (touchSavedConfig failed: chtimes /persist/checkpoint/lastlocalprofile: no such file or directory)
  2. Do not show blob content with info verbosity
  3. Do not show cancelled by user if no real cancel
  4. Send uuidRequest to uuid endpoint according to API doc (Unmarshalling failed: proto: cannot parse invalid wire-format data)

return fmt.Sprintf("%s:%p", key, object)
return fmt.Sprintf("%s:%p", key, object.logger)
Copy link
Contributor

Choose a reason for hiding this comment

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

The key question here is whether we always create unique loggers for each microservice running in the same process.
@gkodali-zededa do we also need to keep them apart when we have a microservice subscribe to something it publishes? In that case using the logger wouldn't be sufficient.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As I can see we create separate logger for each service

srvLogger, srvLog := agentlog.Init(serviceName)

Copy link
Contributor

Choose a reason for hiding this comment

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

In the case we have a publisher and subscriber in the same service (which we have at least in nim and probably elsewhere) they will not be treated as separate in this log map.

Also, you don't even consider the type of the object. We have the same UUID (or UUID+version, or sha) as key for objects of completely different types.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oops this is using the LogKey and not the Key and the LogKey() functions all use obe of the define LogKey strings which capture the type of the device.

But we still need to distinguish between a publish and subscribe of the identical thing. One way to do that would be to pass another arg from pubsub to LogCreate(), LogModify() and LogDelete() to indicate "publish" vs, "subscribe" and include that in they key used for this map.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean that we have publisher and subscriber of the same type in the same agent? Let me check.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we have that in a few places.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think care is required because in the LogModify we typically fatal if the map entry is not found. So we can't accidentally delete from the map.

Maybe it makes sense to split out that commit so we can merge the other commits?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, sounds reasonable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems I found root cause: #2714

giggsoff added 4 commits July 4, 2022 12:09
I can see lots of "touchSavedConfig failed: chtimes
/persist/checkpoint/lastlocalprofile: no such file or directory" in log.
 Seems we should ensure that we have checkpoint file to decide should we
  touch or create it.

Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
I can see that we show array of bytes in logs which looks suboptimal

Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
I can see a lot of "readConfigResponseProtoMessage\",
\"level\":\"error\",\"msg\":\"Unmarshalling failed: proto: cannot parse
invalid wire-format data". Seems, we should send uuidRequest and expect
uuidResponse according to API docs.

Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
@giggsoff giggsoff force-pushed the reduce-logs branch 2 times, most recently from c38eed3 to ce9feb9 Compare July 6, 2022 13:57
Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

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

LGTM

@eriknordmark eriknordmark merged commit 3b62104 into lf-edge:master Jul 7, 2022
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