metrics

package module
v0.0.0-...-8f6edbe Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 15 Imported by: 5

Documentation

Index

Constants

View Source
const (
	SesMetTypeLogin   = "login"
	SesMetTypeLogout  = "logout"
	SesMetTypeTimeout = "timeout"
	SesMetTypeError   = "error"
)

Session metric types

View Source
const (
	SesMetErrTypeOauth       = "oauth"
	SesMetErrTypeMaxSessions = "maxsessions"
)

Session metric error types

View Source
const EvMetDescription = "description"
View Source
const EvMetDest = "dest"
View Source
const EvMetEvent = "event"
View Source
const EvMetName = "events"
View Source
const EvMetSrc = "src"
View Source
const EvMetTime = "time"
View Source
const EvMetType = "type"
View Source
const GisMetDest = "dest"
View Source
const GisMetDestType = "destType"
View Source
const GisMetDistance = "dist"
View Source
const GisMetMeasType = "measType"
View Source
const GisMetMeasTypeDistance = "distance"
View Source
const GisMetMeasTypeSignal = "signal"
View Source
const GisMetName = "meas"
View Source
const GisMetNameInflux = "gis"
View Source
const GisMetRsrp = "rsrp"
View Source
const GisMetRsrq = "rsrq"
View Source
const GisMetRssi = "rssi"
View Source
const GisMetSrc = "src"
View Source
const GisMetSrcType = "srcType"
View Source
const GisMetTime = "time"
View Source
const HttpBody = "body"
View Source
const HttpDst = "dst"
View Source
const HttpLogEndpoint = "endpoint"
View Source
const HttpLogId = "id"
View Source
const HttpLogMetricName = "http"
View Source
const HttpLogTime = "time"
View Source
const HttpLoggerDirection = "direction"
View Source
const HttpLoggerMsgType = "msg_type"
View Source
const HttpLoggerName = "logger_name"
View Source
const HttpMermaid = "mermaid"
View Source
const HttpMethod = "method"
View Source
const HttpMsgDirectionRx = "RX"
View Source
const HttpMsgDirectionTx = "TX"
View Source
const HttpMsgTypeNotification = "notification"
View Source
const HttpMsgTypeRequest = "request"
View Source
const HttpMsgTypeResponse = "response"
View Source
const HttpProcTime = "proc_time"
View Source
const HttpRespBody = "resp_body"
View Source
const HttpRespCode = "resp_code"
View Source
const HttpSdorg = "sdorg"
View Source
const HttpSrc = "src"
View Source
const HttpUrl = "url"
View Source
const MetricsDbDisabled = "disabled"
View Source
const NetMetDLPktLoss = "dlos"
View Source
const NetMetDLThroughput = "dl"
View Source
const NetMetDst = "dest"
View Source
const NetMetLatency = "lat"
View Source
const NetMetName = "network"
View Source
const NetMetSrc = "src"
View Source
const NetMetTime = "time"
View Source
const NetMetULPktLoss = "ulos"
View Source
const NetMetULThroughput = "ul"
View Source
const SboxMetCreateTime = "createtime"
View Source
const SboxMetName = "sbox"
View Source
const SboxMetSboxName = "sboxname"
View Source
const SboxMetTime = "time"
View Source
const SboxMetType = "type"
View Source
const (
	SboxMetTypeCreate = "create"
)

Sandbox metric types

View Source
const SesMetDesc = "description"
View Source
const SesMetErrType = "errtype"
View Source
const SesMetName = "session"
View Source
const SesMetProvider = "provider"
View Source
const SesMetSbox = "sbox"
View Source
const SesMetSid = "sid"
View Source
const SesMetTime = "time"
View Source
const SesMetType = "type"
View Source
const SesMetUser = "userid"

Variables

View Source
var MAX_LIMIT = 10000

Functions

func JsonNumToFloat64

func JsonNumToFloat64(num json.Number) (val float64)

func JsonNumToInt32

func JsonNumToInt32(num json.Number) (val int32)

func MetricsHandler

func MetricsHandler(inner http.Handler, sbox string, svc string) http.Handler

MetricsHandler - REST API Metrics Handler

func ObserveNotification

func ObserveNotification(sbox string, svc string, notif string, url string, resp *http.Response, duration float64)

func StrToFloat64

func StrToFloat64(str string) (val float64)

func StrToInt32

func StrToInt32(str string) (val int32)

Types

type EventMetric

type EventMetric struct {
	Time        interface{}
	Event       string
	Description string
	Src         string
	Dest        string
}

type GisMetric

type GisMetric struct {
	Src      string
	SrcType  string
	Dest     string
	DestType string
	Time     interface{}
	Rssi     int32
	Rsrp     int32
	Rsrq     int32
	Distance float64
}

type HttpMetric

type HttpMetric struct {
	LoggerName string
	MsgType    string
	Id         int32
	Url        string
	Endpoint   string
	Method     string
	Src        string
	Dst        string
	Body       string
	RespBody   string
	RespCode   string
	ProcTime   string
	Time       interface{}
	Mermaid    string
	Sdorg      string
}

type Metric

type Metric struct {
	Name   string
	Tags   map[string]string
	Fields map[string]interface{}
}

type MetricStore

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

MetricStore - Implements a metric store

func NewMetricStore

func NewMetricStore(name string, namespace string, influxAddr string, redisAddr string) (ms *MetricStore, err error)

NewMetricStore - Creates and initialize a Metric Store instance

func (*MetricStore) Copy

func (ms *MetricStore) Copy(src string, dst string) error

Copy

func (*MetricStore) Flush

func (ms *MetricStore) Flush()

Flush

func (*MetricStore) FormatMetrics

func (ms *MetricStore) FormatMetrics(h HttpMetric) (mermaidLogs string, sdorgLogs string)

func (*MetricStore) GetCachedNetworkMetric

func (ms *MetricStore) GetCachedNetworkMetric(src string, dst string) (metric NetworkMetric, err error)

GetCachedNetworkMetric

func (*MetricStore) GetCachedNetworkMetrics

func (ms *MetricStore) GetCachedNetworkMetrics(src string, dst string) (metric []NetworkMetric, err error)

GetCachedNetworkMetrics

func (*MetricStore) GetEventMetric

func (ms *MetricStore) GetEventMetric(eventType string, duration string, count int) (metrics []EventMetric, err error)

GetEventMetric

func (*MetricStore) GetHttpMetric

func (ms *MetricStore) GetHttpMetric(loggerName string, msgType string, duration string, count int) (metrics []HttpMetric, err error)

GetHttpMetric

func (*MetricStore) GetInfluxMetric

func (ms *MetricStore) GetInfluxMetric(metric string, tags map[string]string, fields []string, duration string, limit int) (values []map[string]interface{}, err error)

GetInfluxMetric - Generic metric getter

func (*MetricStore) GetNetworkMetric

func (ms *MetricStore) GetNetworkMetric(src string, dst string, duration string, count int) (metrics []NetworkMetric, err error)

GetNetworkMetric

func (*MetricStore) GetRedisMetric

func (ms *MetricStore) GetRedisMetric(metric string, tagStr string) (values []map[string]interface{}, err error)

GetRedisMetric - Generic metric getter

func (*MetricStore) GetSandboxMetric

func (ms *MetricStore) GetSandboxMetric(typ string, duration string, count int) (metrics []SandboxMetric, err error)

GetSandboxMetric

func (*MetricStore) GetSessionMetric

func (ms *MetricStore) GetSessionMetric(typ string, duration string, count int) (metrics []SessionMetric, err error)

GetSessionMetric

func (*MetricStore) SetCachedNetworkMetric

func (ms *MetricStore) SetCachedNetworkMetric(metric NetworkMetric) (err error)

SetCachedNetworkMetric

func (*MetricStore) SetEventMetric

func (ms *MetricStore) SetEventMetric(eventType string, em EventMetric) error

SetEventMetric

func (*MetricStore) SetHttpMetric

func (ms *MetricStore) SetHttpMetric(h HttpMetric) error

SetHttpMetric

func (*MetricStore) SetInfluxMetric

func (ms *MetricStore) SetInfluxMetric(metricList []Metric) error

SetInfluxMetric - Generic metric setter

func (*MetricStore) SetNetworkMetric

func (ms *MetricStore) SetNetworkMetric(nm NetworkMetric) error

SetNetworkMetric

func (*MetricStore) SetRedisMetric

func (ms *MetricStore) SetRedisMetric(metric string, tagStr string, fields map[string]interface{}) (err error)

SetRedisMetric - Generic metric setter

func (*MetricStore) SetSandboxMetric

func (ms *MetricStore) SetSandboxMetric(typ string, sm SandboxMetric) error

SetSandboxMetric

func (*MetricStore) SetSessionMetric

func (ms *MetricStore) SetSessionMetric(typ string, sm SessionMetric) error

SetSessionMetric

func (*MetricStore) SetStore

func (ms *MetricStore) SetStore(name string, namespace string, createDb bool) error

SetStore -

func (*MetricStore) StartSnapshotThread

func (ms *MetricStore) StartSnapshotThread() error

func (*MetricStore) StopSnapshotThread

func (ms *MetricStore) StopSnapshotThread()

func (*MetricStore) TakeGisMetricSnapshot

func (ms *MetricStore) TakeGisMetricSnapshot()
func (gc *GisCache) getMetricsEntryHandler(key string, fields map[string]string, userData interface{}) error {
	// Retrieve field values
	values := make(map[string]interface{})
	for k, v := range fields {
		values[k] = v
	}
	// Append values list to data
	data := userData.(*[]map[string]interface{})
	*data = append(*data, values)

	return nil
}

type MetricsResponseWriter

type MetricsResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

ResponseWriter wrapper to capture status code

func NewMetricsResponseWriter

func NewMetricsResponseWriter(w http.ResponseWriter) *MetricsResponseWriter

func (*MetricsResponseWriter) WriteHeader

func (mrw *MetricsResponseWriter) WriteHeader(code int)

type NetworkMetric

type NetworkMetric struct {
	Src    string
	Dst    string
	Time   interface{}
	Lat    int32
	UlTput float64
	DlTput float64
	UlLoss float64
	DlLoss float64
}

type SandboxMetric

type SandboxMetric struct {
	Time       interface{}
	Name       string
	CreateTime float64
}

type SessionMetric

type SessionMetric struct {
	Time        interface{}
	Provider    string
	User        string
	SessionId   string
	Sandbox     string
	ErrType     string
	Description string
}

Jump to

Keyboard shortcuts

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