Documentation
¶
Index ¶
Constants ¶
const UNKNOWN_ID_FOR_QUERY = -2
This value is used to indicate the non-existing id for data(province, city, or ISP) Instead of -1(e.x. A agent doesn't has information of ISP), this value is used in query.
const UNKNOWN_NAME_FOR_QUERY = "<UNKNOWN>"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
Id int32 `json:"id"`
Name string `json:"name"`
Hostname string `json:"hostname"`
IpAddress string `json:"ip_address"`
}
Represents the data of NQM agent
type AgentsInCity ¶
Represents the agents in city
func ListAgentsInCityByProvinceId ¶
func ListAgentsInCityByProvinceId(provinceId int32) []*AgentsInCity
Lists agents in city by id of province
type City ¶
type CityMetric ¶
type CityMetric struct {
City *City `json:"city"`
Metrics *Metrics `json:"metrics"`
Targets []TargetMetric `json:"targets"`
}
The data used for reporting of ICMP statistics, which contains detail of target node(grouping by city)
type IcmpDslArgs ¶
type IcmpDslArgs struct {
Dsl *NqmDsl `json:"dsl"`
}
As the DSL arguments for calling JSONRPC
type IcmpResult ¶
type IcmpResult struct {
// contains filtered or unexported fields
}
The raw result returned from JSONRPC
func (*IcmpResult) UnmarshalJSON ¶
func (icmpResult *IcmpResult) UnmarshalJSON(p []byte) error
Used to unmarshal JSON with specific structure of IcmpResult(because of reusing struct)
type Isp ¶
type Metrics ¶
type Metrics struct {
Max int16 `json:"max"`
Min int16 `json:"min"`
Avg float32 `json:"avg"`
Med int16 `json:"med"`
Mdev float32 `json:"mdev"`
Loss float32 `json:"loss"`
Count int32 `json:"count"`
NumberOfSentPackets uint64 `json:"number_of_sent_packets"`
NumberOfReceivedPackets uint64 `json:"number_of_received_packets"`
}
*
- Macro-struct re-used by various data
type NqmDsl ¶
type NqmDsl struct {
GroupingColumns []string `json:"grouping_columns"`
StartTime EpochTime `json:"start_time"`
EndTime EpochTime `json:"end_time"`
IdsOfAgentProvinces []Id2Bytes `json:"ids_of_agent_provinces"`
IdsOfAgentIsps []Id2Bytes `json:"ids_of_agent_isps"`
IdsOfAgentCities []Id2Bytes `json:"ids_of_agent_cities"`
IdsOfTargetProvinces []Id2Bytes `json:"ids_of_target_provinces"`
IdsOfTargetIsps []Id2Bytes `json:"ids_of_target_isps"`
IdsOfTargetCities []Id2Bytes `json:"ids_of_target_cities"`
IdsOfAgents []int32 `json:"ids_of_agents"`
IdsOfTargets []int32 `json:"ids_of_targets"`
ProvinceRelation dsl.HostRelation `json:"province_relation"`
}
Represents the DSL for query over Icmp log
type Province ¶
type ProvinceMetric ¶
type ProvinceMetric struct {
Province *Province `json:"province"`
Metrics *Metrics `json:"metrics"`
}
The data used for reporting of ICMP statistics(grouping by provinces of agents)
type ServiceController ¶
type ServiceController struct {
GetStatisticsOfIcmpByDsl func(*NqmDsl) ([]IcmpResult, error)
GetProvinceById func(int16) *Province
GetProvinceByName func(string) *Province
GetIspById func(int16) *Isp
GetIspByName func(string) *Isp
GetCityById func(int16) *City
GetCityByName func(string) *City
GetTargetById func(int32) *Target
GetTargetByHost func(string) *Target
}
*
- 1. Main controller for NQM reporting
- 2. Makes the unit test more easily(by replacing lambda used in method)
func GetDefaultServiceController ¶
func GetDefaultServiceController() ServiceController
func (ServiceController) ListByProvinces ¶
func (srv ServiceController) ListByProvinces(dslParams *dsl.QueryParams) []ProvinceMetric
Query data for provinces
func (ServiceController) ListTargetsWithCityDetail ¶
func (srv ServiceController) ListTargetsWithCityDetail(dslParams *dsl.QueryParams) []CityMetric
Query data for detail of city