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 traces only when these are available #2352

Closed
wants to merge 5 commits into from
Closed

Log traces only when these are available #2352

wants to merge 5 commits into from

Conversation

refs
Copy link
Member

@refs refs commented Dec 10, 2021

Prevent from logging traceid=0000000000000000. Now logs would appear as:

image

when traces are enabled, then the output looks like:

image

as god intended.

@update-docs
Copy link

update-docs bot commented Dec 10, 2021

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@refs refs requested a review from C0rby December 10, 2021 14:55
@refs refs requested review from glpatcern and a team as code owners December 10, 2021 14:56
pkg/rgrpc/status/status.go Outdated Show resolved Hide resolved
@refs refs requested a review from kobergj December 13, 2021 14:30
@refs
Copy link
Member Author

refs commented Dec 13, 2021

@kobergj thanks for the extra pair of eyes! I applied your suggestions, could you have another look? 🚀

Copy link
Contributor

@kobergj kobergj left a comment

Choose a reason for hiding this comment

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

Looks awesome now 👍

@labkode
Copy link
Member

labkode commented Dec 13, 2021

@refs originally the traceid was not taken from the tracing framework, it was always visible as it was generated from a Reva middleware crafting a random UUID. With the change to the tracing framework we have now the possibility to configure a tracing target to send the traces remotely.

However we should split two functionalities:

  1. trace id in the log is always useful and should be available independently if the remote tracing collection is enabled or not.
  2. send traces to remote collector for trace analysis.

With this in mind I'm not in favour of dropping the traceid but rather to fix the code to make sure it is always there

Copy link
Member

@labkode labkode left a comment

Choose a reason for hiding this comment

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

Traceid should always be present in the logs independently if trace collector is enabled or not.

@refs
Copy link
Member Author

refs commented Dec 13, 2021

Traceid should always be present in the logs independently if trace collector is enabled or not.

Hm, I see your argument of always having traces regardless of these are reported or not. I will update the code to reflect that. I completely misjudged the benefits of having the traces always available 👍

@ishank011
Copy link
Contributor

@refs I'd propose enabling tracing by default if it has not been explicitly disabled

diff --git a/cmd/revad/runtime/runtime.go b/cmd/revad/runtime/runtime.go
index 22d55eb3..9783092c 100644
--- a/cmd/revad/runtime/runtime.go
+++ b/cmd/revad/runtime/runtime.go
@@ -311,6 +311,15 @@ func parseCoreConfOrDie(v interface{}) *coreConf {
                os.Exit(1)
        }

+       // tracing defaults to enabled if not explicitly configured
+       if v == nil {
+               c.TracingEnabled = true
+               c.TracingEndpoint = "localhost:6831"
+       } else if _, ok := v.(map[string]interface{})["tracing_enabled"]; !ok {
+               c.TracingEnabled = true
+               c.TracingEndpoint = "localhost:6831"
+       }
+
        return c
 }

@refs
Copy link
Member Author

refs commented Dec 14, 2021

That's a way to do it. I'm currently testing what would happen if there is no sidecar agent and we have traces. I have seen it fail trying to connect to the agent's address. Once I got it working I'll update here. But out of the box seems like a good compromise, if it works 👯

@refs
Copy link
Member Author

refs commented Dec 14, 2021

update: the exporter fails, and crashes if missconfigured. I will figure a way to preserve the traceid for the logs regardless of enabled tracing

@ishank011
Copy link
Contributor

Superseded by #2515

@ishank011 ishank011 closed this Feb 7, 2022
@ishank011 ishank011 deleted the trace-logging branch February 7, 2022 13:16
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.

5 participants