agent: update flag name

This commit is contained in:
Gyu-Ho Lee 2017-01-10 19:33:49 -08:00
parent 34bebef418
commit d64162569d
No known key found for this signature in database
GPG Key ID: 1DDD39C7EB70C24C
4 changed files with 9 additions and 9 deletions

View File

@ -29,7 +29,7 @@ import (
type flags struct {
agentLog string
databaseLog string
systemMetricsLog string
systemMetricsCSV string
javaExec string
etcdExec string
@ -63,7 +63,7 @@ func init() {
Command.PersistentFlags().StringVar(&globalFlags.agentLog, "agent-log", filepath.Join(homeDir(), "agent.log"), "agent log path.")
Command.PersistentFlags().StringVar(&globalFlags.databaseLog, "database-log", filepath.Join(homeDir(), "database.log"), "Database log path.")
Command.PersistentFlags().StringVar(&globalFlags.systemMetricsLog, "system-metrics-log", filepath.Join(homeDir(), "system-metrics.csv"), "System metrics log path.")
Command.PersistentFlags().StringVar(&globalFlags.systemMetricsCSV, "system-metrics-csv", filepath.Join(homeDir(), "system-metrics.csv"), "System metrics log path.")
Command.PersistentFlags().StringVar(&globalFlags.javaExec, "java-exec", "/usr/bin/java", "Java executable binary path (needed for Zookeeper).")
Command.PersistentFlags().StringVar(&globalFlags.etcdExec, "etcd-exec", filepath.Join(os.Getenv("GOPATH"), "bin/etcd"), "etcd executable binary path.")

View File

@ -89,7 +89,7 @@ func (t *transporterServer) Transfer(ctx context.Context, r *agentpb.Request) (*
t.proxyDatabaseLogfile = pf
plog.Infof("proxy-database log path: %q", proxyLog)
}
plog.Infof("system metrics log path: %q", globalFlags.systemMetricsLog)
plog.Infof("system metrics CSV path: %q", globalFlags.systemMetricsCSV)
switch r.Database {
case agentpb.Request_ZooKeeper:

View File

@ -30,13 +30,13 @@ func startMetrics(fs *flags, t *transporterServer) error {
plog.Infof("starting collecting metrics [database %q | PID: %d | disk device: %q | network interface: %q]",
t.req.Database, t.pid, fs.diskDevice, fs.networkInterface)
if err := os.RemoveAll(fs.systemMetricsLog); err != nil {
if err := os.RemoveAll(fs.systemMetricsCSV); err != nil {
return err
}
if err := toFile(fmt.Sprintf("%d", t.req.ClientNum), t.clientNumPath); err != nil {
return err
}
t.metricsCSV = psn.NewCSV(fs.systemMetricsLog, t.pid, fs.diskDevice, fs.networkInterface, t.clientNumPath)
t.metricsCSV = psn.NewCSV(fs.systemMetricsCSV, t.pid, fs.diskDevice, fs.networkInterface, t.clientNumPath)
if err := t.metricsCSV.Add(); err != nil {
return err
}

View File

@ -77,10 +77,10 @@ func uploadLog(fs *flags, t *transporterServer) error {
}
}
srcMonitorResultPath := fs.systemMetricsLog
dstMonitorResultPath := filepath.Base(fs.systemMetricsLog)
if !strings.HasPrefix(filepath.Base(fs.systemMetricsLog), t.req.TestName) {
dstMonitorResultPath = fmt.Sprintf("%s-%d-%s", t.req.TestName, t.req.ServerIndex+1, filepath.Base(fs.systemMetricsLog))
srcMonitorResultPath := fs.systemMetricsCSV
dstMonitorResultPath := filepath.Base(fs.systemMetricsCSV)
if !strings.HasPrefix(filepath.Base(fs.systemMetricsCSV), t.req.TestName) {
dstMonitorResultPath = fmt.Sprintf("%s-%d-%s", t.req.TestName, t.req.ServerIndex+1, filepath.Base(fs.systemMetricsCSV))
}
dstMonitorResultPath = filepath.Join(t.req.GoogleCloudStorageSubDirectory, dstMonitorResultPath)
plog.Infof("uploading monitor results [%q -> %q]", srcMonitorResultPath, dstMonitorResultPath)