metrics

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Anodot20Client added in v0.0.2

type Anodot20Client struct {
	ServerURL *url.URL
	Token     string
	// contains filtered or unexported fields
}
Anodot 2.0 Metrics client.

See more details at https://support.anodot.com/hc/en-us/articles/360020259354-Posting-2-0-Metrics-

func NewAnodot20Client added in v0.0.2

func NewAnodot20Client(anodotURL url.URL, apiToken string, httpClient *http.Client) (*Anodot20Client, error)

Constructs new Anodot 2.0 submitter which should be used to send metrics to Anodot.

func (*Anodot20Client) AnodotURL added in v0.0.2

func (s *Anodot20Client) AnodotURL() *url.URL

func (*Anodot20Client) DeleteMetrics added in v0.0.2

func (s *Anodot20Client) DeleteMetrics(expressions ...DeleteExpression) (AnodotResponse, error)

func (*Anodot20Client) FlushMetricsBucket added in v0.0.11

func (s *Anodot20Client) FlushMetricsBucket(metrics []Anodot20Metric, rollup string, loc *time.Location) (AnodotResponse, error)

DO NOT USE THIS METHOD. USED FOR INTERNAL PURPOSES

func (*Anodot20Client) SubmitMetrics added in v0.0.2

func (s *Anodot20Client) SubmitMetrics(metrics []Anodot20Metric) (AnodotResponse, error)

func (*Anodot20Client) SubmitMonitoringMetrics added in v0.0.8

func (s *Anodot20Client) SubmitMonitoringMetrics(metrics []Anodot20Metric) (AnodotResponse, error)

type Anodot20Metric

type Anodot20Metric struct {
	Properties map[string]string `json:"properties"`
	Timestamp  AnodotTimestamp   `json:"timestamp"`
	Value      float64           `json:"value"`
	Tags       map[string]string `json:"tags"`
}

func (*Anodot20Metric) MarshalJSON added in v0.0.3

func (m *Anodot20Metric) MarshalJSON() ([]byte, error)

type AnodotResponse

type AnodotResponse interface {
	HasErrors() bool
	ErrorMessage() string
	RawResponse() *http.Response
}

type AnodotTimestamp

type AnodotTimestamp struct {
	time.Time
}

func (AnodotTimestamp) MarshalJSON

func (t AnodotTimestamp) MarshalJSON() ([]byte, error)

type CreateResponse added in v0.0.2

type CreateResponse struct {
	Errors []struct {
		Description string
		Error       int64
		Index       string
	} `json:"errors"`
	HttpResponse *http.Response `json:"-"`
}

Anodot server response. See more at: https://app.swaggerhub.com/apis/Anodot/metrics_protocol_2.0/1.0.0#/ErrorResponse

func (*CreateResponse) ErrorMessage added in v0.0.2

func (r *CreateResponse) ErrorMessage() string

func (*CreateResponse) HasErrors added in v0.0.2

func (r *CreateResponse) HasErrors() bool

func (*CreateResponse) RawResponse added in v0.0.2

func (r *CreateResponse) RawResponse() *http.Response

type DeleteExpression added in v0.0.2

type DeleteExpression struct {
	Type  string `json:"type"`
	Key   string `json:"key"`
	Value string `json:"value"`
}

type DeleteResponse added in v0.0.2

type DeleteResponse struct {
	ID         string `json:"id"`
	Validation struct {
		Passed   bool `json:"passed"`
		Failures []struct {
			ID      int    `json:"id"`
			Message string `json:"message"`
		} `json:"failures"`
	} `json:"validation"`
	HttpResponse *http.Response `json:"-"`
}

func (*DeleteResponse) ErrorMessage added in v0.0.2

func (a *DeleteResponse) ErrorMessage() string

func (*DeleteResponse) HasErrors added in v0.0.2

func (a *DeleteResponse) HasErrors() bool

func (*DeleteResponse) RawResponse added in v0.0.2

func (a *DeleteResponse) RawResponse() *http.Response

type Submitter

type Submitter interface {
	SubmitMetrics(metrics []Anodot20Metric) (AnodotResponse, error)
	AnodotURL() *url.URL
}

Jump to

Keyboard shortcuts

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