mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-28 09:13:09 -06:00
use labels
This commit is contained in:
parent
cd639b07c4
commit
0294ee7338
|
|
@ -35,12 +35,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
pduCountTotal = prometheus.NewCounter(
|
pduCountTotal = prometheus.NewCounterVec(
|
||||||
prometheus.CounterOpts{
|
prometheus.CounterOpts{
|
||||||
Namespace: "dendrite",
|
Namespace: "dendrite",
|
||||||
Subsystem: "federationapi",
|
Subsystem: "federationapi",
|
||||||
Name: "recv_pdus",
|
Name: "recv_pdus",
|
||||||
},
|
},
|
||||||
|
[]string{"success", "total"},
|
||||||
)
|
)
|
||||||
eduCountTotal = prometheus.NewCounter(
|
eduCountTotal = prometheus.NewCounter(
|
||||||
prometheus.CounterOpts{
|
prometheus.CounterOpts{
|
||||||
|
|
@ -49,18 +50,11 @@ var (
|
||||||
Name: "recv_edus",
|
Name: "recv_edus",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
pduSuccessTotal = prometheus.NewCounter(
|
|
||||||
prometheus.CounterOpts{
|
|
||||||
Namespace: "dendrite",
|
|
||||||
Subsystem: "federationapi",
|
|
||||||
Name: "recv_pdus_success",
|
|
||||||
},
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
prometheus.MustRegister(
|
prometheus.MustRegister(
|
||||||
pduCountTotal, eduCountTotal, pduSuccessTotal,
|
pduCountTotal, eduCountTotal,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -164,7 +158,7 @@ func (t *txnReq) processTransaction(ctx context.Context) (*gomatrixserverlib.Res
|
||||||
|
|
||||||
pdus := []*gomatrixserverlib.HeaderedEvent{}
|
pdus := []*gomatrixserverlib.HeaderedEvent{}
|
||||||
for _, pdu := range t.PDUs {
|
for _, pdu := range t.PDUs {
|
||||||
pduCountTotal.Inc()
|
pduCountTotal.WithLabelValues("total").Inc()
|
||||||
var header struct {
|
var header struct {
|
||||||
RoomID string `json:"room_id"`
|
RoomID string `json:"room_id"`
|
||||||
}
|
}
|
||||||
|
|
@ -256,7 +250,7 @@ func (t *txnReq) processTransaction(ctx context.Context) (*gomatrixserverlib.Res
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
results[e.EventID()] = gomatrixserverlib.PDUResult{}
|
results[e.EventID()] = gomatrixserverlib.PDUResult{}
|
||||||
pduSuccessTotal.Inc()
|
pduCountTotal.WithLabelValues("success").Inc()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue