proc/stat 분해
This commit is contained in:
@ -9,6 +9,7 @@ import (
|
||||
"math"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
|
||||
"repositories.action2quare.com/ayo/gocommon/logger"
|
||||
@ -113,7 +114,10 @@ func init() {
|
||||
if parent, _ := os.FindProcess(ppid); parent != nil {
|
||||
filename := fmt.Sprintf(`/proc/%d/stat`, os.Getppid())
|
||||
if fn, err := os.ReadFile(filename); err == nil {
|
||||
if path.Base(string(fn)) == "houston" {
|
||||
stats := strings.SplitN(string(fn), " ", 3)
|
||||
parentname := strings.Trim(stats[1], "()")
|
||||
|
||||
if path.Base(parentname) == "houston" {
|
||||
logger.Println("metrics are going to be generated for houston")
|
||||
go mc.metricWriter()
|
||||
NewMetric = newMetricImpl
|
||||
|
||||
Reference in New Issue
Block a user