diff --git a/cmd/prometheus/config.go b/cmd/prometheus/config.go index af124cc26..d0662ba9c 100644 --- a/cmd/prometheus/config.go +++ b/cmd/prometheus/config.go @@ -32,7 +32,6 @@ import ( "github.com/prometheus/prometheus/storage/local" "github.com/prometheus/prometheus/storage/local/chunk" "github.com/prometheus/prometheus/storage/local/index" - "github.com/prometheus/prometheus/storage/remote" "github.com/prometheus/prometheus/web" ) @@ -50,7 +49,6 @@ var cfg = struct { notifierTimeout time.Duration queryEngine promql.EngineOptions web web.Options - remote remote.Options alertmanagerURLs stringset prometheusURL string @@ -188,45 +186,6 @@ func init() { "Local storage engine. Supported values are: 'persisted' (full local storage with on-disk persistence) and 'none' (no local storage).", ) - // Remote storage. - cfg.fs.StringVar( - &cfg.remote.GraphiteAddress, "storage.remote.graphite-address", "", - "The host:port of the remote Graphite server to send samples to. None, if empty.", - ) - cfg.fs.StringVar( - &cfg.remote.GraphiteTransport, "storage.remote.graphite-transport", "tcp", - "Transport protocol to use to communicate with Graphite. 'tcp', if empty.", - ) - cfg.fs.StringVar( - &cfg.remote.GraphitePrefix, "storage.remote.graphite-prefix", "", - "The prefix to prepend to all metrics exported to Graphite. None, if empty.", - ) - cfg.fs.StringVar( - &cfg.remote.OpentsdbURL, "storage.remote.opentsdb-url", "", - "The URL of the remote OpenTSDB server to send samples to. None, if empty.", - ) - cfg.fs.StringVar( - &cfg.influxdbURL, "storage.remote.influxdb-url", "", - "The URL of the remote InfluxDB server to send samples to. None, if empty.", - ) - cfg.fs.StringVar( - &cfg.remote.InfluxdbRetentionPolicy, "storage.remote.influxdb.retention-policy", "default", - "The InfluxDB retention policy to use.", - ) - cfg.fs.StringVar( - &cfg.remote.InfluxdbUsername, "storage.remote.influxdb.username", "", - "The username to use when sending samples to InfluxDB. The corresponding password must be provided via the INFLUXDB_PW environment variable.", - ) - cfg.fs.StringVar( - &cfg.remote.InfluxdbDatabase, "storage.remote.influxdb.database", "prometheus", - "The name of the database to use for storing samples in InfluxDB.", - ) - - cfg.fs.DurationVar( - &cfg.remote.StorageTimeout, "storage.remote.timeout", 30*time.Second, - "The timeout to use when sending samples to the remote storage.", - ) - // Alertmanager. cfg.fs.Var( &cfg.alertmanagerURLs, "alertmanager.url", @@ -285,17 +244,12 @@ func parse(args []string) error { // RoutePrefix must always be at least '/'. cfg.web.RoutePrefix = "/" + strings.Trim(cfg.web.RoutePrefix, "/") - if err := parseInfluxdbURL(); err != nil { - return err - } for u := range cfg.alertmanagerURLs { if err := validateAlertmanagerURL(u); err != nil { return err } } - cfg.remote.InfluxdbPassword = os.Getenv("INFLUXDB_PW") - return nil } @@ -330,24 +284,6 @@ func parsePrometheusURL() error { return nil } -func parseInfluxdbURL() error { - if cfg.influxdbURL == "" { - return nil - } - - if ok := govalidator.IsURL(cfg.influxdbURL); !ok { - return fmt.Errorf("invalid InfluxDB URL: %s", cfg.influxdbURL) - } - - url, err := url.Parse(cfg.influxdbURL) - if err != nil { - return err - } - - cfg.remote.InfluxdbURL = url - return nil -} - func validateAlertmanagerURL(u string) error { if u == "" { return nil diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go index c6ce558db..e7680783e 100644 --- a/cmd/prometheus/main.go +++ b/cmd/prometheus/main.go @@ -94,17 +94,7 @@ func Main() int { return 1 } - remoteStorage, err := remote.New(&cfg.remote) - if err != nil { - log.Errorf("Error initializing remote storage: %s", err) - return 1 - } - if remoteStorage != nil { - sampleAppender = append(sampleAppender, remoteStorage) - reloadables = append(reloadables, remoteStorage) - } - - reloadableRemoteStorage := remote.NewConfigurable() + reloadableRemoteStorage := remote.New() sampleAppender = append(sampleAppender, reloadableRemoteStorage) reloadables = append(reloadables, reloadableRemoteStorage) @@ -190,11 +180,6 @@ func Main() int { } }() - if remoteStorage != nil { - remoteStorage.Start() - defer remoteStorage.Stop() - } - defer reloadableRemoteStorage.Stop() // The storage has to be fully initialized before registering. diff --git a/storage/remote/graphite/client.go b/storage/remote/graphite/client.go deleted file mode 100644 index 8ce28c4a5..000000000 --- a/storage/remote/graphite/client.go +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2015 The Prometheus Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package graphite - -import ( - "bytes" - "fmt" - "math" - "net" - "sort" - "time" - - "github.com/prometheus/common/log" - "github.com/prometheus/common/model" -) - -// Client allows sending batches of Prometheus samples to Graphite. -type Client struct { - address string - transport string - timeout time.Duration - prefix string -} - -// NewClient creates a new Client. -func NewClient(address string, transport string, timeout time.Duration, prefix string) *Client { - return &Client{ - address: address, - transport: transport, - timeout: timeout, - prefix: prefix, - } -} - -func pathFromMetric(m model.Metric, prefix string) string { - var buffer bytes.Buffer - - buffer.WriteString(prefix) - buffer.WriteString(escape(m[model.MetricNameLabel])) - - // We want to sort the labels. - labels := make(model.LabelNames, 0, len(m)) - for l := range m { - labels = append(labels, l) - } - sort.Sort(labels) - - // For each label, in order, add ".