client

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Okay = iota
	Warning
	Critical
	Unknown
)

DDServiceCheck Status values

View Source
const (
	AlertError   = AlertType("error")
	AlertWarning = AlertType("warning")
	AlertInfo    = AlertType("info")
	AlertSuccess = AlertType("success")
)

DDEvent AlertType values

View Source
const (
	PriorityNormal = Priority("normal")
	PriorityLow    = Priority("low")
)

DDEvent Priority values

View Source
const (
	Count = "count"
	Rate  = "rate"
	Gauge = "gauge"
)

DDMetric Type values

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient interface {
	SendSeries(*DDMetricSeries) error
	SendServiceCheck(*DDServiceCheck) error
	SendEvent(*DDEvent) error
	SetHTTPClient(HTTPClient)
}

type AlertType

type AlertType string

type DDApiResponse

type DDApiResponse struct {
	Errors []string `json:"errors"`
}

type DDClient

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

func NewDDClient

func NewDDClient(apiKey string) *DDClient

func (*DDClient) SendEvent

func (c *DDClient) SendEvent(event *DDEvent) error

func (*DDClient) SendSeries

func (c *DDClient) SendSeries(series *DDMetricSeries) error

func (*DDClient) SendServiceCheck

func (c *DDClient) SendServiceCheck(check *DDServiceCheck) error

func (*DDClient) SetHTTPClient

func (c *DDClient) SetHTTPClient(client HTTPClient)

type DDEvent

type DDEvent struct {
	AggregationKey string    `json:"aggregation_key"`
	AlertType      AlertType `json:"alert_type"`
	DateHappened   int64     `json:"date_happened"`
	DeviceName     string    `json:"device_name"`
	Host           string    `json:"host"`
	Priority       Priority  `json:"priority"`
	RelatedEventID int64     `json:"related_event_id"`
	SourceTypeName string    `json:"source_type_name"`
	Tags           []string  `json:"tags"`
	Title          string    `json:"title"`
}

type DDMetric

type DDMetric struct {
	Host     string           `json:"host"`
	Interval int64            `json:"interval"`
	Metric   string           `json:"metric"`
	Points   [][2]interface{} `json:"points"`
	Tags     []string         `json:"tags"`
	Type     string           `json:"type"`
}

type DDMetricSeries

type DDMetricSeries struct {
	Series []*DDMetric `json:"series"`
}

type DDServiceCheck

type DDServiceCheck struct {
	Check     string   `json:"check"`
	Hostname  string   `json:"host_name"`
	Message   string   `json:"message"`
	Status    Status   `json:"status"`
	Tags      []string `json:"tags"`
	Timestamp int64    `json:"timestamp"`
}

type HTTPClient

type HTTPClient interface {
	Post(url, contentType string, body io.Reader) (resp *http.Response, err error)
}

type Priority

type Priority string

type Status

type Status int

Jump to

Keyboard shortcuts

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