nqm

package
v0.0.0-...-5c733f5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
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.

View Source
const UNKNOWN_NAME_FOR_QUERY = "<UNKNOWN>"

Variables

This section is empty.

Functions

This section is empty.

Types

type City

type City struct {
	Id   int16  `orm:"pk;column(ct_id)" json:"id"`
	Name string `orm:"column(ct_name)" json:"name"`
}

func (*City) TableName

func (city *City) TableName() string

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 EpochTime

type EpochTime int64

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 Id2Bytes

type Id2Bytes int16

*

  • Aliases of type for DSL

type Isp

type Isp struct {
	Id   int16  `orm:"pk;column(isp_id)" json:"id"`
	Name string `orm:"column(isp_name)" json:"name"`
}

func (*Isp) TableName

func (isp *Isp) TableName() string

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"`
	IdsOfTargetProvinces []Id2Bytes `json:"ids_of_target_provinces"`
	IdsOfTargetIsps      []Id2Bytes `json:"ids_of_target_isps"`

	ProvinceRelation dsl.HostRelation `json:"province_relation"`
}

Represents the DSL for query over Icmp log

type Province

type Province struct {
	Id   int16  `orm:"pk;column(pv_id)" json:"id"`
	Name string `orm:"column(pv_name)" json:"name"`
}

func (*Province) TableName

func (province *Province) TableName() string

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) Init

func (srv ServiceController) Init()

Initilaize the service

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

type Target

type Target struct {
	Id   int32  `orm:"pk;column(tg_id)"`
	Host string `orm:"column(tg_host)"`
}

func (*Target) TableName

func (target *Target) TableName() string

type TargetMetric

type TargetMetric struct {
	Id      int32    `json:"id"`
	Host    string   `json:"host"`
	Isp     *Isp     `json:"isp"`
	Metrics *Metrics `json:"metrics"`
}

The data used for reporting of ICMP statistics target node

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL