types

package
v0.0.0-...-28787c5 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GrafanaLineChart string = "graph"
	GrafanaBarChart  string = "barchart"
	GrafanaCounter   string = "counter"
	GrafanaHeatMap   string = "heatmap"
	GrafanaPieChart  string = "piechart"
	GrafanaBarGauge  string = "bargauge"
)

Variables

This section is empty.

Functions

func FormatTime

func FormatTime(t string, timeFormat string) string

Types

type Alert

type Alert struct {
	Id            int    `json:"id"`
	Name          string `json:"name"`
	AlertOption   `json:"options"`
	State         string `json:"state"`
	LastTriggered string `json:"last_triggered_at"`
	Rearm         int    `json:"rearm"`
	Query         `json:"query"`
	QueryId       int `json:"query_id"`
}

func (*Alert) FormatAlert

func (a *Alert) FormatAlert(time_format string)

func (Alert) GetColumns

func (a Alert) GetColumns() []string

func (Alert) GetTableData

func (a Alert) GetTableData() map[string]string

type AlertOption

type AlertOption struct {
	Column string `json:"column"`
	Op     string `json:"op"`
	Value  int    `json:"value"`
}

type ChartType

type ChartType string
var (
	COUNTER ChartType = "COUNTER"
	CHART   ChartType = "CHART"
	GAUGE   ChartType = "GAUGE"
	TABLE   ChartType = "TABLE"
)

type CreateAlertPayload

type CreateAlertPayload struct {
	Name        string `json:"name"`
	AlertOption `json:"options"`
	Rearm       int `json:"rearm"`
	QueryId     int `json:"query_id"`
}

type CreateQueryPayload

type CreateQueryPayload struct {
	Name           string   `json:"name"`
	Description    string   `json:"description"`
	DatasourceId   int      `json:"data_source_id"`
	Query          string   `json:"query"`
	Tags           []string `json:"tags"`
	QueryOptions   `json:"options"`
	*QuerySchedule `json:"schedule"`
}

type Dashboard

type Dashboard struct {
	Id   int      `json:"id,omitempty"`
	Name string   `json:"name"`
	Tags []string `json:"tags"`
	Slug string   `json:"slug"`
}

type DashboardSpec

type DashboardSpec struct {
	Dashboard   Dashboard             `json:"dashboard"`
	Datasources map[string]Datasource `json:"datasources"`
	Widgets     []Widget              `json:"widgets,omitempty"`
	Alerts      []Alert               `json:"alerts,omitempty"`
}

type Datasource

type Datasource struct {
	Id             int               `json:"id"`
	Name           string            `json:"name"`
	DatasourceType string            `json:"type"`
	Options        DatasourceOptions `json:"options"`
}

type DatasourceOptions

type DatasourceOptions struct {
	Url string `json:"url"`
}

type FieldConfig

type FieldConfig struct {
	Defaults  map[string]interface{}   `json:"defaults"`
	Overrides []map[string]interface{} `json:"overrides"`
}

type Forwarder

type Forwarder struct {
	Config ForwarderConfig `json:"config" yaml:"config"`
	Id     int             `json:"id" yaml:"id"`
	Name   string          `json:"name" yaml:"name"`
	Schema string          `json:"schema" yaml:"schema"`
}

func (Forwarder) GetColumns

func (f Forwarder) GetColumns() []string

func (Forwarder) GetTableData

func (f Forwarder) GetTableData() map[string]string

type ForwarderConfig

type ForwarderConfig struct {
	ApiKey                         string `json:"api_key,omitempty" yaml:"api_key,omitempty" yaml:"api_key,omitempty" yaml:"api_key,omitempty"`
	Host                           string `json:"host,omitempty" yaml:"host,omitempty" yaml:"host,omitempty" yaml:"host,omitempty"`
	Tags                           string `json:"tags,omitempty" yaml:"tags,omitempty" yaml:"tags,omitempty" yaml:"tags,omitempty"`
	Type                           string `json:"type,omitempty" yaml:"type,omitempty" yaml:"type,omitempty" yaml:"type,omitempty"`
	BufferSize                     string `json:"buffer_size,omitempty" yaml:"buffer_size,omitempty" yaml:"buffer_size,omitempty" yaml:"buffer_size,omitempty"`
	Port                           string `json:"port,omitempty" yaml:"port,omitempty"`
	AccessKey                      string `json:"access_key,omitempty" yaml:"access_key,omitempty"`
	Bucket                         string `json:"bucket,omitempty" yaml:"bucket,omitempty"`
	Endpoint                       string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
	FilterForward                  string `json:"filter_forward,omitempty" yaml:"filter_forward,omitempty"`
	FlushToBucketIntervalInSeconds string `json:"flush_to_bucket_interval_in_seconds,omitempty" yaml:"flush_to_bucket_interval_in_seconds,omitempty"`
	MaxObjectSizeInBytes           string `json:"max_object_size_in_bytes,omitempty" yaml:"max_object_size_in_bytes,omitempty"`
	Region                         string `json:"region,omitempty" yaml:"region,omitempty"`
	SecretKey                      string `json:"secret_key,omitempty" yaml:"secret_key,omitempty"`
	Stream                         string `json:"stream,omitempty" yaml:"stream,omitempty"`
	Password                       string `json:"password,omitempty" yaml:"password,omitempty"`
	User                           string `json:"user,omitempty" yaml:"user,omitempty"`
	AccountKey                     string `json:"account_key,omitempty" yaml:"account_key,omitempty"`
	AccountName                    string `json:"account_name,omitempty" yaml:"account_name,omitempty"`
	ContainerName                  string `json:"container_name,omitempty" yaml:"container_name,omitempty"`
	JsonKey                        string `json:"json_key,omitempty" yaml:"json_key,omitempty"`
	Topic                          string `json:"topic,omitempty" yaml:"topic,omitempty"`
	ProjectId                      string `json:"project_id,omitempty" yaml:"project_id,omitempty"`
	ConnectionString               string `json:"connection_string,omitempty" yaml:"connection_string,omitempty"`
	EventHubName                   string `json:"event_hub_name,omitempty" yaml:"event_hub_name,omitempty"`
	ApiToken                       string `json:"apitoken,omitempty" yaml:"apitoken,omitempty"`
	Urls                           string `json:"urls,omitempty" yaml:"urls,omitempty"`
}

type GrafanaDashboard

type GrafanaDashboard struct {
	Inputs     []map[string]string `json:"__inputs"`
	Requires   []map[string]string `json:"__requires"`
	Panels     []GrafanaPanel
	Templating map[string][]GrafanaTemplate
	Title      string `json:"title"`
}

func (*GrafanaDashboard) UnmarshalJSON

func (d *GrafanaDashboard) UnmarshalJSON(data []byte) error

type GrafanaPanel

type GrafanaPanel struct {
	FieldConfig `json:"fieldConfig"`
	GridPos     map[string]int         `json:"gridPos"`
	Targets     []Target               `json:"targets"`
	Title       string                 `json:"title"`
	Type        string                 `json:"type"`
	Options     map[string]interface{} `json:"options"`
	XAxis       map[string]interface{} `json:"xaxis"`
	Format      string                 `json:"format"`
	Datasource  string                 `json:"datasource"`
}

func (*GrafanaPanel) MarshalJson

func (p *GrafanaPanel) MarshalJson() ([]byte, error)

func (*GrafanaPanel) UnmarshalJSON

func (p *GrafanaPanel) UnmarshalJSON(data []byte) error

type GrafanaRow

type GrafanaRow struct {
	Title  string         `json:"title"`
	Panels []GrafanaPanel `json:"panels"`
}

type GrafanaTemplate

type GrafanaTemplate struct {
	Datasource string                   `json:"datasource"`
	Label      string                   `json:"label"`
	Name       string                   `json:"name"`
	Query      interface{}              `json:"query"`
	Refresh    int                      `json:"refresh"`
	Type       string                   `json:"type"`
	Options    []map[string]interface{} `json:"options,omitempty"`
}

func (*GrafanaTemplate) MarshalJson

func (t *GrafanaTemplate) MarshalJson() ([]byte, error)

func (*GrafanaTemplate) UnmarshalJSON

func (t *GrafanaTemplate) UnmarshalJSON(data []byte) error

type JobDetails

type JobDetails struct {
	Error         string    `json:"error"`
	Id            string    `json:"id"`
	QueryResultId int       `json:"query_result_id,omitempty"`
	Status        JobStatus `json:"status"`
}

type JobStatus

type JobStatus int
const (
	READY      JobStatus = 1 << iota
	PROCESSING JobStatus = iota + 1
	FINISHED   JobStatus = iota + 1
	ERROR      JobStatus = iota + 1
)

type Mapping

type Mapping struct {
	Application string `json:"application"`
	Createts    int    `json:"createts"`
	Name        string `json:"name"`
	ID          int    `json:"id"`
	Namespace   string `json:"namespace"`
	Updatets    int    `json:"updatets"`
}

func (Mapping) GetColumns

func (m Mapping) GetColumns() []string

func (Mapping) GetTableData

func (m Mapping) GetTableData() map[string]string

type Query

type Query struct {
	Id                int      `json:"id,omitempty"`
	LatestQueryDataId int      `json:"latest_query_data_id,omitempty"`
	Name              string   `json:"name"`
	Description       string   `json:"description"`
	Query             string   `json:"query"`
	IsArchived        bool     `json:"is_archived"`
	IsDraft           bool     `json:"is_draft"`
	DataSourceId      int      `json:"data_source_id,omitempty"`
	Version           int      `json:"version"`
	Tags              []string `json:"tags"`
	QueryOptions      `json:"options"`
	*QuerySchedule    `json:"schedule"`
}

type QueryOptions

type QueryOptions struct {
	Parameters []map[string]interface{} `json:"parameters"`
}

type QueryResult

type QueryResult struct {
	Id           int               `json:"id,omitempty"`
	DataSourceId int               `json:"data_source_id"`
	Query        string            `json:"query"`
	Data         QueryResultData   `json:"data,omitempty"`
	Runtime      float64           `json:"runtime,omitempty"`
	RetrievedAt  string            `json:"retrieved_at,omitempty"`
	Parameters   map[string]string `json:"parameters"`
	MaxAge       int               `json:"max_age"`
	QueryHash    string            `json:"query_hash"`
}

type QueryResultColumn

type QueryResultColumn struct {
	FriendlyName string `json:"friendly_name"`
	Name         string `json:"name"`
	Type         string `json:"type"`
}

type QueryResultData

type QueryResultData struct {
	Columns   []*QueryResultColumn `json:"columns"`
	Rows      []*map[string]string `json:"rows"`
	Processed bool                 `json:"-"`
}

type QuerySchedule

type QuerySchedule struct {
	DayOfWeek string `json:"day_of_week"`
	Interval  int    `json:"interval"`
	Time      string `json:"time"`
	Until     string `json:"until"`
}

type Resource

type Resource interface {
	GetTableData() map[string]string
	GetColumns() []string
}

type Target

type Target struct {
	Datasource   map[string]string `json:"datasource"`
	Query        string            `json:"expr"`
	Interval     string            `json:"interval"`
	LegendFormat string            `json:"legendFormat"`
	Metric       string            `json:"metric"`
}

type Visualization

type Visualization struct {
	Id          int                    `json:"id,omitempty"`
	Name        string                 `json:"name"`
	Type        ChartType              `json:"type"`
	Description string                 `json:"description"`
	Options     map[string]interface{} `json:"options"`
	*Query      `json:"query"`
}

type VisualizationPayload

type VisualizationPayload struct {
	Name    string                 `json:"name"`
	Type    ChartType              `json:"type"`
	Options map[string]interface{} `json:"options"`
	Query   `json:"query"`
}

type VisualizationScale

type VisualizationScale struct {
	Width  float64
	Height float64
	Y      float64
}

func GetVisualizationScale

func GetVisualizationScale() VisualizationScale

type Widget

type Widget struct {
	Id             int                    `json:"id,omitempty"`
	Text           string                 `json:"text"`
	Width          int                    `json:"width"`
	Options        map[string]interface{} `json:"options"`
	*Visualization `json:"visualization"`
	Type           string `json:"type,omitempty"`
}

type WidgetOptions

type WidgetOptions struct {
	IsHidden          bool                         `json:"isHidden"`
	ParameterMappings map[string]map[string]string `json:"parameterMappings"`
	Position          map[string]interface{}       `json:"position"`
}

type WidgetParameterMappings

type WidgetParameterMappings struct {
	MapTo string `json:"mapTo"`
	Name  string `json:"name"`
	Title string `json:"title"`
	Type  string `json:"type"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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