Documentation ¶
Overview ¶
Package tsbridge deals with Time Series Bridge configuration files and metric representations. This file describes metrics themselves and metric update process.
Package tsbridge deals with Time Series Bridge configuration files and metric representations. This file has code related to configuration files.
Package tsbridge deals with Time Series Bridge configuration files and metric representations. This file defines metric stats collector and contains metric definitions.
Index ¶
- func UpdateAllMetrics(ctx context.Context, c *MetricConfig, sd StackdriverAdapter, parallelism int, ...) (errors []string)
- type Config
- type ConfigOptions
- type DatadogMetricConfig
- type DestinationConfig
- type InfluxDBMetricConfig
- type Metric
- type MetricConfig
- type SourceMetric
- type SourceMetricConfig
- type StackdriverAdapter
- type StatsCollector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UpdateAllMetrics ¶
func UpdateAllMetrics(ctx context.Context, c *MetricConfig, sd StackdriverAdapter, parallelism int, s *StatsCollector) (errors []string)
UpdateAllMetrics updates all metrics listed in a given config.
Types ¶
type Config ¶
type Config struct {
Options ConfigOptions
}
Config holds all the ConfigOptions
func NewConfig ¶
func NewConfig(options *ConfigOptions) *Config
NewConfig returns a new ConfigOptions struct.
type ConfigOptions ¶
type ConfigOptions struct { CounterResetInterval time.Duration EnableStatusPage bool Filename string MinPointAge time.Duration MonitoringBackends []string SDInternalMetricsProject string SDLookBackInterval time.Duration StorageEngine string BoltdbPath string DatastoreProject string UpdateParallelism int UpdateTimeout time.Duration SyncPeriod time.Duration }
ConfigOptions a set of global options required to initialize configuration.
type DatadogMetricConfig ¶
type DatadogMetricConfig struct { SourceMetricConfig `yaml:"_,inline"` datadog.MetricConfig `yaml:"_,inline"` }
DatadogMetricConfig combines common metric configuration parameters with Datadog-specific ones.
type DestinationConfig ¶
type DestinationConfig struct { Name string `validate:"nonzero"` ProjectID string `yaml:"project_id" validate:"regexp=^[A-Za-z0-9:.-]*$"` }
DestinationConfig defines configuration for a Stackdriver project metrics are written to. Name is only used internally to set destination for a specific imported metric.
type InfluxDBMetricConfig ¶
type InfluxDBMetricConfig struct { SourceMetricConfig `yaml:"_,inline"` influxdb.MetricConfig `yaml:"_,inline"` }
InfluxDBMetricConfig combines common metric configuration parameters with InfluxDB-specific ones.
type Metric ¶
type Metric struct { Name string Source SourceMetric SDProject string Record storage.MetricRecord }
Metric defines a specific metric that will be regularly imported.
func NewMetric ¶
func NewMetric(ctx context.Context, name string, s SourceMetric, sdProject string, storage storage.Manager) (*Metric, error)
NewMetric creates a Metric based on a SourceMetric and the destination Stackdriver project.
func (*Metric) StackdriverURL ¶
StackdriverURL returns a Metric Explorer URL for a given metric.
func (*Metric) Update ¶
func (m *Metric) Update(ctx context.Context, sd StackdriverAdapter, s *StatsCollector) error
Update issues a configured query and imports new points to Stackdriver.
type MetricConfig ¶
type MetricConfig struct { DatadogMetrics []*DatadogMetricConfig `yaml:"datadog_metrics"` InfluxDBMetrics []*InfluxDBMetricConfig `yaml:"influxdb_metrics"` StackdriverDestinations []*DestinationConfig `yaml:"stackdriver_destinations"` // contains filtered or unexported fields }
MetricConfig is what the YAML configuration file gets deserialized to.
func NewMetricConfig ¶
func NewMetricConfig(ctx context.Context, config *Config, storage storage.Manager) (*MetricConfig, error)
NewMetricConfig reads and validates a configuration file, returning the MetricConfig struct.
func (*MetricConfig) Metrics ¶
func (c *MetricConfig) Metrics() []*Metric
Metrics returns a list of metrics defined in the configuration file.
type SourceMetric ¶
type SourceMetric interface { StackdriverName() string Query() string StackdriverData(ctx context.Context, since time.Time, record storage.MetricRecord) (*metricpb.MetricDescriptor, []*monitoringpb.TimeSeries, error) }
SourceMetric is the interface implemented by the source metric libraries (i.e. Datadog).
type SourceMetricConfig ¶
type SourceMetricConfig struct { Name string `validate:"regexp=^[A-Za-z0-9]\\w*$"` Destination string `validate:"nonzero"` }
SourceMetricConfig defines some common parameters that any imported metric must have, irrespective of the monitoring system data is coming from.
type StackdriverAdapter ¶
type StackdriverAdapter interface { LatestTimestamp(context.Context, string, string) (time.Time, error) CreateTimeseries(context.Context, string, string, *metricpb.MetricDescriptor, []*monitoringpb.TimeSeries) error Close() error }
StackdriverAdapter is an interface implemented by stackdriver.Adapter.
type StatsCollector ¶
type StatsCollector struct { // SDExporter is the Stackdriver Exporter. SDExporter statsExporter // PromExporter is the Prometheus Exporter. PromExporter prometheusExporter MetricImportLatency *stats.Int64Measure TotalImportLatency *stats.Int64Measure OldestMetricAge *stats.Int64Measure MetricKey tag.Key // contains filtered or unexported fields }
StatsCollector has all metrics, tags, and the exporter used to publish them.
func NewCollector ¶
NewCollector creates a new StatsCollector. Users need to call StatsCollector.Close() when it's no longer needed. Only a single collector can be active per process.
func (*StatsCollector) Close ¶
func (c *StatsCollector) Close()
Close unregisters all metrics and Opencensus exporter(s) and flushes accumulated metric points to Stackdriver.