Documentation ¶
Index ¶
- Constants
- type Check
- func (c *Check) BrokerTLSConfig() (*tls.Config, error)
- func (c *Check) EncodeMetricStreamTags(tags Tags) string
- func (c *Check) EncodeMetricTags(tags Tags) []string
- func (c *Check) MetricNameWithStreamTags(metric string, tags Tags) string
- func (c *Check) RefreshCheck() error
- func (c *Check) ReportError(err error)
- func (c *Check) SubmitMetrics(metricSrc io.Reader) error
- func (c *Check) WriteMetricSample(metricDest io.Writer, metricName, metricType string, value interface{}, ...) error
- type Config
- type ServiceConfig
- type Tag
- type Tags
Constants ¶
const ( // MetricTypeInt32 reconnoiter. MetricTypeInt32 = "i" // MetricTypeUint32 reconnoiter. MetricTypeUint32 = "I" // MetricTypeInt64 reconnoiter. MetricTypeInt64 = "l" // MetricTypeUint64 reconnoiter. MetricTypeUint64 = "L" // MetricTypeFloat64 reconnoiter. MetricTypeFloat64 = "n" // MetricTypeString reconnoiter. MetricTypeString = "s" // MaxTags reconnoiter will accept in stream tagged metric name. MaxTags = 256 // sync w/MAX_TAGS https://github.com/circonus-labs/reconnoiter/blob/master/src/noit_metric.h#L41 // MaxMetricNameLen reconnoiter will accept (name+stream tags). MaxMetricNameLen = 4096 // sync w/MAX_METRIC_TAGGED_NAME https://github.com/circonus-labs/reconnoiter/blob/master/src/noit_metric.h#L40 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Check ¶
Check defines a Circonus check for a circonus-cloud-agent service.
func NewCheck ¶
NewCheck creates a new Circonus check instance based on the Config options passed to initialize the Circonus API, check and broker.
func (*Check) BrokerTLSConfig ¶
BrokerTLSConfig returns the broker tls configuration for metric submissions or nil if tls config not needed (e.g. public trap broker).
func (*Check) EncodeMetricStreamTags ¶
EncodeMetricStreamTags encodes Tags into a string suitable for use with stream tags. Tags directly embedded into metric names using the `metric_name|ST[<tags>]` syntax. Note: legacy tags support bare values, stream tags require a cateogry and a value. Additionally, all spaces are removed from stream tag categories and values.
func (*Check) EncodeMetricTags ¶
EncodeMetricTags encodes Tags into an array of strings. The format check_bundle.metircs.metric.tags needs. This helper is intended to work with legacy check bundle metrics.
func (*Check) MetricNameWithStreamTags ¶
MetricNameWithStreamTags will encode tags as stream tags into supplied metric name. Note: if metric name already has stream tags it is assumed the metric name and embedded stream tags are being managed manually and calling this method will nave no effect.
func (*Check) RefreshCheck ¶
RefreshCheck fetches a new copy of the check bundle and broker from Circonus API. Primary use-case is when a check is moved from one broker to another, metric submits will fail. Refreshing the check bundle will obtain the new submission url, and reconfigure the broker tls config (if needed).
func (*Check) SubmitMetrics ¶
SubmitMetrics to Circonus check.
type Config ¶
type Config struct { ID string // a unique identifier, used to search for a check bundle CheckBundleID string // a specific check bundle cid to use BrokerCID string // broker cid to use (default circonus public broker) BrokerCAFile string // broker ca file DisplayName string // display name to use for check bundle (when searching or creating) Tags string // tags to add to a check when creating APIKey string // Circonus API Token key APIApp string // Circonus API Token app APIURL string // Circonus API URL APICAFile string // api ca file Logger zerolog.Logger // logging instance to use Debug bool // turn on debugging messages TraceMetrics bool // output each metric as it is sent }
Config options for a Circonus Check passed to New method.
type ServiceConfig ¶
type ServiceConfig struct { CID string `json:"cid" toml:"cid" yaml:"cid"` // OPTIONAL, cid of specific check bundle to use BrokerCID string `json:"broker_cid" toml:"broker_cid" yaml:"broker_cid"` // OPTIONAL, default public trap broker App string `json:"app" toml:"app" yaml:"app"` // REQUIRED Key string `json:"key" toml:"key" yaml:"key"` // REQUIRED URL string `json:"url" toml:"url" yaml:"url"` // DEFAULT 'https://api.circonus.com/v2/' CAFile string `json:"ca_file" toml:"ca_file" yaml:"ca_file"` // DEFAULT api.circonus.com uses a public certificate Debug bool `json:"debug" toml:"debug" yaml:"debug"` // DEFAULT false - this is separate so that the global debug does not inundate logs with cgm debug messages from each cloud service metric collection client TraceMetrics bool `json:"trace_metrics" toml:"trace_metrics" yaml:"trace_metrics"` // DEFAULT false - output each metric as it is sent }
ServiceConfig defines the Circonus configuration for a cloud service to include.