istio: Index | Files

package appoptics

import ""


Package Files

batching.go client.go measurements.go

func BatchMeasurements Uses

func BatchMeasurements(prepChan <-chan []*Measurement,
    pushChan chan<- []*Measurement, stopChan <-chan struct{}, batchSize int)

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 Uses

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.

type Client Uses

type Client struct {
    // contains filtered or unexported fields

Client implements ServiceAccessor

func NewClient Uses

func NewClient(token string, logger adapter.Logger) *Client

NewClient creates a new client to interact with appoptics

func (*Client) Do Uses

func (c *Client) Do(req *http.Request, respData interface{}) (*http.Response, error)

Do performs the HTTP request on the wire, taking an optional second parameter for containing a response

func (*Client) MeasurementsService Uses

func (c *Client) MeasurementsService() MeasurementsCommunicator

MeasurementsService represents the subset of the API that deals with AppOptics Measurements

func (*Client) NewRequest Uses

func (c *Client) NewRequest(method, path string, body interface{}) (*http.Request, error)

NewRequest standardizes the request being sent

type ErrorResponse Uses

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 Uses

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 Uses

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 Uses

type MeasurementPayload struct {
    Measurements []*Measurement `json:"measurements"`

MeasurementPayload is the construct we POST to the API

type MeasurementTags Uses

type MeasurementTags map[string]string

MeasurementTags is used to store the tags (labels)

type MeasurementsCommunicator Uses

type MeasurementsCommunicator interface {
    Create([]*Measurement) (*http.Response, error)

MeasurementsCommunicator defines an interface for communicating with the Measurements portion of the AppOptics API

type MeasurementsService Uses

type MeasurementsService struct {
    // contains filtered or unexported fields

MeasurementsService implements MeasurementsCommunicator

func (*MeasurementsService) Create Uses

func (ms *MeasurementsService) Create(mc []*Measurement) (*http.Response, error)

Create persists the given MeasurementCollection to AppOptics

type ServiceAccessor Uses

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

Package appoptics imports 10 packages (graph) and is imported by 2 packages. Updated 2020-07-15. Refresh now. Tools for package owners.