FieldGridName used in field
const FieldGridName = "Field_Grids"
FieldMeshGridCntName used in field
const FieldMeshGridCntName = "fg"
GroupMeshVaultName used in group
const GroupMeshVaultName = "g"
GroupVaultName used in group
const GroupVaultName = "Groups"
MatchMakerCompleteCnt used in matching
const MatchMakerCompleteCnt = "mc"
MatchMakerCompleteName used in matching
const MatchMakerCompleteName = "MatchMaker_Complete"
MatchMakerEmptySearchCnt used in matching
const MatchMakerEmptySearchCnt = "me"
MatchMakerEmptySearchName used in matching
const MatchMakerEmptySearchName = "MatchMaker_Empty"
MatchMakerSearchCnt used in matching
const MatchMakerSearchCnt = "ms"
MatchMakerSearchName used in matching
const MatchMakerSearchName = "MatchMaker_Search"
MatchMakerTicketAddCnt used in matching
const MatchMakerTicketAddCnt = "mta"
MatchMakerTicketAddName used in matching
const MatchMakerTicketAddName = "MatchMaker_Ticket_Add"
MatchMakerTicketCnt used in matching
const MatchMakerTicketCnt = "mt"
MatchMakerTicketCompleteTimeAvg used in matching
const MatchMakerTicketCompleteTimeAvg = "mtt"
MatchMakerTicketCompleteTimeAvgName used in matching
const MatchMakerTicketCompleteTimeAvgName = "MatchMaker_Ticket_Complete_Time_Avg"
MatchMakerTicketCompleteTimeMax used in matching
const MatchMakerTicketCompleteTimeMax = "mtx"
MatchMakerTicketCompleteTimeMaxName used in matching
const MatchMakerTicketCompleteTimeMaxName = "MatchMaker_Ticket_Complete_Time_Max"
MatchMakerTicketCompleteTimeMin used in matching
const MatchMakerTicketCompleteTimeMin = "mtn"
MatchMakerTicketCompleteTimeMinName used in matching
const MatchMakerTicketCompleteTimeMinName = "MatchMaker_Ticket_Complete_Time_Min"
MatchMakerTicketName used in matching
const MatchMakerTicketName = "MatchMaker_Ticket"
MatchMakerTicketSearchCnt used in matching
const MatchMakerTicketSearchCnt = "mts"
MatchMakerTicketSearchName used in matching
const MatchMakerTicketSearchName = "MatchMaker_Ticket_Search"
MeshPktSampleIn used in mesh
const MeshPktSampleIn = "mi"
MeshPktSampleInName used in mesh
const MeshPktSampleInName = "Mesh_Packets_In"
MeshPktSampleOut used in mesh
const MeshPktSampleOut = "mo"
MeshPktSampleOutName used in mesh
const MeshPktSampleOutName = "Mesh_Packets_Out"
MeshPktSampleRetry used in mesh
const MeshPktSampleRetry = "mr"
MeshPktSampleRetryName used in mesh
const MeshPktSampleRetryName = "Mesh_Retry"
P2PAttemptCnt used in P2P
const P2PAttemptCnt = "pa"
P2PAttemptName used in P2P attempt count report
const P2PAttemptName = "P2P_Attempt"
P2PSuccessCnt used in P2P success count report
const P2PSuccessCnt = "ps"
P2PSuccessName used in P2P success count report
const P2PSuccessName = "P2P_Success"
RoomMeshVaultName used in room
const RoomMeshVaultName = "r"
RoomVaultName used in room
const RoomVaultName = "Rooms"
TCPPktSampleIn used in tcp
const TCPPktSampleIn = "ti"
TCPPktSampleInName used in tcp
const TCPPktSampleInName = "TCP_Packets_In"
TCPPktSampleOut used in tcp
const TCPPktSampleOut = "to"
TCPPktSampleOutName used in tcp
const TCPPktSampleOutName = "TCP_Packets_Out"
TCPPktSampleSizeIn used in tcp
const TCPPktSampleSizeIn = "tsi"
TCPPktSampleSizeInName used in tcp
const TCPPktSampleSizeInName = "TCP_Packet_Size_In"
TCPPktSampleSizeOut used in tcp
const TCPPktSampleSizeOut = "tso"
TCPPktSampleSizeOutName used in tcp
const TCPPktSampleSizeOutName = "TCP_Packet_Size_Out"
UDPCmdSample used in udp
const UDPCmdSample = "um"
UDPCmdSampleName used in udp
const UDPCmdSampleName = "Commands_In"
UDPPktSampleIn used in udp
const UDPPktSampleIn = "ui"
UDPPktSampleInName used in udp
const UDPPktSampleInName = "UDP_Packets_In"
UDPPktSampleOut used in udp
const UDPPktSampleOut = "uo"
UDPPktSampleOutName used in udp
const UDPPktSampleOutName = "UDP_Packets_Out"
UDPPktSampleSizeIn used in udp
const UDPPktSampleSizeIn = "usi"
UDPPktSampleSizeInName used in udp
const UDPPktSampleSizeInName = "UDP_Packet_Size_In"
UDPPktSampleSizeOut used in udp
const UDPPktSampleSizeOut = "uso"
UDPPktSampleSizeOutName used in udp
const UDPPktSampleSizeOutName = "UDP_Packet_Size_Out"
UDPRetrySample used in udp
const UDPRetrySample = "ur"
UDPRetrySampleName used in udp
const UDPRetrySampleName = "RUDP_Retries"
UDPSendSample used in udp
const UDPSendSample = "us"
UDPSendSampleName used in udp
const UDPSendSampleName = "Commands_Out"
UDPSplitSampleIn used in udp
const UDPSplitSampleIn = "si"
UDPSplitSampleInName used in udp
const UDPSplitSampleInName = "RUDP_Split_In"
UDPSplitSampleOut used in udp
const UDPSplitSampleOut = "so"
UDPSplitSampleOutName used in udp
const UDPSplitSampleOutName = "RUDP_Split_Out"
UserMeshVaultName used in user
const UserMeshVaultName = "uc"
UserVaultName used in user
const UserVaultName = "Users"
func DefineMetricsValue(name string, cb ValueUpdate) error
DefineMetricsValue defines the value update operation of the metrics name given.
[IMPORTANT] MUST invoke this function BEFORE calling diarkis.Start() [IMPORTANT] MUST invoke this function AFTER calling mesh.Setup(...)
Error Cases
┌────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────┐ │ Error │ Reason │ ├────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────┤ │ Setup must invoked at the start of the process │ Invoking this function without calling Setup() is not allowed. │ │ Must be invoked BEFORE the start of Diarkis │ Invoking this function after the start of Diarkis is not allowed. │ │ Metrics name must be configured │ All metrics names must be configured in the configuration file. │ │ Metrics value update function already assigned │ Assigning multiple value update functions for a metrics name is not allowed. │ └────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────┘
The name must be configured in a configuration file.
func DefineMetricsValueWithLabel(name string, cb ValueLabelUpdate) error
DefineMetricsValueWithLabel defines the value update operation of the metrics name and label given. Currently it only works for Prometheus metrics. See the documentation for DefineMetricsValue for more information
func GetMetricsValues(nodeType string) map[string][]*Item
GetMetricsValues [INTERNAL USE ONLY] returns all metrics values with the configured names and update functions
func PassMeshGetNodeAddressesByRole(cb func(string) []string)
PassMeshGetNodeAddressesByRole [INTERNAL USE ONLY]
func PassMeshGetNodeTypeByAddress(cb func(string) string)
PassMeshGetNodeTypeByAddress [INTERNAL USE ONLY]
func PassMeshGetNodeValue(cb func(string, string) interface{})
PassMeshGetNodeValue [INTERNAL USE ONLY]
func PassMeshOnUpdate(cb func(func()))
PassMeshOnUpdate [INTERNAL USE ONLY]
func PassMeshSetNodeValue(cb func(string, interface{}))
PassMeshSetNodeValue [INTERNAL USE ONLY]
func Setup(path string)
Setup must be invoked at the start of the process in order to use metrics.
[IMPORTANT] Must invoke this function BEFORE calling diarkis.Start() [IMPORTANT] MUST invoke this function AFTER calling mesh.Setup(...)
Item [INTERNAL USE ONLY] represents a metrics value
type Item struct { Addr string Value interface{} Type string Labels map[string]string }
LabelValue map[map[string]string]int
type LabelValue struct { Value interface{} `json:"v"` Labels map[string]string `json:"l"` }
ValueLabelUpdate is a function that updates the associated metrics value by using the returned value as its associated metrics label and value.
type ValueLabelUpdate func() (value []*LabelValue)
ValueUpdate is a function that updates the associated metrics value by using the returned value as its associated metrics value.
type ValueUpdate func() (value int)