models

package
v2.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2020 License: AGPL-3.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type M

type M map[string]interface{}

M is map for interfaces.

type Metrics

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

Metrics represents methods to work with metrics.

func NewMetrics

func NewMetrics(db *sqlx.DB) Metrics

NewMetrics initialize Metrics with db instance.

func (*Metrics) Get

func (m *Metrics) Get(ctx context.Context, periodStartFromSec, periodStartToSec int64, filter, group string,
	dimensions, labels map[string][]string) ([]M, error)

Get select metrics for specific queryid, hostname, etc.

func (*Metrics) SelectObjectDetailsLabels

func (m *Metrics) SelectObjectDetailsLabels(ctx context.Context, periodStartFrom, periodStartTo time.Time, filter,
	group string) (*qanpb.ObjectDetailsLabelsReply, error)

SelectObjectDetailsLabels selects object details labels for given time range and object.

func (*Metrics) SelectQueryExamples

func (m *Metrics) SelectQueryExamples(ctx context.Context, periodStartFrom, periodStartTo time.Time, filter,
	group string, limit uint32, dimensions, labels map[string][]string) (*qanpb.QueryExampleReply, error)

SelectQueryExamples selects query examples and related stuff for given time range.

func (*Metrics) SelectSparklines

func (m *Metrics) SelectSparklines(ctx context.Context, periodStartFromSec, periodStartToSec int64,
	filter, group string, dimensions, labels map[string][]string) ([]*qanpb.Point, error)

SelectSparklines selects datapoint for sparklines.

type MetricsBucket

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

MetricsBucket implements models to store metrics bucket

func NewMetricsBucket

func NewMetricsBucket(db *sqlx.DB) *MetricsBucket

NewMetricsBucket initialize MetricsBucket with db instance.

func (*MetricsBucket) Collect

func (mb *MetricsBucket) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector interface.

func (*MetricsBucket) Describe

func (mb *MetricsBucket) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector interface.

func (*MetricsBucket) Run

func (mb *MetricsBucket) Run(ctx context.Context)

Run stores incoming data until context is canceled. It exits when all data is stored.

func (*MetricsBucket) Save

func (mb *MetricsBucket) Save(agentMsg *qanpb.CollectRequest) error

Save store metrics bucket received from agent into db.

type MetricsBucketExtended

type MetricsBucketExtended struct {
	PeriodStart      time.Time `json:"period_start_ts"`
	AgentType        string    `json:"agent_type_s"`
	ExampleType      string    `json:"example_type_s"`
	ExampleFormat    string    `json:"example_format_s"`
	LabelsKey        []string  `json:"labels_key"`
	LabelsValues     []string  `json:"labels_value"`
	WarningsCode     []uint64  `json:"warnings_code"`
	WarningsCount    []uint64  `json:"warnings_count"`
	ErrorsCode       []uint64  `json:"errors_code"`
	ErrorsCount      []uint64  `json:"errors_count"`
	IsQueryTruncated uint8     `json:"is_query_truncated"` // uint32 -> uint8
	*qanpb.MetricsBucket
}

MetricsBucketExtended extends proto MetricsBucket to store converted data into db.

type Reporter

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

Reporter implements models to select metrics bucket by params.

func NewReporter

func NewReporter(db *sqlx.DB) Reporter

NewReporter initialize Reporter with db instance.

func (*Reporter) Select

func (r *Reporter) Select(ctx context.Context, periodStartFromSec, periodStartToSec int64,
	dimensions map[string][]string, labels map[string][]string,
	group, order string, offset, limit uint32,
	specialColumns, commonColumns, sumColumns []string) ([]M, error)

Select select metrics for report.

func (*Reporter) SelectFilters

func (r *Reporter) SelectFilters(ctx context.Context, periodStartFromSec, periodStartToSec int64, mainMetricName string, dimensions, labels map[string][]string) (*qanpb.FiltersReply, error)

SelectFilters selects dimension and their values, and also keys and values of labels.

func (*Reporter) SelectSparklines

func (r *Reporter) SelectSparklines(ctx context.Context, dimensionVal string,
	periodStartFromSec, periodStartToSec int64,
	dimensions map[string][]string, labels map[string][]string,
	group string, column string) ([]*qanpb.Point, error)

SelectSparklines selects datapoint for sparklines.

Jump to

Keyboard shortcuts

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