메트릭 시작 로그 추가
This commit is contained in:
@ -8,6 +8,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
"repositories.action2quare.com/ayo/gocommon/logger"
|
"repositories.action2quare.com/ayo/gocommon/logger"
|
||||||
@ -101,22 +102,29 @@ func init() {
|
|||||||
return &metric_empty{}
|
return &metric_empty{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if path.Base(os.Args[0]) == "houston" {
|
||||||
|
logger.Println("metrics are going to be generated for myself(houston)")
|
||||||
|
go mc.metricWriter()
|
||||||
|
NewMetric = newMetricImpl
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
ppid := os.Getppid()
|
ppid := os.Getppid()
|
||||||
if parent, _ := os.FindProcess(ppid); parent != nil {
|
if parent, _ := os.FindProcess(ppid); parent != nil {
|
||||||
filename := fmt.Sprintf(`/proc/%d/stat`, os.Getppid())
|
filename := fmt.Sprintf(`/proc/%d/stat`, os.Getppid())
|
||||||
if fn, err := os.ReadFile(filename); err == nil {
|
if fn, err := os.ReadFile(filename); err == nil {
|
||||||
if string(fn) == "houston" {
|
if path.Base(string(fn)) == "houston" {
|
||||||
logger.Println("metrics are activated for houston")
|
logger.Println("metrics are going to be generated for houston")
|
||||||
go mc.metricWriter()
|
go mc.metricWriter()
|
||||||
NewMetric = newMetricImpl
|
NewMetric = newMetricImpl
|
||||||
} else {
|
} else {
|
||||||
logger.Println("metrics are NOT activated")
|
logger.Println("metrics are NOT going to be generated. parent is not houston")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.Println("metrics are NOT activated")
|
logger.Println("metrics are NOT going to be generated. ppid proc is missing :", filename)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.Println("metrics are NOT activated")
|
logger.Println("metrics are NOT going to be generated. parent process is missing. ppid :", ppid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user