diego_logging_client

package module
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 4 Imported by: 163

README

diego-logging-client

Go Report Card Go Reference

The Diego Logging Client provides a generic client for Diego to Cloud Foundry's logging subsystem, Loggregator.

The client wraps the go-loggregator library to provide a tailored interface for Diego components.

[!NOTE]

This repository should be imported as code.cloudfoundry.org/diego-logging-client.

Contributing

See the Contributing.md for more information on how to contribute.

Working Group Charter

This repository is maintained by App Runtime Platform under Diego area.

[!IMPORTANT]

Content in this file is managed by the CI task sync-readme and is generated by CI following a convention.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	UseV2API      bool   `json:"loggregator_use_v2_api"`
	APIPort       int    `json:"loggregator_api_port"`
	CACertPath    string `json:"loggregator_ca_path"`
	CertPath      string `json:"loggregator_cert_path"`
	KeyPath       string `json:"loggregator_key_path"`
	JobDeployment string `json:"loggregator_job_deployment"`
	JobName       string `json:"loggregator_job_name"`
	JobIndex      string `json:"loggregator_job_index"`
	JobIP         string `json:"loggregator_job_ip"`
	JobOrigin     string `json:"loggregator_job_origin"`
	SourceID      string `json:"loggregator_source_id"`
	InstanceID    string `json:"loggregator_instance_id"`

	BatchMaxSize       uint `json:"loggregator_batch_max_size"`
	BatchFlushInterval time.Duration

	AppMetricExclusionFilter []string `json:"loggregator_app_metric_exclusion_filter"`
}

Config is the shared configuration between v1 and v2 clients.

type ContainerMetric

type ContainerMetric struct {
	ApplicationId            string //deprecated
	InstanceIndex            int32  //deprecated
	CpuPercentage            float64
	CpuEntitlementPercentage float64
	MemoryBytes              uint64
	DiskBytes                uint64
	MemoryBytesQuota         uint64
	DiskBytesQuota           uint64
	AbsoluteCPUUsage         uint64
	AbsoluteCPUEntitlement   uint64
	ContainerAge             uint64
	RxBytes                  *uint64
	TxBytes                  *uint64
	Tags                     map[string]string
}

A ContainerMetric records resource usage of an app in a container.

type IngressClient

type IngressClient interface {
	SendDuration(name string, value time.Duration, opts ...loggregator.EmitGaugeOption) error
	SendMebiBytes(name string, value int, opts ...loggregator.EmitGaugeOption) error
	SendMetric(name string, value int, opts ...loggregator.EmitGaugeOption) error
	SendBytesPerSecond(name string, value float64) error
	SendRequestsPerSecond(name string, value float64) error
	IncrementCounter(name string) error
	IncrementCounterWithDelta(name string, value uint64) error
	SendAppLog(message, sourceType string, tags map[string]string) error
	SendAppErrorLog(message, sourceType string, tags map[string]string) error
	SendAppMetrics(metrics ContainerMetric) error
	SendAppLogRate(rate, rateLimit float64, tags map[string]string) error
	SendSpikeMetrics(metrics SpikeMetric) error
	SendComponentMetric(name string, value float64, unit string) error
}

IngressClient is the shared contract between v1 and v2 clients.

func NewIngressClient

func NewIngressClient(config Config) (IngressClient, error)

NewIngressClient returns a v2 client if the config.UseV2API is true, or a no op client.

func WrapClient

func WrapClient(c logClient, s, i string, f []string) IngressClient

type SpikeMetric

type SpikeMetric struct {
	Start time.Time
	End   time.Time
	Tags  map[string]string
}

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