Skip to content

Commit 649093f

Browse files
committed
update: metrics notifier
1 parent 81c86e8 commit 649093f

File tree

1 file changed

+34
-18
lines changed

1 file changed

+34
-18
lines changed

cmd/all/all.go

+34-18
Original file line numberDiff line numberDiff line change
@@ -130,25 +130,41 @@ func PostRun(finalRecord define.Records, file string) {
130130
}
131131
}
132132
writeString("// Extracted information under \n")
133-
log.Info("Extract Namespaces: ")
134-
writeString("// Extract Namespaces:")
135-
list := post.RecordsDumpNameSpace(finalRecord, command.Opts.Zone)
136-
for _, ns := range list {
137-
log.Infof("Namespace: %s", ns)
133+
134+
{ // Namespaces
135+
log.Info("Extract Namespaces: ")
136+
writeString("// Extract Namespaces:\n")
137+
list := post.RecordsDumpNameSpace(finalRecord, command.Opts.Zone)
138+
for _, ns := range list {
139+
log.Infof("Namespace: %s", ns)
140+
}
141+
writeString("// Namespace: [" + strings.Join(list, ",") + "]\n")
138142
}
139-
writeString("// Namespace: [" + strings.Join(list, ",") + "]\n")
140-
log.Info("Extract Service: ")
141-
writeString("// Extract Service: ")
142-
list = post.RecordsDumpFullService(finalRecord, command.Opts.Zone)
143-
for _, svc := range list {
144-
log.Infof("Service: %s", svc)
145-
writeString("// \t\t" + svc + "\n")
143+
144+
{ // service
145+
log.Info("Extract Service: ")
146+
writeString("// Extract Service: \n")
147+
list := post.RecordsDumpFullService(finalRecord, command.Opts.Zone)
148+
for _, svc := range list {
149+
if strings.Contains(svc, "metrics") {
150+
if strings.Contains(svc, "kube-state-metrics") {
151+
log.Warnf("Checkout service %v, which maybe contains cluster metrics information", svc)
152+
} else {
153+
log.Warnf("Checkout service %v, which maybe contains apps metrics information", svc)
154+
}
155+
}
156+
log.Infof("Service: %s", svc)
157+
writeString("// \t\t" + svc + "\n")
158+
}
146159
}
147-
log.Info("Possible Pod and service ip maps")
148-
writeString("// Service maps: ")
149-
maps := post.PodServiceMap(finalRecord, command.Opts.Zone)
150-
for svc, ips := range maps {
151-
log.Infof("Service: %s\n\tips: [%s]", svc, strings.Join(ips, ","))
152-
writeString("// Service: " + svc + "\n//\tips: " + strings.Join(ips, "\n//\t\t") + "\n")
160+
161+
{ // service maps with pods and service ips
162+
log.Info("Possible Pod and service ip maps")
163+
writeString("// Service maps: \n")
164+
maps := post.PodServiceMap(finalRecord, command.Opts.Zone)
165+
for svc, ips := range maps {
166+
log.Infof("Service: %s\n\tips: [%s]", svc, strings.Join(ips, ","))
167+
writeString("// Service: " + svc + "\n//\tips:\t" + strings.Join(ips, "\n//\t\t") + "\n")
168+
}
153169
}
154170
}

0 commit comments

Comments
 (0)