Versions in this module Expand all Collapse all v0 v0.5.6 Oct 12, 2022 Changes in this version + const MetricTagSeparator v0.5.5 Feb 3, 2020 v0.5.4 Jan 15, 2020 Changes in this version type MetricAttributes + SummarizeFunction string v0.5.3 Jan 13, 2020 v0.5.2 Jan 13, 2020 Changes in this version + const AggregationKey + const DefaultPersistenceErrorLimit + const MeasurementPostMaxBatchSize + var DefaultSink = NewMeasurementSet() + var ErrBadStatus = errors.New("Received non-OK status from AppOptics POST") + func ContextWithMeasurementSet(ctx context.Context) context.Context + func MetricWithTags(name string, tags map[string]interface{}) string + func RecordRuntimeMetrics(m *MeasurementSet) + type Aggregator struct + Count int64 + Last float64 + Max float64 + Min float64 + Sum float64 + func (g *Aggregator) Update(other Aggregator) + func (g *Aggregator) UpdateValue(val float64) + type Alert struct + Active bool + Attributes map[string]interface{} + Conditions []*AlertCondition + CreatedAt int + Description string + ID int + Name string + RearmSeconds int + Services []*Service + UpdatedAt int + type AlertCondition struct + DetectReset bool + Duration int + ID int + MetricName string + SummaryFunction string + Tags []*Tag + Threshold float64 + Type string + type AlertRequest struct + Active bool + Attributes map[string]interface{} + Conditions []*AlertCondition + CreatedAt int + Description string + ID int + Name string + RearmSeconds int + Services []int + UpdatedAt int + type AlertStatus struct + Alert Alert + Status string + type AlertsCommunicator interface + AssociateToService func(int, int) error + Create func(*AlertRequest) (*Alert, error) + Delete func(int) error + DisassociateFromService func(alertId, serviceId int) error + List func() (*AlertsListResponse, error) + Retrieve func(int) (*Alert, error) + Status func(int) (*AlertStatus, error) + Update func(*AlertRequest) error + type AlertsListResponse struct + Alerts []*Alert + Query QueryInfo + type AlertsService struct + func NewAlertsService(c *Client) *AlertsService + func (as *AlertsService) AssociateToService(alertId, serviceId int) error + func (as *AlertsService) Create(a *AlertRequest) (*Alert, error) + func (as *AlertsService) Delete(id int) error + func (as *AlertsService) DisassociateFromService(alertId, serviceId int) error + func (as *AlertsService) List() (*AlertsListResponse, error) + func (as *AlertsService) Retrieve(id int) (*Alert, error) + func (as *AlertsService) Status(id int) (*AlertStatus, error) + func (as *AlertsService) Update(a *AlertRequest) error + type AnnotationEvent struct + Description string + EndTime int64 + ID int + Links []AnnotationLink + Source string + StartTime int64 + Title string + type AnnotationLink struct + Href string + Label string + Rel string + type AnnotationStream struct + DisplayName string + Events []map[string][]AnnotationEvent + Name string + type AnnotationsCommunicator interface + Create func(*AnnotationEvent, string) (*AnnotationEvent, error) + Delete func(string) error + List func(*string) (*ListAnnotationsResponse, error) + Retrieve func(*RetrieveAnnotationsRequest) (*AnnotationStream, error) + RetrieveEvent func(string, int) (*AnnotationEvent, error) + UpdateEvent func(string, int, *AnnotationLink) (*AnnotationLink, error) + UpdateStream func(string, string) error + type AnnotationsService struct + func NewAnnotationsService(c *Client) *AnnotationsService + func (as *AnnotationsService) Create(event *AnnotationEvent, streamName string) (*AnnotationEvent, error) + func (as *AnnotationsService) Delete(streamName string) error + func (as *AnnotationsService) List(streamNameSearch *string) (*ListAnnotationsResponse, error) + func (as *AnnotationsService) Retrieve(retReq *RetrieveAnnotationsRequest) (*AnnotationStream, error) + func (as *AnnotationsService) RetrieveEvent(streamName string, id int) (*AnnotationEvent, error) + func (as *AnnotationsService) UpdateEvent(streamName string, id int, link *AnnotationLink) (*AnnotationLink, error) + func (as *AnnotationsService) UpdateStream(streamName, displayName string) error + type ApiToken struct + Active *bool + ID *int + Name *string + Role *string + Token *string + type ApiTokensCommunicator interface + Create func(*ApiToken) (*ApiToken, error) + Delete func(int) error + List func() (*ApiTokensResponse, error) + Retrieve func(string) (*ApiTokensResponse, error) + Update func(*ApiToken) (*ApiToken, error) + type ApiTokensResponse struct + ApiTokens []*ApiToken + Query QueryInfo + type ApiTokensService struct + func NewApiTokensService(c *Client) *ApiTokensService + func (ts *ApiTokensService) Create(at *ApiToken) (*ApiToken, error) + func (ts *ApiTokensService) Delete(id int) error + func (ts *ApiTokensService) List() (*ApiTokensResponse, error) + func (ts *ApiTokensService) Retrieve(name string) (*ApiTokensResponse, error) + func (ts *ApiTokensService) Update(at *ApiToken) (*ApiToken, error) + type BatchPersister struct + func NewBatchPersister(mc MeasurementsCommunicator, sendStats bool) *BatchPersister + func (bp *BatchPersister) BatchAndPersistMeasurementsForever() + func (bp *BatchPersister) MaximumPushInterval() int + func (bp *BatchPersister) MeasurementsErrorChannel() chan<- error + func (bp *BatchPersister) MeasurementsSink() chan<- []Measurement + func (bp *BatchPersister) MeasurementsStopBatchingChannel() chan<- bool + func (bp *BatchPersister) SetMaximumPushInterval(ms int) + type Chart struct + ID int + Label string + Max float64 + Min float64 + Name string + RelatedSpace int + Streams []Stream + Thresholds []Threshold + Type string + type ChartsCommunicator interface + Create func(*Chart, int) (*Chart, error) + Delete func(int, int) error + List func(int) ([]*Chart, error) + Retrieve func(int, int) (*Chart, error) + Update func(*Chart, int) (*Chart, error) + type ChartsService struct + func NewChartsService(c *Client) *ChartsService + func (cs *ChartsService) Create(chart *Chart, spaceId int) (*Chart, error) + func (cs *ChartsService) Delete(chartId, spaceId int) error + func (cs *ChartsService) List(spaceId int) ([]*Chart, error) + func (cs *ChartsService) Retrieve(chartId, spaceId int) (*Chart, error) + func (cs *ChartsService) Update(existingChart *Chart, spaceId int) (*Chart, error) + type Client struct + func NewClient(token string, opts ...func(*Client) error) *Client + func (c *Client) AlertsService() AlertsCommunicator + func (c *Client) AnnotationsService() AnnotationsCommunicator + func (c *Client) ApiTokensService() ApiTokensCommunicator + func (c *Client) ChartsService() ChartsCommunicator + func (c *Client) DefaultPaginationParameters(length int) *PaginationParameters + func (c *Client) Do(req *http.Request, respData interface{}) (*http.Response, error) + func (c *Client) JobsService() JobsCommunicator + func (c *Client) MeasurementsService() MeasurementsCommunicator + func (c *Client) MetricsService() MetricsCommunicator + func (c *Client) NewRequest(method, path string, body interface{}) (*http.Request, error) + func (c *Client) ServicesService() ServicesCommunicator + func (c *Client) SnapshotsService() SnapshotsCommunicator + func (c *Client) SpacesService() SpacesCommunicator + type ClientOption func(*Client) error + func BaseURLClientOption(urlString string) ClientOption + func SetDebugMode() ClientOption + func SetHTTPClient(client *http.Client) ClientOption + func UserAgentClientOption(userAgentString string) ClientOption + type ErrorResponse struct + Errors interface{} + Response *http.Response + Status string + func (e *ErrorResponse) Error() string + type Job struct + Errors map[string][]string + ID int + Output string + Progress float64 + State string + type JobsCommunicator interface + Retrieve func(int) (*Job, error) + type JobsService struct + func NewJobsService(c *Client) *JobsService + func (js *JobsService) Retrieve(id int) (*Job, error) + type LegacyClient interface + Post func(batch *MeasurementsBatch) error + func NewLegacyClient(url, token string) LegacyClient + type ListAnnotationsResponse struct + AnnotationStreams []*AnnotationStream + Query QueryInfo + type ListServicesResponse struct + Query QueryInfo + Services []*Service + type ListSpacesResponse struct + Query map[string]int + Spaces []*Space + type Measurement struct + Attributes map[string]interface{} + Count interface{} + Last interface{} + Max interface{} + Min interface{} + Name string + Sum interface{} + Tags map[string]string + Time int64 + Value interface{} + func NewMeasurement(name string) Measurement + type MeasurementSet struct + func NewMeasurementSet() *MeasurementSet + func (s *MeasurementSet) Add(key string, delta int64) + func (s *MeasurementSet) AddInt(key string, delta int) + func (s *MeasurementSet) GetAggregator(key string) *SynchronizedAggregator + func (s *MeasurementSet) GetCounter(key string) *SynchronizedCounter + func (s *MeasurementSet) Incr(key string) + func (s *MeasurementSet) Merge(report *MeasurementSetReport) + func (s *MeasurementSet) Reset() *MeasurementSetReport + func (s *MeasurementSet) UpdateAggregator(key string, other Aggregator) + func (s *MeasurementSet) UpdateAggregatorValue(key string, val float64) + type MeasurementSetReport struct + Aggregators map[string]Aggregator + Counts map[string]int64 + func NewMeasurementSetReport() *MeasurementSetReport + type MeasurementsBatch struct + Measurements []Measurement + Period int64 + Tags *map[string]string + Time int64 + func NewMeasurementsBatch(m []Measurement, tags *map[string]string) *MeasurementsBatch + type MeasurementsCommunicator interface + Create func(*MeasurementsBatch) (*http.Response, error) + type MeasurementsService struct + func NewMeasurementsService(c *Client) *MeasurementsService + func (ms *MeasurementsService) Create(batch *MeasurementsBatch) (*http.Response, error) + type Metric struct + Attributes MetricAttributes + Composite string + Description string + DisplayName string + Name string + Period int + Type string + type MetricAttributes struct + Aggregate bool + Color string + CreatedByUA string + DisplayMax interface{} + DisplayMin interface{} + DisplayStacked bool + DisplayUnitsLong string + DisplayUnitsShort string + GapDetection bool + type MetricUpdatePayload struct + Attributes MetricAttributes + Names []string + type MetricsCommunicator interface + Create func(*Metric) (*Metric, error) + Delete func(string) error + List func() (*MetricsResponse, error) + Retrieve func(string) (*Metric, error) + Update func(string, *Metric) error + type MetricsResponse struct + Metrics []*Metric + Query QueryInfo + type MetricsService struct + func NewMetricsService(c *Client) *MetricsService + func (ms *MetricsService) Create(m *Metric) (*Metric, error) + func (ms *MetricsService) Delete(name string) error + func (ms *MetricsService) List() (*MetricsResponse, error) + func (ms *MetricsService) Retrieve(name string) (*Metric, error) + func (ms *MetricsService) Update(originalName string, m *Metric) error + type MockMeasurementsService struct + OnCreate func(batch *MeasurementsBatch) (*http.Response, error) + func (m *MockMeasurementsService) Create(batch *MeasurementsBatch) (*http.Response, error) + type MultiReporter struct + func NewMultiReporter(m *MeasurementSet, reporters []*Reporter) *MultiReporter + func (m *MultiReporter) Start() + type PaginationParameters struct + Length int + Offset int + Orderby string + Sort string + func (rp *PaginationParameters) AddToRequest(req *http.Request) + type QueryInfo struct + Found int + Length int + Offset int + Total int + type Reporter struct + func NewReporter(measurementSet *MeasurementSet, communicator MeasurementsCommunicator, ...) *Reporter + func (r *Reporter) Start() + type RetrieveAnnotationsRequest struct + EndTime time.Time + Name string + Sources []string + StartTime time.Time + type RetrieveSpaceResponse struct + Charts []map[string]int + type Service struct + ID int + Settings map[string]string + Title string + Type string + type ServiceAccessor interface + AlertsService func() AlertsCommunicator + AnnotationsService func() AnnotationsCommunicator + ApiTokensService func() ApiTokensCommunicator + ChartsService func() ChartsCommunicator + JobsService func() JobsCommunicator + MeasurementsService func() MeasurementsCommunicator + MetricsService func() MetricsCommunicator + ServicesService func() ServicesCommunicator + SnapshotsService func() SnapshotsCommunicator + SpacesService func() SpacesCommunicator + type ServicesCommunicator interface + Create func(*Service) (*Service, error) + Delete func(int) error + List func() (*ListServicesResponse, error) + Retrieve func(int) (*Service, error) + Update func(*Service) error + type ServicesService struct + func NewServiceService(c *Client) *ServicesService + func (ss *ServicesService) Create(s *Service) (*Service, error) + func (ss *ServicesService) Delete(id int) error + func (ss *ServicesService) List() (*ListServicesResponse, error) + func (ss *ServicesService) Retrieve(id int) (*Service, error) + func (ss *ServicesService) Update(s *Service) error + type SimpleClient struct + Token string + URL string + func (c *SimpleClient) Post(batch *MeasurementsBatch) error + type Snapshot struct + CreatedAt time.Time + Duration int + EndTime time.Time + Href string + ImageHref string + JobHref string + Subject map[string]SnapshotChart + UpdatedAt time.Time + type SnapshotChart struct + ID int + Sources []string + Type string + type SnapshotsCommunicator interface + Create func(*Snapshot) (*Snapshot, error) + Retrieve func(int) (*Snapshot, error) + type SnapshotsService struct + func NewSnapshotsService(c *Client) *SnapshotsService + func (ss *SnapshotsService) Create(s *Snapshot) (*Snapshot, error) + func (ss *SnapshotsService) Retrieve(id int) (*Snapshot, error) + type Space struct + ID int + Name string + type SpacesCommunicator interface + Create func(string) (*Space, error) + Delete func(int) error + List func(*PaginationParameters) ([]*Space, error) + Retrieve func(int) (*RetrieveSpaceResponse, error) + Update func(int, string) error + type SpacesService struct + func NewSpacesService(c *Client) *SpacesService + func (s *SpacesService) Create(name string) (*Space, error) + func (s *SpacesService) Delete(id int) error + func (s *SpacesService) List(rp *PaginationParameters) ([]*Space, error) + func (s *SpacesService) Retrieve(id int) (*RetrieveSpaceResponse, error) + func (s *SpacesService) Update(id int, name string) error + type Stream struct + Color string + Composite string + DownsampleFunction string + GroupBy string + GroupFunction string + ID int + Max int + Metric string + Min int + Name string + Period int + SummaryFunction string + Tags []Tag + TransformFunction string + Type string + UnitsLong string + UnitsShort string + type SynchronizedAggregator struct + func (g *SynchronizedAggregator) Reset() Aggregator + func (g *SynchronizedAggregator) Update(other Aggregator) + func (g *SynchronizedAggregator) UpdateValue(val float64) + type SynchronizedCounter int64 + func NewCounter() *SynchronizedCounter + func (c *SynchronizedCounter) Add(delta int64) + func (c *SynchronizedCounter) AddInt(delta int) + func (c *SynchronizedCounter) Incr() + func (c *SynchronizedCounter) Reset() int64 + type Tag struct + Dynamic bool + Grouped bool + Name string + Values []string + type TaggedMeasurementSet struct + func (s *TaggedMeasurementSet) Add(key string, delta int64) + func (s *TaggedMeasurementSet) AddInt(key string, delta int) + func (s *TaggedMeasurementSet) GetAggregator(key string) *SynchronizedAggregator + func (s *TaggedMeasurementSet) GetCounter(key string) *SynchronizedCounter + func (s *TaggedMeasurementSet) Incr(key string) + func (s *TaggedMeasurementSet) Merge(report *MeasurementSetReport) + func (s *TaggedMeasurementSet) SetTags(tags map[string]interface{}) + func (s *TaggedMeasurementSet) Tags() map[string]interface{} + func (s *TaggedMeasurementSet) UpdateAggregator(key string, other Aggregator) + func (s *TaggedMeasurementSet) UpdateAggregatorValue(key string, val float64) + type Threshold struct + Operator string + Type string + Value float64