-
Notifications
You must be signed in to change notification settings - Fork 112
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
Conversation
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. |
@kobergj thanks for the extra pair of eyes! I applied your suggestions, could you have another look? 🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome now 👍
@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:
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 |
There was a problem hiding this 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.
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 👍 |
@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
} |
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 👯 |
update: the exporter fails, and crashes if missconfigured. I will figure a way to preserve the traceid for the logs regardless of enabled tracing |
Superseded by #2515 |
Prevent from logging
traceid=0000000000000000
. Now logs would appear as:when traces are enabled, then the output looks like:
as god intended.