nqm

package
v0.0.0-...-5416f79 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2017 License: Apache-2.0, Apache-2.0 Imports: 26 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

func BuildQuery

func BuildQuery(q *model.CompoundQuery) *owlModel.Query

func GetCompoundQueryByUuid

func GetCompoundQueryByUuid(uuid uuid.UUID) *model.CompoundQuery

func LoadIcmpRecordsOfCompoundQuery

func LoadIcmpRecordsOfCompoundQuery(q *model.CompoundQuery, paging *commonModel.Paging) []*model.DynamicRecord

Loads data by compound query.

This function do not filter the data with metric DSL.

Types

type CityMetric

type CityMetric struct {
	City    *owlModel.City2 `json:"city"`
	Metrics *model.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

*

  • Aliases of type for DSL

type IcmpResult

type IcmpResult struct {
	// contains filtered or unexported fields
}

The raw result returned from JSONRPC

func (*IcmpResult) UnmarshalJSON

func (r *IcmpResult) UnmarshalJSON(p []byte) error

Used to unmarshal JSON with specific structure of IcmpResult(because of reusing struct)

type NqmDsl

type NqmDsl struct {
	GroupingColumns []string `json:"grouping_columns"`

	StartTime *EpochTime `json:"start_time,omitempty"`
	EndTime   *EpochTime `json:"end_time,omitempty"`

	TimeRanges []*TimeRangeOfDsl `json:"time_ranges"`

	IdsOfAgents         []int32 `json:"ids_of_agents"`
	IdsOfAgentIsps      []int16 `json:"ids_of_agent_isps"`
	IdsOfAgentProvinces []int16 `json:"ids_of_agent_provinces"`
	IdsOfAgentCities    []int16 `json:"ids_of_agent_cities"`
	IdsOfAgentNameTags  []int16 `json:"ids_of_agent_name_tags"`
	IdsOfAgentGroupTags []int32 `json:"ids_of_agent_group_tags"`

	IdsOfTargets         []int32 `json:"ids_of_targets"`
	IdsOfTargetProvinces []int16 `json:"ids_of_target_provinces"`
	IdsOfTargetIsps      []int16 `json:"ids_of_target_isps"`
	IdsOfTargetCities    []int16 `json:"ids_of_target_cities"`
	IdsOfTargetNameTags  []int16 `json:"ids_of_target_name_tags"`
	IdsOfTargetGroupTags []int32 `json:"ids_of_target_group_tags"`

	IspRelation      model.PropRelation `json:"isp_relation"`
	ProvinceRelation model.PropRelation `json:"province_relation"`
	CityRelation     model.PropRelation `json:"city_relation"`
	NameTagRelation  model.PropRelation `json:"name_tag_relation"`
}

Represents the DSL for query over Icmp log

type ProvinceMetric

type ProvinceMetric struct {
	Province *owlModel.Province `json:"province"`
	Metrics  *model.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) *owlModel.Province
	GetIspById               func(int16) *owlModel.Isp
	GetCityById              func(int16) *owlModel.City2
	GetTargetById            func(int32) *nqmModel.SimpleTarget1
}

*

  • 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 TargetMetric

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

The data used for reporting of ICMP statistics target node

type TimeRangeOfDsl

type TimeRangeOfDsl struct {
	StartTime EpochTime `json:"start_time"`
	EndTime   EpochTime `json:"end_time"`
}

Jump to

Keyboard shortcuts

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