Documentation ¶
Overview ¶
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 describes metrics themselves and metric update process.
Package tsbridge deals with Time Series Bridge configuration files and metric representations. This file defines metric stats collector and contains metric definitions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UpdateAllMetrics ¶
func UpdateAllMetrics(ctx context.Context, c *Config, sd StackdriverAdapter, parallelism int, s *StatsCollector) (errors []string)
UpdateAllMetrics updates all metrics listed in a given config.
Types ¶
type Config ¶
type Config struct { DatadogMetrics []*DatadogMetricConfig `yaml:"datadog_metrics"` StackdriverDestinations []*DestinationConfig `yaml:"stackdriver_destinations"` // contains filtered or unexported fields }
Config is what the YAML configuration file gets deserialized to.
type ConfigOptions ¶
type ConfigOptions struct { Filename string DatadogMinPointAge time.Duration DatadogCounterResetInterval time.Duration }
ConfigOptions is 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 Metric ¶
type Metric struct { Name string Source SourceMetric SDProject string Record record.MetricRecord }
Metric defines a specific metric that will be regularly imported.
func NewMetric ¶
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 SourceMetric ¶
type SourceMetric interface { StackdriverName() string Query() string StackdriverData(ctx context.Context, since time.Time, record record.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 { Exporter statsExporter 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 ¶
func NewCollector(ctx context.Context) (*StatsCollector, error)
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 Stackdriver exporter and flushes accumulated metric points to Stackdriver.