-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add profiling endpoint #1692
Comments
Hi @dgzlopes , I generally do that by just adding profile.go file along with the main one package main
import (
"log"
"net/http"
_ "net/http/pprof"
)
func init() {
go func() {
log.Println(http.ListenAndServe("localhost:6060", nil))
}()
} I think I discussed this with @na-- a while ago, but we agreed there aren't many people who aren't in all of the below categories at the same time:
Can you expand on what you intend on doing with that ? |
Thanks for the code snippet @mstoykov! Personally, I'm testing the k6 Kubernetes Operator and well, I'm running a lot of k6 instances in parallel. Also, I run some other services like TimescaleDB, Grafana, Prometheus, Loki, Tempo, etcd, and some other personal services. Right now, I collect logs and metrics from all of them (and hopefully about k6 soon 😛). I run Conprof too, and collect profiling information from Prometheus and ectd. I think continuous profiling is useful, and not only for internal services! For example, if some k6 pod dies (OOM), I would like to read/report the pprof data (the same way I do with Prometheus and etcd) and maybe stop doing something stupid on my k6 script. Having it as an option would be great from a: On the other hand, from a more practical standpoint, I agree that this is easy to add if someone wants to add it. The problem is, that on K8s I'm using the containers from Docker hub. If I want to add profiling, I would have to:
And... I would have to maintain an updated container just for profiling. So well, for this exact use-case, the flag comes in handy. |
I would suggest adding an environment variable.
If set, k6 would export debugging information under the
/debug
path. In this case, the pprof information (/debug/pprof
).This is interesting in case someone wants to continuously profile k6 (with something like Conprof [1]) or manually use the pprof visualization tool [2].
[0] https://golang.org/pkg/net/http/pprof/
[1] https://github.com/conprof/conprof
[2] https://github.com/google/pprof
The text was updated successfully, but these errors were encountered: