diff --git a/README.md b/README.md index acf0396..b0343de 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ A node can be a server running any host operating system, a container living in ## Inspiration -The idea for how to handle processes, messages and errors are based on Joe Armstrongs idea behind Erlang described in his Thesis . This does mean it is done in exactly the same way, but more on how I understood those ideas and implemented them using the Go programming language with NATS as the message broker to get a fully decoupled message passing system to handle processes. +The idea for how to handle processes, messages and errors are based on Joe Armstrongs idea behind Erlang described in his Thesis . This does not mean it is done in exactly the same way, but more on how I understood those ideas and implemented them using the Go programming language with NATS as the message broker to get a fully decoupled message passing system to handle processes. ## Why @@ -199,7 +199,7 @@ The start subscribers flags take a string value of which nodes that it will proc ```go // The node to send the message to toNode -// The Unique ID of the message +// The actual data in the message data // method, what is this message doing, etc. CLI, syslog, etc. method @@ -211,7 +211,7 @@ retries requestTimeout // The retries of the new message created via a request event. requestRetries -// Timeout for long a process should be allowed to operate +// Timeout for how long a process should be allowed to operate methodTimeout ``` diff --git a/etc/config.toml b/etc/config.toml index 66f6be6..a75da08 100644 --- a/etc/config.toml +++ b/etc/config.toml @@ -5,7 +5,7 @@ DefaultMessageRetries = 3 DefaultMessageTimeout = 5 NodeName = "central" ProfilingPort = "" -PromHostAndPort = "" +PromHostAndPort = ":2112" StartPubSayHello = 0 SubscribersDataFolder = "./data" diff --git a/startup_processes.go b/startup_processes.go index eee2cfd..8c47fbf 100644 --- a/startup_processes.go +++ b/startup_processes.go @@ -50,6 +50,10 @@ func (s *server) ProcessesStart() { proc := newProcess(s.processes, s.toRingbufferCh, s.configuration, sub, s.errorKernel.errorCh, processKindSubscriber, s.configuration.StartSubSayHello.Values, nil) proc.procFuncCh = make(chan Message) + // The reason for running the say hello subscriber as a procFunc is that + // a handler are not able to hold state, and we need to hold the state + // of the nodes we've received hello's from in the sayHelloNodes map, + // which is the information we pass along to generate metrics. proc.procFunc = func() error { sayHelloNodes := make(map[node]struct{}) for { @@ -60,7 +64,7 @@ func (s *server) ProcessesStart() { sayHelloNodes[m.FromNode] = struct{}{} // update the prometheus metrics - s.metrics.metricsCh <- metricType{ + proc.processes.metricsCh <- metricType{ metric: prometheus.NewGauge(prometheus.GaugeOpts{ Name: "hello_nodes", Help: "The current number of total nodes who have said hello",