mirror of
https://github.com/postmannen/ctrl.git
synced 2024-12-14 12:37:31 +00:00
metrics for processes, fixed up readme
This commit is contained in:
parent
833ce66c00
commit
fc04ea83bd
3 changed files with 9 additions and 5 deletions
|
@ -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 <https://erlang.org/download/armstrong_thesis_2003.pdf>. 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 <https://erlang.org/download/armstrong_thesis_2003.pdf>. 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
|
||||
```
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ DefaultMessageRetries = 3
|
|||
DefaultMessageTimeout = 5
|
||||
NodeName = "central"
|
||||
ProfilingPort = ""
|
||||
PromHostAndPort = ""
|
||||
PromHostAndPort = ":2112"
|
||||
StartPubSayHello = 0
|
||||
SubscribersDataFolder = "./data"
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue