-
Notifications
You must be signed in to change notification settings - Fork 110
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
RSDK-8819: Finish FTDC #4579
base: main
Are you sure you want to change the base?
RSDK-8819: Finish FTDC #4579
Conversation
// `ftdcDirectory`. | ||
func New(ftdcDirectory string, logger logging.Logger) *FTDC { | ||
ret := newFTDC(logger) | ||
ret.maxFileSizeBytes = 1_000_000 |
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.
Made the settings a more formal division. One either passes in a directory and all these variables about managing files are initialized. Or one passes in a writer and none of those variables matter.
@@ -536,7 +553,7 @@ func (ftdc *FTDC) checkAndDeleteOldFiles() error { | |||
// deletion testing. Filename generation uses padding such that we can rely on there before 2/4 | |||
// digits for every numeric value. | |||
// | |||
//nolint | |||
// nolint |
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.
It joys me that our linter lints our linter
ftdc.ftdcDir = ftdcFileDir | ||
// We must not use `NewWithWriter`. Forcing a writer for FTDC data is not compatible with FTDC | ||
// file rotation. | ||
ftdc := New(ftdcFileDir, logger.Sublogger("ftdc")) |
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.
The "refactor" of New
vs NewWithWriter
resulted in changing the order here. First create the directory, then pass it to the constructor.
robot/impl/local_robot.go
Outdated
@@ -416,7 +416,8 @@ func newWithResources( | |||
|
|||
var ftdcWorker *ftdc.FTDC | |||
if rOpts.enableFTDC { | |||
ftdcWorker = ftdc.New(logger.Sublogger("ftdc")) | |||
// CloudID is also known as the robot part id. | |||
ftdcWorker = ftdc.New(ftdc.DefaultDirectory(config.ViamDotDir, cfg.Cloud.ID), logger.Sublogger("ftdc")) |
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.
Technically has a bug -- cfg.Cloud.ID is nil for local configs. Fixed in last commit.
ftdc/cmd/parser.go
Outdated
@@ -36,6 +39,31 @@ type gnuplotWriter struct { | |||
options graphOptions | |||
} | |||
|
|||
type KVPair[K, V any] struct { |
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 expect you'll enjoy this @benjirewis
ftdc/cmd/parser.go
Outdated
nolintPrintln("Expected an FTDC filename. E.g: go run parser.go <path-to>/viam-server.ftdc") | ||
return | ||
} | ||
|
||
data, err := ftdc.Parse(ftdcFile) | ||
logger := logging.NewDebugLogger("parser") | ||
logger.SetLevel(logging.WARN) |
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.
Replaced with a simple NewLogger
and removed the SetLevel
-- using the INFO default.
@@ -416,8 +416,12 @@ func newWithResources( | |||
|
|||
var ftdcWorker *ftdc.FTDC | |||
if rOpts.enableFTDC { | |||
partID := "local-config" | |||
if cfg.Cloud != 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.
bug fix
@@ -48,7 +48,7 @@ type Arguments struct { | |||
OutputTelemetry bool `flag:"output-telemetry,usage=print out telemetry data (metrics and spans)"` | |||
DisableMulticastDNS bool `flag:"disable-mdns,usage=disable server discovery through multicast DNS"` | |||
DumpResourcesPath string `flag:"dump-resources,usage=dump all resource registrations as json to the provided file path"` | |||
EnableFTDC bool `flag:"ftdc,usage=enable fulltime data capture for diagnostics [beta feature]"` | |||
EnableFTDC bool `flag:"ftdc,default=true,usage=enable fulltime data capture for diagnostics"` |
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.
Stole from WebRTC
above on line 45. Hand tested that -ftdc=false
turns this off.
No description provided.