Пример #1
0
// NewConfig returns an instance of Config with defaults.
func NewConfig() Config {
	return Config{
		WriteTimeout:       toml.Duration(DefaultWriteTimeout),
		ShardWriterTimeout: toml.Duration(DefaultShardWriterTimeout),
		ShardMapperTimeout: toml.Duration(DefaultShardMapperTimeout),
	}
}
Пример #2
0
// NewConfig returns a new Config with defaults.
func NewConfig() Config {
	return Config{
		Enabled:       true,
		CheckInterval: toml.Duration(DefaultCheckInterval),
		AdvancePeriod: toml.Duration(DefaultAdvancePeriod),
	}
}
Пример #3
0
func NewConfig() Config {
	defaultEngine := DefaultEngine
	if engine := os.Getenv("INFLUXDB_DATA_ENGINE"); engine != "" {
		log.Println("TSDB engine selected via environment variable:", engine)
		defaultEngine = engine
	}

	return Config{
		Engine:                 defaultEngine,
		MaxWALSize:             DefaultMaxWALSize,
		WALFlushInterval:       toml.Duration(DefaultWALFlushInterval),
		WALPartitionFlushDelay: toml.Duration(DefaultWALPartitionFlushDelay),

		WALLoggingEnabled:           true,
		WALReadySeriesSize:          DefaultReadySeriesSize,
		WALCompactionThreshold:      DefaultCompactionThreshold,
		WALMaxSeriesSize:            DefaultMaxSeriesSize,
		WALFlushColdInterval:        toml.Duration(DefaultFlushColdInterval),
		WALPartitionSizeThreshold:   DefaultPartitionSizeThreshold,
		WALFlushMemorySizeThreshold: DefaultFlushMemorySizeThreshold,
		WALMaxMemorySizeThreshold:   DefaultMaxMemorySizeThreshold,
		IndexCompactionAge:          DefaultIndexCompactionAge,
		IndexMinCompactionFileCount: DefaultIndexMinCompactionFileCount,
		IndexCompactionFullAge:      DefaultIndexCompactionFullAge,
		IndexMinCompactionInterval:  DefaultIndexMinCompactionInterval,

		QueryLogEnabled: true,
	}
}
Пример #4
0
func NewConfig() Config {
	return Config{
		Engine:                 DefaultEngine,
		Enabled:                true, // data node enabled by default
		MaxWALSize:             DefaultMaxWALSize,
		WALFlushInterval:       toml.Duration(DefaultWALFlushInterval),
		WALPartitionFlushDelay: toml.Duration(DefaultWALPartitionFlushDelay),

		WALLoggingEnabled:         true,
		WALReadySeriesSize:        DefaultReadySeriesSize,
		WALCompactionThreshold:    DefaultCompactionThreshold,
		WALMaxSeriesSize:          DefaultMaxSeriesSize,
		WALFlushColdInterval:      toml.Duration(DefaultFlushColdInterval),
		WALPartitionSizeThreshold: DefaultPartitionSizeThreshold,

		QueryLogEnabled: true,

		CacheMaxMemorySize:             DefaultCacheMaxMemorySize,
		CacheSnapshotMemorySize:        DefaultCacheSnapshotMemorySize,
		CacheSnapshotWriteColdDuration: toml.Duration(DefaultCacheSnapshotWriteColdDuration),
		CompactFullWriteColdDuration:   toml.Duration(DefaultCompactFullWriteColdDuration),

		DataLoggingEnabled: true,
	}
}
Пример #5
0
func NewConfig() Config {
	defaultEngine := DefaultEngine
	if engine := os.Getenv("INFLUXDB_DATA_ENGINE"); engine != "" {
		log.Println("TSDB engine selected via environment variable:", engine)
		defaultEngine = engine
	}

	return Config{
		Engine:                 defaultEngine,
		MaxWALSize:             DefaultMaxWALSize,
		WALFlushInterval:       toml.Duration(DefaultWALFlushInterval),
		WALPartitionFlushDelay: toml.Duration(DefaultWALPartitionFlushDelay),

		WALLoggingEnabled:         true,
		WALReadySeriesSize:        DefaultReadySeriesSize,
		WALCompactionThreshold:    DefaultCompactionThreshold,
		WALMaxSeriesSize:          DefaultMaxSeriesSize,
		WALFlushColdInterval:      toml.Duration(DefaultFlushColdInterval),
		WALPartitionSizeThreshold: DefaultPartitionSizeThreshold,

		QueryLogEnabled: true,

		CacheMaxMemorySize:             DefaultCacheMaxMemorySize,
		CacheSnapshotMemorySize:        DefaultCacheSnapshotMemorySize,
		CacheSnapshotWriteColdDuration: toml.Duration(DefaultCacheSnapshotWriteColdDuration),
		CompactFullWriteColdDuration:   toml.Duration(DefaultCompactFullWriteColdDuration),

		DataLoggingEnabled: true,
	}
}
Пример #6
0
// NewConfig returns an instance of Config with defaults.
func NewConfig() Config {
	return Config{
		WriteTimeout:              toml.Duration(DefaultWriteTimeout),
		ShardWriterTimeout:        toml.Duration(DefaultShardWriterTimeout),
		ShardMapperTimeout:        toml.Duration(DefaultShardMapperTimeout),
		MaxRemoteWriteConnections: DefaultMaxRemoteWriteConnections,
	}
}
Пример #7
0
func NewConfig() Config {
	return Config{
		RetentionAutoCreate:   DefaultRetentionAutoCreate,
		RetentionCheckEnabled: DefaultRetentionCheckEnabled,
		RetentionCheckPeriod:  toml.Duration(DefaultRetentionCheckPeriod),
		RetentionCreatePeriod: toml.Duration(DefaultRetentionCreatePeriod),
	}
}
Пример #8
0
// NewConfig returns a new instance of Config with defaults.
func NewConfig() Config {
	return Config{
		Enabled:                true,
		RecomputePreviousN:     DefaultRecomputePreviousN,
		RecomputeNoOlderThan:   toml.Duration(DefaultRecomputeNoOlderThan),
		ComputeRunsPerInterval: DefaultComputeRunsPerInterval,
		ComputeNoMoreThan:      toml.Duration(DefaultComputeNoMoreThan),
	}
}
Пример #9
0
func NewConfig() Config {
	return Config{
		Enabled:        true,
		MaxSize:        DefaultMaxSize,
		MaxAge:         toml.Duration(DefaultMaxAge),
		RetryRateLimit: DefaultRetryRateLimit,
		RetryInterval:  toml.Duration(DefaultRetryInterval),
	}
}
Пример #10
0
func NewConfig() Config {
	return Config{
		MaxWALSize:            DefaultMaxWALSize,
		WALFlushInterval:      toml.Duration(DefaultWALFlushInterval),
		RetentionAutoCreate:   DefaultRetentionAutoCreate,
		RetentionCheckEnabled: DefaultRetentionCheckEnabled,
		RetentionCheckPeriod:  toml.Duration(DefaultRetentionCheckPeriod),
		RetentionCreatePeriod: toml.Duration(DefaultRetentionCreatePeriod),
	}
}
Пример #11
0
// NewConfig returns an instance of Config with defaults.
func NewConfig() Config {
	return Config{
		StoreEnabled:           true,
		StoreDatabase:          DefaultStoreDatabase,
		StoreRetentionPolicy:   DefaultStoreRetentionPolicy,
		StoreRetentionDuration: toml.Duration(DefaultStoreRetentionPolicyDuration),
		StoreReplicationFactor: DefaultStoreReplicationFactor,
		StoreInterval:          toml.Duration(DefaultStoreInterval),
	}
}
Пример #12
0
func NewConfig() *Config {
	return &Config{
		Hostname:            DefaultHostname,
		BindAddress:         DefaultBindAddress,
		RetentionAutoCreate: true,
		ElectionTimeout:     toml.Duration(DefaultElectionTimeout),
		HeartbeatTimeout:    toml.Duration(DefaultHeartbeatTimeout),
		LeaderLeaseTimeout:  toml.Duration(DefaultLeaderLeaseTimeout),
		CommitTimeout:       toml.Duration(DefaultCommitTimeout),
	}
}
Пример #13
0
// NewConfig returns the default test configuration.
func NewConfig(path string) *meta.Config {
	return &meta.Config{
		Dir:                path,
		Hostname:           "localhost",
		BindAddress:        "127.0.0.1:0",
		HeartbeatTimeout:   toml.Duration(500 * time.Millisecond),
		ElectionTimeout:    toml.Duration(500 * time.Millisecond),
		LeaderLeaseTimeout: toml.Duration(500 * time.Millisecond),
		CommitTimeout:      toml.Duration(5 * time.Millisecond),
	}
}
Пример #14
0
// NewConfig returns a new Config with defaults.
func NewConfig() Config {
	return Config{
		BindAddress:      DefaultBindAddress,
		Database:         DefaultDatabase,
		Protocol:         DefaultProtocol,
		BatchSize:        DefaultBatchSize,
		BatchTimeout:     toml.Duration(DefaultBatchTimeout),
		TCPTimeout:       toml.Duration(DefaultTCPConnTimeout),
		ConsistencyLevel: DefaultConsistencyLevel,
		Separator:        DefaultSeparator,
	}
}
Пример #15
0
func NewConfig() Config {
	return Config{
		MaxWALSize:             DefaultMaxWALSize,
		WALFlushInterval:       toml.Duration(DefaultWALFlushInterval),
		WALPartitionFlushDelay: toml.Duration(DefaultWALPartitionFlushDelay),

		WALLoggingEnabled:         true,
		WALReadySeriesSize:        DefaultReadySeriesSize,
		WALCompactionThreshold:    DefaultCompactionThreshold,
		WALMaxSeriesSize:          DefaultMaxSeriesSize,
		WALFlushColdInterval:      toml.Duration(DefaultFlushColdInterval),
		WALPartitionSizeThreshold: DefaultPartitionSizeThreshold,
	}
}
Пример #16
0
// NewConfig builds a new configuration with default values.
func NewConfig() *Config {
	return &Config{
		Enabled:              true, // enabled by default
		BindAddress:          DefaultRaftBindAddress,
		HTTPBindAddress:      DefaultHTTPBindAddress,
		RetentionAutoCreate:  true,
		ElectionTimeout:      toml.Duration(DefaultElectionTimeout),
		HeartbeatTimeout:     toml.Duration(DefaultHeartbeatTimeout),
		LeaderLeaseTimeout:   toml.Duration(DefaultLeaderLeaseTimeout),
		CommitTimeout:        toml.Duration(DefaultCommitTimeout),
		RaftPromotionEnabled: DefaultRaftPromotionEnabled,
		LeaseDuration:        toml.Duration(DefaultLeaseDuration),
		LoggingEnabled:       DefaultLoggingEnabled,
	}
}
Пример #17
0
func TestServer_UDFAgents(t *testing.T) {
	dir, err := os.Getwd()
	udfDir := filepath.Clean(filepath.Join(dir, "../../../udf"))
	if err != nil {
		t.Fatal(err)
	}

	agents := []struct {
		buildFunc func() error
		config    udf.FunctionConfig
	}{
		// Go
		{
			buildFunc: func() error { return nil },
			config: udf.FunctionConfig{
				Prog:    "go",
				Args:    []string{"run", filepath.Join(udfDir, "agent/examples/moving_avg.go")},
				Timeout: toml.Duration(time.Minute),
			},
		},
		// Python
		{
			buildFunc: func() error { return nil },
			config: udf.FunctionConfig{
				Prog:    "python2",
				Args:    []string{"-u", filepath.Join(udfDir, "agent/examples/moving_avg.py")},
				Timeout: toml.Duration(time.Minute),
				Env: map[string]string{
					"PYTHONPATH": strings.Join(
						[]string{filepath.Join(udfDir, "agent/py"), os.Getenv("PYTHONPATH")},
						string(filepath.ListSeparator),
					),
				},
			},
		},
	}
	for _, agent := range agents {
		err := agent.buildFunc()
		if err != nil {
			t.Fatal(err)
		}
		c := NewConfig()
		c.UDF.Functions = map[string]udf.FunctionConfig{
			"movingAvg": agent.config,
		}
		testAgent(t, c)
	}
}
Пример #18
0
func NewConfig() Config {
	return Config{
		Enabled:       true,
		URL:           DefaultURL,
		StatsInterval: toml.Duration(DefaultStatsInterval),
	}
}
Пример #19
0
// NewConfig returns an instance of Config with defaults.
func NewConfig() Config {
	return Config{
		StoreEnabled:  true,
		StoreDatabase: DefaultStoreDatabase,
		StoreInterval: toml.Duration(DefaultStoreInterval),
	}
}
Пример #20
0
// NewConfig returns a new instance of Config with defaults.
func NewConfig() Config {
	return Config{
		LogEnabled:  true,
		Enabled:     true,
		RunInterval: toml.Duration(DefaultRunInterval),
	}
}
Пример #21
0
// Ensure the shard writer returns an error when we can't get a connection.
func TestShardWriter_Write_PoolMax(t *testing.T) {
	ts := newTestWriteService(writeShardSlow)
	s := cluster.NewService(cluster.Config{
		ShardWriterTimeout: toml.Duration(100 * time.Millisecond),
	})
	s.Listener = ts.muxln
	s.TSDBStore = ts
	if err := s.Open(); err != nil {
		t.Fatal(err)
	}
	defer s.Close()
	defer ts.Close()

	w := cluster.NewShardWriter(100*time.Millisecond, 1)
	w.MetaClient = &metaClient{host: ts.ln.Addr().String()}
	now := time.Now()

	shardID := uint64(1)
	ownerID := uint64(2)
	var points []models.Point
	points = append(points, models.MustNewPoint(
		"cpu", models.Tags{"host": "server01"}, map[string]interface{}{"value": int64(100)}, now,
	))

	go w.WriteShard(shardID, ownerID, points)
	time.Sleep(time.Millisecond)
	if err := w.WriteShard(shardID, ownerID, points); err == nil || err.Error() != "timed out waiting for free connection" {
		t.Fatalf("unexpected error: %v", err)
	}
}
Пример #22
0
// WithDefaults takes the given config and returns a new config with any required
// default values set.
func (c *Config) WithDefaults() *Config {
	d := *c
	if d.Database == "" {
		d.Database = DefaultDatabase
	}
	if d.BatchSize == 0 {
		d.BatchSize = DefaultBatchSize
	}
	if d.BatchPending == 0 {
		d.BatchPending = DefaultBatchPending
	}
	if d.BatchTimeout == 0 {
		d.BatchTimeout = toml.Duration(DefaultBatchTimeout)
	}
	if d.Precision == "" {
		d.Precision = DefaultPrecision
	}
	if d.ReadBuffer == 0 {
		d.ReadBuffer = DefaultReadBuffer
	}
	if d.UDPPayloadSize == 0 {
		d.UDPPayloadSize = DefaultUDPPayloadSize
	}
	return &d
}
Пример #23
0
// WithDefaults takes the given config and returns a new config with any required
// default values set.
func (c *Config) WithDefaults() *Config {
	d := *c
	if d.BindAddress == "" {
		d.BindAddress = DefaultBindAddress
	}
	if d.Database == "" {
		d.Database = DefaultDatabase
	}
	if d.Protocol == "" {
		d.Protocol = DefaultProtocol
	}
	if d.BatchSize == 0 {
		d.BatchSize = DefaultBatchSize
	}
	if d.BatchTimeout == 0 {
		d.BatchTimeout = toml.Duration(DefaultBatchTimeout)
	}
	if d.ConsistencyLevel == "" {
		d.ConsistencyLevel = DefaultConsistencyLevel
	}
	if d.Separator == "" {
		d.Separator = DefaultSeparator
	}
	return &d
}
Пример #24
0
func newConfig() *meta.Config {
	cfg := meta.NewConfig()
	cfg.BindAddress = "127.0.0.1:0"
	cfg.HTTPBindAddress = "127.0.0.1:0"
	cfg.Dir = testTempDir(2)
	cfg.LeaseDuration = toml.Duration(1 * time.Second)
	return cfg
}
Пример #25
0
// NewConfig returns an instance of Config with defaults.
func NewConfig() Config {
	return Config{
		StoreEnabled:  false,
		StoreDatabase: DefaultStoreDatabase,
		StoreInterval: toml.Duration(DefaultStoreInterval),
		StoreAddress:  DefaultStoreAddress,
	}
}
Пример #26
0
func NewConfig() Config {
	return Config{
		Enabled:         true,
		Database:        "_kapacitor",
		RetentionPolicy: "default",
		StatsInterval:   toml.Duration(10 * time.Second),
	}
}
Пример #27
0
func NewConfig() Config {
	return Config{
		Host:        "localhost",
		Port:        25,
		Username:    "",
		Password:    "",
		IdleTimeout: toml.Duration(time.Second * 30),
	}
}
Пример #28
0
// NewConfig returns the default config with temporary paths.
func NewConfig() *run.Config {
	c := run.NewConfig()
	c.Meta.Dir = MustTempFile()
	c.Meta.BindAddress = "127.0.0.1:0"
	c.Meta.HeartbeatTimeout = toml.Duration(50 * time.Millisecond)
	c.Meta.ElectionTimeout = toml.Duration(50 * time.Millisecond)
	c.Meta.LeaderLeaseTimeout = toml.Duration(50 * time.Millisecond)
	c.Meta.CommitTimeout = toml.Duration(5 * time.Millisecond)

	c.Data.Dir = MustTempFile()

	c.HintedHandoff.Dir = MustTempFile()

	c.HTTPD.Enabled = true
	c.HTTPD.BindAddress = "127.0.0.1:0"
	c.HTTPD.LogEnabled = testing.Verbose()

	return c
}
Пример #29
0
func NewConfig() Config {
	return Config{
		BindAddress:     DefaultBindAddress,
		Database:        DefaultDatabase,
		RetentionPolicy: DefaultRetentionPolicy,
		BatchSize:       DefaultBatchSize,
		BatchPending:    DefaultBatchPending,
		BatchTimeout:    toml.Duration(DefaultBatchTimeout),
	}
}
Пример #30
0
func TestConfig_Encode(t *testing.T) {
	var c run.Config
	c.Cluster.WriteTimeout = itoml.Duration(time.Minute)
	buf := new(bytes.Buffer)
	if err := toml.NewEncoder(buf).Encode(&c); err != nil {
		t.Fatal("Failed to encode: ", err)
	}
	got, search := buf.String(), `write-timeout = "1m0s"`
	if !strings.Contains(got, search) {
		t.Fatalf("Encoding config failed.\nfailed to find %s in:\n%s\n", search, got)
	}
}