-
Notifications
You must be signed in to change notification settings - Fork 351
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
feature: flightrecorder to enable Go trace #2985
base: master
Are you sure you want to change the base?
Conversation
proxy/proxy.go
Outdated
return | ||
} | ||
// Write it to a file. | ||
if err := os.WriteFile("trace.out", b.Bytes(), 0o755); err != nil { |
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.
How are we going to fetch this file if needed? Manually copying it from the pod? Or is there some automation?
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.
I cite "Ideas from discussion":
write to http endpoint PUT (think of cluster local service that collects the trace and make it available or S3)
74b6d67
to
e9d5125
Compare
config/config.go
Outdated
flag.IntVar(&cfg.FlightRecorderSize, "flight-recorder-size", 0, "max flight-recorder trace data size") | ||
flag.DurationVar(&cfg.FlightRecorderPeriod, "flight-recorder-period", 0, "sets the approximate time duration that the flight recorder's circular buffer represents.") | ||
flag.DurationVar(&cfg.FlightRecorderProxyTookTooLong, "flight-recorder-proxy-took-too-long", 0, "sets the threshold, if proxy took longer than that the flight recorder will write out a trace.") | ||
flag.StringVar(&cfg.FlightRecorderTargetURL, "flight-recorder-target-url", "", "sets the flight recorder target URL that is used to write out the trace to.") |
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.
Maybe it would be better as a filter?
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.
Why do you think it's better that people have to pass their own URL into the filter?
b23465b
to
c42035a
Compare
I get only errors for Go 1.22 support:
Without forcing Go1.22 I get:
I don't really know why: https://pkg.go.dev/golang.org/x/exp/trace#FlightRecorder should not depend on Go version, because x/ is a separate package. Maybe it's really an issue created by go-fuzz. Maybe fixed by google/oss-fuzz#11677 |
f7e2831
to
b9d62b2
Compare
0498acc
to
baa60cf
Compare
b073f6c
to
fadd0fe
Compare
proxy/proxy.go
Outdated
|
||
switch p.flightRecorderURL.Scheme { | ||
case "file": | ||
if err := os.WriteFile(p.flightRecorderURL.Path, b.Bytes(), 0o644); err != nil { |
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.
- this overrides the file if we have more than one happening
- file rotation
proxy/proxy.go
Outdated
} else { | ||
p.log.Infof("FlightRecorder wrote %d bytes to trace file %q", b.Len(), p.flightRecorderURL.Path) | ||
} | ||
case "http", "https": |
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.
maybe SupportListener expose /trace/dump
98f84bc
to
904c64c
Compare
p.FlightRecorder.Stop() | ||
p.FlightRecorder = nil | ||
} else { | ||
go func() { |
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.
forever runs and tries to be an efficient way of handling multiple goroutines fire "we are slow" and write only once in an hour trace data to check.
1585974
to
22c3e06
Compare
feature: allow configuration for Go x/trace.FlightRecorder pass default period to define what means skipper to be slow Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
22c3e06
to
40a3067
Compare
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
feature: flightrecorder to enable Go trace
https://go.dev/blog/execution-traces-2024
https://pkg.go.dev/golang.org/x/exp/trace#FlightRecorder
wdyt?
Ideas from discussion