collector

package
v1.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2018 License: Apache-2.0 Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sum

func Sum(r []store.Rate) store.Rate

Sum will take a slice of Rate and sum all their counts together to create a single Rate.

Types

type AppGUID

type AppGUID string

AppGUID represets an application GUID.

type AppInfo

type AppInfo struct {
	Name  string
	Space string
	Org   string
}

AppInfo holds the names of an application, space, and organization.

func (AppInfo) String

func (a AppInfo) String() string

String implements the Stringer interface.

type AppInfoStore

type AppInfoStore interface {
	Lookup(guids []string) (map[AppGUID]AppInfo, error)
}

AppInfoStore provides a way to find AppInfo for an app GUID.

type Authenticator

type Authenticator interface {
	RefreshAuthToken() (string, error)
}

Authenticator is used to refresh the authentication token.

type CachedAppInfoStore

type CachedAppInfoStore struct {
	// contains filtered or unexported fields
}

CachedAppInfoStore caches app info lookups against the APIStore.

func NewCachedAppInfoStore

func NewCachedAppInfoStore(s AppInfoStore, opts ...CachedAppInfoStoreOption) *CachedAppInfoStore

NewCachedAppInfoStore initializes a CachedAppInfoStore.

func (*CachedAppInfoStore) Lookup

func (c *CachedAppInfoStore) Lookup(guids []string) (map[AppGUID]AppInfo, error)

Lookup associates AppInfo for a particular app GUID.

type CachedAppInfoStoreOption

type CachedAppInfoStoreOption func(*CachedAppInfoStore)

func WithCacheTTL

func WithCacheTTL(cacheTTL time.Duration) CachedAppInfoStoreOption

type Collector

type Collector struct {
	// contains filtered or unexported fields
}

Collector handles fetch rates form multiple nozzles and summing their rates.

func New

func New(
	nozzles []string,
	auth Authenticator,
	nozzleAppGUID string,
	store AppInfoStore,
	opts ...CollectorOption,
) *Collector

New initializes and returns a new Collector.

func (*Collector) BuildPoints

func (c *Collector) BuildPoints(timestamp int64) ([]datadog.Point, error)

BuildPoints satisfies the datadog PointBuilder interface. It will request all the rates from all the known nozzles and sum their counts.

func (*Collector) Rate

func (c *Collector) Rate(timestamp int64) (store.Rate, error)

Rate will collect rates from all the nozzles and sum the totals to produce a a single Rate struct.

type CollectorOption

type CollectorOption func(c *Collector)

CollectorOption is a type of func that can be used for optional configuration settings for the Collector.

func WithHTTPClient

func WithHTTPClient(client *http.Client) CollectorOption

WithHTTPClient sets the the http client that the collector will use to make calls to external services.

func WithReportLimit

func WithReportLimit(n int) CollectorOption

WithReportLimit sets the limit of application instances to report to datadog. Example: If report limit is set to 100, only the 100 noisest application instances will be reported.

type GUIDIndex

type GUIDIndex string

GUIDIndex is a concatentation of GUID and instance index in the format some-guid/some-index, e.g., 7b8228a0-cf40-42d8-a7bb-b287a88198a3/0

func (GUIDIndex) GUID

func (g GUIDIndex) GUID() string

GUID returns the GUID of the GUIDIndex

func (GUIDIndex) Index

func (g GUIDIndex) Index() string

Index returns the Index of the GUIDIndex

type HTTPAppInfoStore

type HTTPAppInfoStore struct {
	// contains filtered or unexported fields
}

HTTPAppInfoStore provides a focused source of Cloud Controller API data.

func NewHTTPAppInfoStore

func NewHTTPAppInfoStore(
	apiAddr string,
	client HTTPClient,
	auth Authenticator,
) *HTTPAppInfoStore

NewHTTPAppInfoStore initializes an APIStore and sends all HTTP requests to the API URL specified by apiAddr.

func (*HTTPAppInfoStore) Lookup

func (s *HTTPAppInfoStore) Lookup(guids []string) (map[AppGUID]AppInfo, error)

Lookup reads AppInfo from a remote API.

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

HTTPClient supports HTTP requests.

type V2Resource

type V2Resource struct {
	Metadata struct {
		GUID string `json:"guid"`
	} `json:"metadata"`

	Entity struct {
		Name string `json:"name"`
	} `json:"entity"`
}

V2Resource represents a single V2 API resource

type V2Response

type V2Response struct {
	Resources []V2Resource `json:"resources"`
}

V2Response represents a list of V2 API resources.

type V3Relationship

type V3Relationship struct {
	Data struct {
		GUID string `json:"guid"`
	} `json:"data"`
}

V3Relationship represents a V3 API resource relationship.

type V3Resource

type V3Resource struct {
	GUID          string                    `json:"guid"`
	Name          string                    `json:"name"`
	Relationships map[string]V3Relationship `json:"relationships"`
}

V3Resource represents application data returned from the Cloud Controller API.

type V3Response

type V3Response struct {
	Resources []V3Resource `json:"resources"`
}

V3Response represents a list of V3 API resources and associated data.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL