metrics

package
v0.9.2-0...-4a62dc0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DEBUG = os.Getenv("DEBUG") != ""

Functions

func DebugLog

func DebugLog(format string, args ...interface{})

func GetBoshUAAUrl

func GetBoshUAAUrl(boshUrl string, skipSSLVerify bool) string

Types

type AppMetadataFetcher

type AppMetadataFetcher struct {
	CacheExpirySeconds int
	// contains filtered or unexported fields
}

func NewAppMetadataFetcher

func NewAppMetadataFetcher(client *cfclient.Client) *AppMetadataFetcher

func (*AppMetadataFetcher) GetAppNameForGUID

func (a *AppMetadataFetcher) GetAppNameForGUID(guid string) string

func (*AppMetadataFetcher) GetOrgNameForGUID

func (a *AppMetadataFetcher) GetOrgNameForGUID(guid string) string

func (*AppMetadataFetcher) GetSpaceNameForGUID

func (a *AppMetadataFetcher) GetSpaceNameForGUID(guid string) string

type AuthTokenFetcher

type AuthTokenFetcher interface {
	FetchAuthToken() string
}

type BoshClient

type BoshClient struct {

	// How long to wait for the VM info task before canceling
	VMFetchTaskTimeoutSeconds int
	// contains filtered or unexported fields
}

func NewBoshClient

func NewBoshClient(boshUrl string, authTokenFetcher AuthTokenFetcher, skipSSLVerify bool) *BoshClient

func (*BoshClient) NewGetRequest

func (o *BoshClient) NewGetRequest(path string) *http.Request

type BoshInfo

type BoshInfo struct {
	UserAuthentication struct {
		Type    string
		Options struct {
			URL string
		}
	} `json:"user_authentication"`
}

type BoshMetadataFetcher

type BoshMetadataFetcher struct {
	CacheExpirySeconds int
	// contains filtered or unexported fields
}

func NewBoshMetadataFetcher

func NewBoshMetadataFetcher(boshClient *BoshClient) *BoshMetadataFetcher

func (*BoshMetadataFetcher) GetVMIPAddress

func (o *BoshMetadataFetcher) GetVMIPAddress(deploymentName, vmId string) string

This just returns the first ip address given by BOSH

type BoshTask

type BoshTask struct {
	State string
}

type BoshVM

type BoshVM struct {
	AgentID string `json:"agent_id"`
	VmCid   string `json:"vm_cid"`
	JobName string `json:"job_name"`
	Index   int
	Ips     []string `json:"ips"`
	Id      string
}

type CacheEntry

type CacheEntry struct {
	App        *cfclient.App
	InsertTime time.Time
}

type Config

type Config struct {
	CloudFoundryApiURL    string `env:"CLOUDFOUNDRY_API_URL,required"`
	CFUAAURL              string `env:"CF_UAA_URL,required"`
	CFUsername            string `env:"CF_USERNAME,required"`
	CFPassword            string `env:"CF_PASSWORD,required"`
	InsecureSSLSkipVerify bool   `env:"INSECURE_SSL_SKIP_VERIFY" envDefault:"false"`
	EnableTSDBServer      bool   `env:"ENABLE_TSDB_SERVER" envDefault:"true"`

	BoshDirectorURL string `env:"BOSH_DIRECTOR_URL,required"`
	BoshUsername    string `env:"BOSH_CLIENT_ID,required"`
	BoshPassword    string `env:"BOSH_CLIENT_SECRET,required"`

	// This will be populated automatically in the main package if not supplied
	TrafficControllerURL          string   `env:"TRAFFIC_CONTROLLER_URL" envDefault:""`
	FirehoseSubscriptionID        string   `env:"FIREHOSE_SUBSCRIPTION_ID" envDefault:"signalfx"`
	FlushIntervalSeconds          int      `env:"FLUSH_INTERVAL_SECONDS" envDefault:"3"`
	FirehoseIdleTimeoutSeconds    int      `env:"FIREHOSE_IDLE_TIMEOUT_SECONDS" envDefault:"20"`
	FirehoseReconnectDelaySeconds int      `env:"FIREHOSE_RECONNECT_DELAY_SECONDS" envDefault:"5"`
	DeploymentsToInclude          []string `env:"DEPLOYMENTS_TO_INCLUDE" envDefault:"" envSeparator:";"`
	MetricsToExclude              []string `env:"METRICS_TO_EXCLUDE" envDefault:"" envSeparator:";"`

	AppMetadataCacheExpirySeconds int `env:"APP_METADATA_CACHE_EXPIRY_SECONDS" envDefault:"300"`

	SignalFxIngestURL   string `env:"SIGNALFX_INGEST_URL"`
	SignalFxAccessToken string `env:"SIGNALFX_ACCESS_TOKEN,required"`
}

func GetConfigFromEnv

func GetConfigFromEnv() (*Config, error)

func (*Config) ScrubbedString

func (cfg *Config) ScrubbedString() string

type Deployment

type Deployment struct {
	Name string
}

type MetricFilter

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

Filters datapoints based on deployment name and metric name

func NewMetricFilter

func NewMetricFilter(config *Config) *MetricFilter

type SignalFxClient

type SignalFxClient interface {
	AddDatapoints(context.Context, []*datapoint.Datapoint) error
}

type SignalFxFirehoseNozzle

type SignalFxFirehoseNozzle struct {
	MetricFilter
	// contains filtered or unexported fields
}

func NewSignalFxFirehoseNozzle

func NewSignalFxFirehoseNozzle(config *Config,
	tokenFetcher AuthTokenFetcher,
	client SignalFxClient,
	metadataFetcher *AppMetadataFetcher,
	metricFilter *MetricFilter) *SignalFxFirehoseNozzle

func (*SignalFxFirehoseNozzle) Start

func (o *SignalFxFirehoseNozzle) Start()

func (*SignalFxFirehoseNozzle) Stop

func (o *SignalFxFirehoseNozzle) Stop()

type TSDBServer

type TSDBServer struct {
	MetricFilter
	// contains filtered or unexported fields
}

func NewTSDBServer

func NewTSDBServer(client SignalFxClient, flushInterval int, port int, bosh *BoshMetadataFetcher, metricFilter *MetricFilter) *TSDBServer

func (*TSDBServer) Start

func (o *TSDBServer) Start() error

We accept port purely so we don't muck with global variables in testing

func (*TSDBServer) Stop

func (o *TSDBServer) Stop()

type UAATokenFetcher

type UAATokenFetcher struct {
	UaaUrl        string
	Username      string
	Password      string
	SSLSkipVerify bool
}

func (*UAATokenFetcher) FetchAuthToken

func (uaa *UAATokenFetcher) FetchAuthToken() string

func (*UAATokenFetcher) Token

func (uaa *UAATokenFetcher) Token() (*oauth2.Token, error)

Satisfy the oauth2.TokenSource interface

Jump to

Keyboard shortcuts

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