translator

package
v0.0.0-...-c1fcc63 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPrometheusMetrics

func GetPrometheusMetrics(host string, port uint) (map[string]*dto.MetricFamily, error)

GetPrometheusMetrics scrapes metrics from the given host and port using /metrics handler.

func MetricFamilyToMetricDescriptor

func MetricFamilyToMetricDescriptor(config *config.CommonConfig,
	family *dto.MetricFamily, originalDescriptor *v3.MetricDescriptor) *v3.MetricDescriptor

MetricFamilyToMetricDescriptor converts MetricFamily object to the MetricDescriptor. If needed it uses information from the previously created metricDescriptor (for example to merge label sets).

func OmitComponentName

func OmitComponentName(metricFamilies map[string]*dto.MetricFamily, componentName string) map[string]*dto.MetricFamily

OmitComponentName removes from the metric names prefix that is equal to component name.

func SendToStackdriver

func SendToStackdriver(service *v3.Service, config *config.CommonConfig, ts []*v3.TimeSeries)

SendToStackdriver sends http request to Stackdriver to create the given timeserieses.

func TranslatePrometheusToStackdriver

func TranslatePrometheusToStackdriver(config *config.CommonConfig,
	whitelisted []string,
	metrics map[string]*dto.MetricFamily,
	cache *MetricDescriptorCache) []*v3.TimeSeries

TranslatePrometheusToStackdriver translates metrics in Prometheus format to Stackdriver format.

Types

type MetricDescriptorCache

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

MetricDescriptorCache is responsible for fetching, creating and updating metric descriptors from the stackdriver.

func NewMetricDescriptorCache

func NewMetricDescriptorCache(service *v3.Service, config *config.CommonConfig, component string) *MetricDescriptorCache

NewMetricDescriptorCache creates empty metric descriptor cache for the given component.

func (*MetricDescriptorCache) GetMetricNames

func (cache *MetricDescriptorCache) GetMetricNames() []string

GetMetricNames returns a list of all metric names from the cache.

func (*MetricDescriptorCache) IsMetricBroken

func (cache *MetricDescriptorCache) IsMetricBroken(name string) bool

IsMetricBroken returns true if this metric descriptor assumed to invalid (for examples it has too many labels).

func (*MetricDescriptorCache) MarkStale

func (cache *MetricDescriptorCache) MarkStale()

MarkStale marks all records in the cache as stale until next Refresh() call.

func (*MetricDescriptorCache) Refresh

func (cache *MetricDescriptorCache) Refresh()

Refresh function fetches all metric descriptors of all metrics defined for given component with a defined prefix and puts them into cache.

func (*MetricDescriptorCache) UpdateMetricDescriptors

func (cache *MetricDescriptorCache) UpdateMetricDescriptors(metrics map[string]*dto.MetricFamily, whitelisted []string)

UpdateMetricDescriptors iterates over all metricFamilies and updates metricDescriptors in the Stackdriver if required.

Jump to

Keyboard shortcuts

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