Documentation
¶
Overview ¶
Package cloudhealth contains routines for writing to cloud health
Index ¶
Constants ¶
const (
// Default endpoint for cloudhealth service.
DefaultEndpoint = "https://chapi.cloudhealthtech.com/metrics/v1"
)
const FsDataPointCount = 9 // 3 variables * (min,max,avg)
const InstanceDataPointCount = 12 // 4 variables * (min,max,avg)
const MaxDataPoints = 1000
Maximum datapoints that can be written to cloudhealth at once
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer buffers data to add to cloudhealth
func (*Buffer) Add ¶
func (b *Buffer) Add(instance InstanceData, fss []FsData) bool
Add adds an instance and its file systems returning true if the add succeeded. Add returns false if adding the instance and the filesystem would cause the number of data points to exceed the cloudhealth limit.
func (*Buffer) Clear ¶
func (b *Buffer) Clear()
Clear clears this buffer so that IsEmpty returns true
func (*Buffer) Get ¶
func (b *Buffer) Get() ([]InstanceData, []FsData)
Get returns a defensive copy of what is in this buffer
type Config ¶
type Config struct { ApiKey string `yaml:"apiKey"` DataCenter string `yaml:"dataCenter"` // e.g us-east-1 AccountNumber string `yaml:"accountNumber"` // default account number DryRun bool `yaml:"dryRun"` // If true, runs in dry run mode // like "http://somehost.com:1234/endpoint" If omitted, defaults to // standard endpoint for cloudhealth. Endpoint string `yaml:"endpoint"` }
Config configures the writer
func (*Config) UnmarshalYAML ¶
type FVariable ¶
FVariable represents a floating point cloudhealth variable rolled up over some amount of time
type FsData ¶
type FsData struct { AccountNumber string // account number if different from default InstanceId string // the aws instance ID MountPoint string // The mount point of file system Ts time.Time // The timestamp at one hour granularity FsSizeBytes IVariable FsUsedBytes IVariable FsUsedPercent FVariable }
FsData contains rolled up data for a particular file system
type IVariable ¶
IVariable represents an integer cloudhealth variable rolled up over some amount of time
type InstanceData ¶
type InstanceData struct { AccountNumber string // account number if different from default InstanceId string // The aws instance ID Ts time.Time // The timestamp at one hour granularity CpuUsedPercent FVariable MemoryFreeBytes IVariable MemorySizeBytes IVariable MemoryUsedPercent FVariable }
InstanceData contains rolled up data for a particular instance
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
func (*Writer) Write ¶
func (w *Writer) Write( instances []InstanceData, fss []FsData) ( responseCode int, err error)
Write writes the provided data in a single request. Write returns an error if the number of data points exceeds 1000. That is, len(instances)*InstanceDataPointCount + len(fss)*FsDataPointCount >= 1000. Write returns the http response code along with an error if applicable. If the write is parital success, Write returns 200 along with the error. Write will never return a 429 response. If Write receives a 429, it retries using exponential backoff internally until it receives a non 429 response and returns that.