-
Notifications
You must be signed in to change notification settings - Fork 10
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
High CPU consumption using Coralogx hook with Logrus #6
Comments
Thanks for the report! |
Thanks for the quick response. We're using Go 1.15.8 (latest) Reproducing:We write a debug log every 5 seconds using logrus. We do use fields, and sometimes not just strings var log = logrus.New()
log.SetFormatter(&logrus.JSONFormatter{})
log.SetOutput(os.Stdout)
log.SetLevel(logrus.DebugLevel)
log.WithFields(logrus.Fields{
"hello": "world",
"verisonDate": time.Now(),
}).Info("Hello World Message") All we did was attach the hook: CoralogixHook := coralogix.NewCoralogixHook(
CORALOGIX_PRIVATE_KEY,
CORALOGIX_APPLICATION_NAME,
CORALOGIX_SUBSYSTEM_NAME,
)
// defer CoralogixHook.Close() // No need to close in our case
log.AddHook(CoralogixHook) Profiling:
import (
_ "net/http/pprof"
)
func RunProfiler() {
go func() {
log.Println(http.ListenAndServe("localhost:6060", nil))
}()
} and make sure to run RunProfiler() somewhere in your code, while keeping the process up.
go tool pprof -http ":9000" -seconds 60 <SOME_RANDOM_NAME> http://localhost:6060/debug/pprof/profile OR use the console (without the -http ":9000" part) go tool pprof -seconds 60 <SOME_RANDOM_NAME> http://localhost:6060/debug/pprof/profile Then use commands such as: |
We will check and get back to you ASAP. |
We did profiling and benchmarking and cannot reproduce this behavior. |
@EldarAliiev I've create a simple repo that reproduces this: |
@elig-salt I checked everything with profiler and even without any actions |
@elig-salt we added some fix. |
Thanks for the effort. |
Hi,
We've connected a hook to a logrus logger, and cpu spiked.
We've profiled and looks like Coralogix Go SDK is responsible for 95% of the CPU time.
Sending the bulk (23%) is understandable - but some 45% goes on formatting.
Can anyone on the Coralogix team advise?
This kind of spike is unacceptable on a client-side running app we're deploying.
Thanks.
The text was updated successfully, but these errors were encountered: