2015-05-29 19:50:05 +00:00
|
|
|
package opentsdb
|
|
|
|
|
2015-09-08 23:19:50 +00:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/influxdb/influxdb/toml"
|
|
|
|
)
|
|
|
|
|
2015-06-08 16:20:54 +00:00
|
|
|
const (
|
|
|
|
// DefaultBindAddress is the default address that the service binds to.
|
|
|
|
DefaultBindAddress = ":4242"
|
|
|
|
|
|
|
|
// DefaultDatabase is the default database used for writes.
|
|
|
|
DefaultDatabase = "opentsdb"
|
|
|
|
|
|
|
|
// DefaultRetentionPolicy is the default retention policy used for writes.
|
|
|
|
DefaultRetentionPolicy = ""
|
2015-06-09 22:03:52 +00:00
|
|
|
|
|
|
|
// DefaultConsistencyLevel is the default write consistency level.
|
|
|
|
DefaultConsistencyLevel = "one"
|
2015-09-08 23:19:50 +00:00
|
|
|
|
|
|
|
// DefaultBatchSize is the default Graphite batch size.
|
|
|
|
DefaultBatchSize = 1000
|
|
|
|
|
|
|
|
// DefaultBatchTimeout is the default Graphite batch timeout.
|
|
|
|
DefaultBatchTimeout = time.Second
|
2015-09-09 02:35:19 +00:00
|
|
|
|
|
|
|
// DefaultBatchPending is the default number of batches that can be in the queue.
|
|
|
|
DefaultBatchPending = 5
|
2015-06-08 16:20:54 +00:00
|
|
|
)
|
|
|
|
|
2015-11-23 17:39:52 +00:00
|
|
|
// Config represents the configuration of the OpenTSDB service.
|
2015-05-29 19:50:05 +00:00
|
|
|
type Config struct {
|
2015-09-08 23:19:50 +00:00
|
|
|
Enabled bool `toml:"enabled"`
|
|
|
|
BindAddress string `toml:"bind-address"`
|
|
|
|
Database string `toml:"database"`
|
|
|
|
RetentionPolicy string `toml:"retention-policy"`
|
|
|
|
ConsistencyLevel string `toml:"consistency-level"`
|
|
|
|
TLSEnabled bool `toml:"tls-enabled"`
|
|
|
|
Certificate string `toml:"certificate"`
|
|
|
|
BatchSize int `toml:"batch-size"`
|
2015-09-09 02:35:19 +00:00
|
|
|
BatchPending int `toml:"batch-pending"`
|
2015-09-08 23:19:50 +00:00
|
|
|
BatchTimeout toml.Duration `toml:"batch-timeout"`
|
2015-11-13 22:53:09 +00:00
|
|
|
LogPointErrors bool `toml:"log-point-errors"`
|
2015-05-29 19:50:05 +00:00
|
|
|
}
|
2015-06-05 20:40:18 +00:00
|
|
|
|
2015-11-22 19:23:56 +00:00
|
|
|
// NewConfig returns a new config for the service.
|
2015-06-05 20:40:18 +00:00
|
|
|
func NewConfig() Config {
|
2015-06-08 16:20:54 +00:00
|
|
|
return Config{
|
2015-06-09 22:03:52 +00:00
|
|
|
BindAddress: DefaultBindAddress,
|
|
|
|
Database: DefaultDatabase,
|
|
|
|
RetentionPolicy: DefaultRetentionPolicy,
|
|
|
|
ConsistencyLevel: DefaultConsistencyLevel,
|
2015-07-31 18:00:22 +00:00
|
|
|
TLSEnabled: false,
|
|
|
|
Certificate: "/etc/ssl/influxdb.pem",
|
2015-09-08 23:19:50 +00:00
|
|
|
BatchSize: DefaultBatchSize,
|
2015-09-09 02:35:19 +00:00
|
|
|
BatchPending: DefaultBatchPending,
|
2015-09-08 23:19:50 +00:00
|
|
|
BatchTimeout: toml.Duration(DefaultBatchTimeout),
|
2015-11-13 22:53:09 +00:00
|
|
|
LogPointErrors: true,
|
2015-06-08 16:20:54 +00:00
|
|
|
}
|
2015-06-05 20:40:18 +00:00
|
|
|
}
|