fetchers

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CumulativeInstanceData

type CumulativeInstanceData struct {
	InstanceID int
	Usage      float64
}

type CumulativeUsageFetcher

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

func NewCumulativeUsageFetcher

func NewCumulativeUsageFetcher(logCacheClient LogCacheClient) CumulativeUsageFetcher

func (CumulativeUsageFetcher) FetchInstanceData

func (f CumulativeUsageFetcher) FetchInstanceData(logger lager.Logger, appGuid string, appInstances map[int]cf.Instance) (map[int]interface{}, error)

type CurrentInstanceData

type CurrentInstanceData struct {
	InstanceID int
	Usage      float64
}

type CurrentUsageFetcher

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

func NewCurrentUsageFetcher

func NewCurrentUsageFetcher(client LogCacheClient) CurrentUsageFetcher

func NewCurrentUsageFetcherWithFallbackFetcher

func NewCurrentUsageFetcherWithFallbackFetcher(client LogCacheClient, fallbackFetcher Fetcher) CurrentUsageFetcher

func (CurrentUsageFetcher) FetchInstanceData

func (f CurrentUsageFetcher) FetchInstanceData(logger lager.Logger, appGUID string, appInstances map[int]cf.Instance) (map[int]interface{}, error)

type Fetcher

type Fetcher interface {
	FetchInstanceData(logger lager.Logger, appGUID string, appInstances map[int]cf.Instance) (map[int]interface{}, error)
}

type LastSpikeFetcher

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

func NewLastSpikeFetcher

func NewLastSpikeFetcher(client LogCacheClient, since time.Time) *LastSpikeFetcher

func (LastSpikeFetcher) FetchInstanceData

func (f LastSpikeFetcher) FetchInstanceData(logger lager.Logger, appGUID string, appInstances map[int]cf.Instance) (map[int]interface{}, error)

type LastSpikeInstanceData

type LastSpikeInstanceData struct {
	InstanceID int
	From       time.Time
	To         time.Time
}

type LogCacheClient

type LogCacheClient interface {
	Read(ctx context.Context, sourceID string, start time.Time, opts ...logcache.ReadOption) ([]*loggregator_v2.Envelope, error)
	PromQL(ctx context.Context, query string, opts ...logcache.PromQLOption) (*logcache_v1.PromQL_InstantQueryResult, error)
	PromQLRange(ctx context.Context, query string, opts ...logcache.PromQLOption) (*logcache_v1.PromQL_RangeQueryResult, error)
}

type ProcessInstanceIDFetcher

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

func NewProcessInstanceIDFetcher

func NewProcessInstanceIDFetcher(client LogCacheClient) ProcessInstanceIDFetcher

func NewProcessInstanceIDFetcherWithLimit

func NewProcessInstanceIDFetcherWithLimit(client LogCacheClient, limit int) ProcessInstanceIDFetcher

func (ProcessInstanceIDFetcher) Fetch

func (f ProcessInstanceIDFetcher) Fetch(logger lager.Logger, appGUID string) (map[int]string, error)

Fetch searches in a 30s interval, in which each app instance will have emitted at least one metric. As log-cache read is limited to 1000 results, we have implemented some pagination here. We start with the topmost 1000 results, and if we do receive 1000 back, there may be more, so we reduce `end` back to the timestamp of the earliest metric from the results and re-read. As soon as fewer than 1000 results are returned we stop, as we have exhausted the range. We also apply a 10 iteration sanity check to avoid looping forever.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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