Documentation
¶
Index ¶
- func BufferFromCache(cloud string, services []string, logger log.Logger) (bytes.Buffer, error)
- func CollectCache(...) error
- func FlushExpiredCloudCaches(ttl time.Duration)
- func WriteCacheToResponse(w http.ResponseWriter, r *http.Request, cloud string, enabledServices []string, ...) error
- type CacheBackend
- type CloudCache
- type InMemoryCache
- type MetricFamilyCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BufferFromCache ¶
BufferFromCache reads cloud's MetricsFamily data from cache and writes into a buffer.
func CollectCache ¶
func CollectCache( enableExporterFunc func( string, string, string, []string, string, bool, bool, bool, bool, string, string, func() (string, error), log.Logger, ) (*exporters.OpenStackExporter, error), multiCloud bool, services map[string]*bool, prefix, cloud string, disabledMetrics []string, endpointType string, collectTime bool, disableSlowMetrics bool, disableDeprecatedMetrics bool, disableCinderAgentUUID bool, domainID string, tenantID string, uuidGenFunc func() (string, error), logger log.Logger, ) error
CollectCache collects the MetricsFamily for required clouds and services and stores in the cache.
func FlushExpiredCloudCaches ¶
FlushExpiredCloudCaches flush expired caches based on cloud's update time
Types ¶
type CacheBackend ¶
type CacheBackend interface {
// Set CloudCache in CacheBackend with cloud name.
SetCloudCache(cloud string, cloudCache CloudCache)
// Get CloudCache from CacheBackend with cloud name.
GetCloudCache(cloud string) (CloudCache, bool)
// Flush expired caches based on cloud's update time.
// Cache will be deleted if their update time is older than the ttl.
FlushExpiredCloudCaches(ttl time.Duration)
}
type CloudCache ¶
type CloudCache struct {
// Latest update time.
Time time.Time
// The key of MetricFamilyCaches is metric family name
// to avoid duplicate MFs in the map.
MetricFamilyCaches map[string]*MetricFamilyCache
}
Cloud Cache Data
func (*CloudCache) SetMetricFamilyCache ¶
func (c *CloudCache) SetMetricFamilyCache(mfName string, data MetricFamilyCache)
SetMetricFamilyCache updates the MetricFamilyCaches by associating a key, which is the metric family name.
type InMemoryCache ¶
type InMemoryCache struct {
CloudCaches map[string]*CloudCache
// contains filtered or unexported fields
}
InMemoryCache is a in-memory store based CacheBackend implementation.
func (*InMemoryCache) FlushExpiredCloudCaches ¶
func (c *InMemoryCache) FlushExpiredCloudCaches(ttl time.Duration)
Flush expired caches based on cloud's update time. Cache will be deleted if their update time is older than the ttl.
func (*InMemoryCache) GetCloudCache ¶
func (c *InMemoryCache) GetCloudCache(cloud string) (CloudCache, bool)
GetCloudCache return CloudCache from in-memory map.
func (*InMemoryCache) SetCloudCache ¶
func (c *InMemoryCache) SetCloudCache(cloud string, data CloudCache)
SetCloudCache store CloudCache in a in-memory map with key cloud's name. The CloudCache's Time attribute will be updated to now.
type MetricFamilyCache ¶
type MetricFamilyCache struct {
Service string
MF *dto.MetricFamily
}
MetricFamily Cache Data