flows

package
v0.0.0-...-9fcd7d3 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FLOW_START    = "start"
	FLOW_EVENT    = "event"
	FLOW_SLOW     = "slow"
	FLOW_CPU      = "cpu"
	FLOW_CPU_SYS  = "cpu_sys"
	FLOW_CPU_USER = "cpu_user"
	FLOW_RUNQ     = "runq"
	FLOW_NET      = "net"
	FLOW_EPOLL    = "epoll"
	FLOW_STOP     = "stop"
)
View Source
const (
	ReportActionTypeProm = "promql"
	ReportActionTypeEs   = "es"

	ReportTypeTimeSeries = "metrics_timeseries"

	ResultPromTypeMatrix = "matrix"

	ChartTypeLine = "line"
)
View Source
const (
	RULE_CPU_STEAL         = "cpu_steal"
	RULE_CPU_CFS_THROTTLED = "cpu_cfs_throttled"
	RULE_NODE_THROUGHPUT   = "node_throughput"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckFn

type CheckFn func(facts *Facts) bool

Match

type Conclusion

type Conclusion struct {
	Message string `json:"message"`
}

type ExecuteFn

type ExecuteFn func(facts *Facts) error

Execute Flow

type Facts

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

func NewFacts

func NewFacts() *Facts

func (*Facts) AddBoolValue

func (facts *Facts) AddBoolValue(key string, value bool)

func (*Facts) AddIntValue

func (facts *Facts) AddIntValue(key string, value int64)

func (*Facts) AddReport

func (facts *Facts) AddReport(report *Report)

func (*Facts) AddStringValue

func (facts *Facts) AddStringValue(key string, value string)

func (*Facts) GetApmTrace

func (facts *Facts) GetApmTrace() *trace.OTelTrace

func (*Facts) GetBoolValue

func (facts *Facts) GetBoolValue(key string) bool

func (*Facts) GetFlowId

func (facts *Facts) GetFlowId() uint64

func (*Facts) GetIntValue

func (facts *Facts) GetIntValue(key string) int64

func (*Facts) GetProfiles

func (facts *Facts) GetProfiles() *model.Profiles

func (*Facts) GetReport

func (facts *Facts) GetReport() *Report

func (*Facts) GetReports

func (facts *Facts) GetReports() *Reports

func (*Facts) GetStringValue

func (facts *Facts) GetStringValue(key string) string

func (*Facts) GetTrace

func (facts *Facts) GetTrace() *model.Trace

func (*Facts) GetTraces

func (facts *Facts) GetTraces() *model.Traces

func (*Facts) HasReport

func (facts *Facts) HasReport() bool

func (*Facts) SetApmTrace

func (facts *Facts) SetApmTrace(apmTrace *trace.OTelTrace)

func (*Facts) SetProfiles

func (facts *Facts) SetProfiles(profiles *model.Profiles)

func (*Facts) SetTrace

func (facts *Facts) SetTrace(trace *model.Trace)

func (*Facts) SetTraces

func (facts *Facts) SetTraces(traces *model.Traces)

type Flow

type Flow struct {
	Name    string
	Check   CheckFn
	Execute ExecuteFn
}

func NewFlow

func NewFlow(name string, check CheckFn, execute ExecuteFn) *Flow

type FlowNode

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

func NewFlowNode

func NewFlowNode(flow *Flow) *FlowNode

func (*FlowNode) AddChild

func (node *FlowNode) AddChild(child *FlowNode)

func (*FlowNode) AddRule

func (node *FlowNode) AddRule(rule Rule, next *FlowNode)

func (*FlowNode) GetName

func (node *FlowNode) GetName() string

func (*FlowNode) Run

func (node *FlowNode) Run(fact *Facts) string

type Metadata

type Metadata struct {
	Timestamp uint64 `json:"timestamp"`
	Node      string `json:"node"`
}

type MetricType

type MetricType int
const (
	MetricNone MetricType = iota
	MetricTimeSeries
	MetricBaseLines
)

type Report

type Report struct {
	FlowName   string                  `json:"flow_name,omitempty"`
	ReportName string                  `json:"report_name"`
	Type       string                  `json:"type"`
	Chart      string                  `json:"chart"`
	Source     string                  `json:"source"`
	Request    string                  `json:"request"`
	Metrics    map[string]ReportMetric `json:"metrics"`
	Text       map[string]string       `json:"text"`
	Conclusion string                  `json:"conclusion"`
	Timestamp  uint64                  `json:"timestamp"`
}

func NewReport

func NewReport(flowName string, reportName string, reportType string, chart string, source string, timestamp uint64) *Report

func (*Report) AddMetrics

func (report *Report) AddMetrics(key string, metric ReportMetric) *Report

func (*Report) AddText

func (report *Report) AddText(key string, value string) *Report

func (*Report) SetConclusion

func (report *Report) SetConclusion(conclustion string) *Report

func (*Report) SetRequest

func (report *Report) SetRequest(request string) *Report

type ReportAction

type ReportAction struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

type ReportBaseLineMetric

type ReportBaseLineMetric struct {
	Labels   map[string]string `json:"labels"`
	BaseLine *ReportValue      `json:"baseline"`
	Current  *ReportValue      `json:"current"`
	Unit     string            `json:"unit"`
	IsWarn   bool              `json:"is_warn"`
}

type ReportBaseLineMetrics

type ReportBaseLineMetrics []*ReportBaseLineMetric

func NewReportBaseLineMetricsWithMetrics

func NewReportBaseLineMetricsWithMetrics(metrics []*ReportBaseLineMetric) ReportBaseLineMetrics

func (ReportBaseLineMetrics) Type

func (metric ReportBaseLineMetrics) Type() MetricType

type ReportMetric

type ReportMetric interface {
	Type() MetricType
}

type ReportTimeSeriesMetric

type ReportTimeSeriesMetric struct {
	Action     *ReportAction `json:"action"`
	ResultType string        `json:"resultType"`
	Result     model.Matrix  `json:"result"`
}

func (*ReportTimeSeriesMetric) Type

func (metric *ReportTimeSeriesMetric) Type() MetricType

type ReportValue

type ReportValue struct {
	Action *ReportAction `json:"action"`
	Value  float64       `json:"value"`
}

func NewReportAction

func NewReportAction(actionType string, text string, value float64) *ReportValue

func NewReportValue

func NewReportValue(value float64) *ReportValue

type Reports

type Reports struct {
	Metadata   *Metadata   `json:"metadata"`
	Conclusion *Conclusion `json:"conclusion"`
	Reports    []*Report   `json:"reports"`
}

func NewReports

func NewReports() *Reports

func (*Reports) AddConclusion

func (reports *Reports) AddConclusion(message string) *Reports

func (*Reports) AddMetaData

func (reports *Reports) AddMetaData(timestamp uint64, node string) *Reports

func (*Reports) AddReport

func (reports *Reports) AddReport(report *Report) *Reports

func (*Reports) GetJson

func (reports *Reports) GetJson() string

func (*Reports) GetReport

func (reports *Reports) GetReport() *Report

type Result

type Result struct {
	Result string `json:"result"`
}

func (*Result) SetResult

func (result *Result) SetResult(value string)

type Rule

type Rule interface {
	// Get Rule Name
	GetName() string
	// Match Rule
	Evaluate(facts *Facts) bool
	// Execute Rule
	Execute(facts *Facts) error
}

Directories

Path Synopsis
cpu
sys

Jump to

Keyboard shortcuts

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