Skip to content

Commit

Permalink
cot metric scope
Browse files Browse the repository at this point in the history
  • Loading branch information
kdudkov committed Nov 10, 2023
1 parent 5c0b222 commit 61334c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion cmd/goatak_server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"encoding/pem"
"flag"
"fmt"
"github.com/prometheus/client_golang/prometheus"
"log"
"net"
"os"
Expand Down Expand Up @@ -166,7 +167,7 @@ func (app *App) Run() {

func (app *App) NewCotMessage(msg *cot.CotMessage) {
if msg != nil {
messagesMetric.Inc()
messagesMetric.With(prometheus.Labels{"scope": msg.Scope}).Inc()
app.ch <- msg
}
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/goatak_server/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
)

var (
messagesMetric = promauto.NewCounter(prometheus.CounterOpts{
messagesMetric = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "goatak",
Name: "cots_processed",
Help: "The total number of cots processed",
})
}, []string{"scope"})

connectionsMetric = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: "goatak",
Expand Down

0 comments on commit 61334c0

Please sign in to comment.