Documentation
¶
Index ¶
- func GetPrometheusMetrics(host string, port uint) (map[string]*dto.MetricFamily, error)
- func MetricFamilyToMetricDescriptor(config *config.CommonConfig, family *dto.MetricFamily, ...) *v3.MetricDescriptor
- func OmitComponentName(metricFamilies map[string]*dto.MetricFamily, componentName string) map[string]*dto.MetricFamily
- func SendToStackdriver(service *v3.Service, config *config.CommonConfig, ts []*v3.TimeSeries)
- func TranslatePrometheusToStackdriver(config *config.CommonConfig, whitelisted []string, ...) []*v3.TimeSeries
- type MetricDescriptorCache
- func (cache *MetricDescriptorCache) GetMetricNames() []string
- func (cache *MetricDescriptorCache) IsMetricBroken(name string) bool
- func (cache *MetricDescriptorCache) MarkStale()
- func (cache *MetricDescriptorCache) Refresh()
- func (cache *MetricDescriptorCache) UpdateMetricDescriptors(metrics map[string]*dto.MetricFamily, whitelisted []string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPrometheusMetrics ¶
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.