forwarder

package module
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: MIT Imports: 21 Imported by: 0

README

mackerel-cloudwatch-forwarder

Forward metrics of AWS CloudWatch to Mackerel

WARNING

This software is under the heavy development and considered ALPHA quality till the version hits v1.0.0. Things might be broken, not all features have been implemented, and APIs will be likely to change. YOU HAVE BEEN WARNED.

Documentation

Overview

Code generated by generate.sh; DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToMetricDataQuery added in v0.0.10

func ToMetricDataQuery(query []*Query) ([]types.MetricDataQuery, map[string]float64, error)

ToMetricDataQuery converts the query to (cloudwatch/types).MetricDataQuery.

Types

type Error

type Error struct {
	StatusCode int
	Message    string
}

Error is an error from the Mackerel.

func (Error) Error

func (e Error) Error() string

func (Error) Temporary added in v0.0.12

func (e Error) Temporary() bool

type Forwarder

type Forwarder struct {
	Config aws.Config

	APIURL string

	// APIKey is api key for the Mackerel.
	// If it empty, the MACKEREL_APIKEY environment value is used.
	// The priority is APIKey, APIKeyParameter, MACKEREL_APIKEY, and the MACKEREL_APIKEY_PARAMETER.
	APIKey string

	// APIKeyParameter is a name of AWS Systems Manager Parameter Store for the Mackerel api key.
	// If it empty, the MACKEREL_APIKEY_PARAMETER environment value is used.
	// The priority is APIKey, APIKeyParameter, MACKEREL_APIKEY, and the MACKEREL_APIKEY_PARAMETER.
	APIKeyParameter string

	// APIKeyWithDecrypt means the Mackerel API key is encrypted.
	// If it is true, the Forwarder decrypts the API key.
	// If not, the MACKEREL_APIKEY_WITH_DECRYPT environment value is used.
	APIKeyWithDecrypt bool
	// contains filtered or unexported fields
}

Forwarder forwards metrics of AWS CloudWatch to Mackerel

func (*Forwarder) ForwardMetrics

func (f *Forwarder) ForwardMetrics(ctx context.Context, data json.RawMessage) error

ForwardMetrics forwards metrics of AWS CloudWatch to Mackerel

type HostMetricValue

type HostMetricValue struct {
	HostID string  `json:"hostId"`
	Name   string  `json:"name"`
	Time   int64   `json:"time"`
	Value  float64 `json:"value"`
}

HostMetricValue is a value of Mackerel's host metric.

type Label added in v0.0.6

type Label struct {
	Service    string
	HostID     string
	MetricName string
}

Label is a label for metrics.

func ParseLabel added in v0.0.6

func ParseLabel(s string) (Label, error)

ParseLabel parses a label.

func (Label) String added in v0.0.10

func (l Label) String() string

type MackerelClient

type MackerelClient struct {
	BaseURL     *url.URL
	APIKey      string
	UserAgent   string
	HTTPClient  *http.Client
	RetryPolicy retry.Policy
}

MackerelClient is a tiny client for Mackerel.

func NewMackerelClient added in v0.0.12

func NewMackerelClient(apiKey string) *MackerelClient

NewMackerelClient creates a new MackerelClient.

func (*MackerelClient) PostHostMetricValues

func (c *MackerelClient) PostHostMetricValues(ctx context.Context, values []HostMetricValue) error

PostHostMetricValues posts host metrics.

func (*MackerelClient) PostServiceMetricValues

func (c *MackerelClient) PostServiceMetricValues(ctx context.Context, serviceName string, values []ServiceMetricValue) error

PostServiceMetricValues posts service metrics.

type Query added in v0.0.10

type Query struct {
	Service string        `json:"service,omitempty"`
	Host    string        `json:"host,omitempty"`
	Name    string        `json:"name,omitempty"`
	Metric  []interface{} `json:"metric,omitempty"`
	Stat    string        `json:"stat,omitempty"`
	Default *float64      `json:"default,omitempty"`
}

Query is a query for AWS CloudWatch.

type ServiceMetricValue

type ServiceMetricValue struct {
	Name  string  `json:"name"`
	Time  int64   `json:"time"`
	Value float64 `json:"value"`
}

ServiceMetricValue is a value of Mackerel's service metric.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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