Documentation ¶
Index ¶
- func BatchMeasurements(prepChan <-chan []*Measurement, pushChan chan<- []*Measurement, ...)
- func PersistBatches(lc ServiceAccessor, pushChan <-chan []*Measurement, stopChan <-chan struct{}, ...)
- type Client
- type ErrorResponse
- type Measurement
- type MeasurementPayload
- type MeasurementTags
- type MeasurementsCommunicator
- type MeasurementsService
- type ServiceAccessor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BatchMeasurements ¶
func BatchMeasurements(prepChan <-chan []*Measurement, pushChan chan<- []*Measurement, stopChan <-chan struct{}, batchSize int, logger adapter.Logger)
BatchMeasurements reads slices of Measurement types off a channel populated by the web handler and packages them into batches conforming to the limitations imposed by the API.
func PersistBatches ¶
func PersistBatches(lc ServiceAccessor, pushChan <-chan []*Measurement, stopChan <-chan struct{}, logger adapter.Logger)
PersistBatches reads maximal slices of Measurement types off a channel and persists them to the remote AppOptics API. Errors are placed on the error channel.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements ServiceAccessor
func (*Client) Do ¶
Do performs the HTTP request on the wire, taking an optional second parameter for containing a response
func (*Client) MeasurementsService ¶
func (c *Client) MeasurementsService() MeasurementsCommunicator
MeasurementsService represents the subset of the API that deals with AppOptics Measurements
type ErrorResponse ¶
type ErrorResponse struct {
// Errors holds the error information from the API
Errors interface{} `json:"errors"`
}
ErrorResponse represents the response body returned when the API reports an error
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
Error makes ErrorResponse satisfy the error interface and can be used to serialize error responses back to the client
type Measurement ¶
type Measurement struct { // Name is the name of the Metric this Measurement is associated with Name string `json:"name"` // Tags add dimensionality to data, similar to Labels in Prometheus Tags MeasurementTags `json:"tags,omitempty"` // Time is the UNIX epoch timestamp of the Measurement Time int64 `json:"time"` // Value is the value of the Value float64 `json:"value"` }
Measurement corresponds to the AppOptics API type of the same name TODO: support the full set of Measurement fields
type MeasurementPayload ¶
type MeasurementPayload struct {
Measurements []*Measurement `json:"measurements"`
}
MeasurementPayload is the construct we POST to the API
type MeasurementTags ¶
MeasurementTags is used to store the tags (labels)
type MeasurementsCommunicator ¶
type MeasurementsCommunicator interface {
Create([]*Measurement) (*http.Response, error)
}
MeasurementsCommunicator defines an interface for communicating with the Measurements portion of the AppOptics API
type MeasurementsService ¶
type MeasurementsService struct {
// contains filtered or unexported fields
}
MeasurementsService implements MeasurementsCommunicator
func (*MeasurementsService) Create ¶
func (ms *MeasurementsService) Create(mc []*Measurement) (*http.Response, error)
Create persists the given MeasurementCollection to AppOptics
type ServiceAccessor ¶
type ServiceAccessor interface { // MeasurementsService implements an interface for dealing with Measurements MeasurementsService() MeasurementsCommunicator }
ServiceAccessor defines an interface for talking to AppOptics via domain-specific service constructs