proc/stat 분해

This commit is contained in:
2023-11-20 17:06:53 +09:00
parent aa7a9661b9
commit 49dabb35f0

View File

@ -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