Merge branch 'master' into dev-2.0

This commit is contained in:
Fabian Reinartz 2017-10-07 13:37:21 +02:00
commit abf7c975c9
6 changed files with 47 additions and 6 deletions

View file

@ -1,3 +1,33 @@
## 1.8.0 / 2017-10-06
* [CHANGE] Rule links link to the _Console_ tab rather than the _Graph_ tab to
not trigger expensive range queries by default.
* [FEATURE] Ability to act as a remote read endpoint for other Prometheus
servers.
* [FEATURE] K8s SD: Support discovery of ingresses.
* [FEATURE] Consul SD: Support for node metadata.
* [FEATURE] Openstack SD: Support discovery of hypervisors.
* [FEATURE] Expose current Prometheus config via `/status/config`.
* [FEATURE] Allow to collapse jobs on `/targets` page.
* [FEATURE] Add `/-/healthy` and `/-/ready` endpoints.
* [FEATURE] Add color scheme support to console templates.
* [ENHANCEMENT] Remote storage connections use HTTP keep-alive.
* [ENHANCEMENT] Improved logging about remote storage.
* [ENHANCEMENT] Relaxed URL validation.
* [ENHANCEMENT] Openstack SD: Handle instances without IP.
* [ENHANCEMENT] Make remote storage queue manager configurable.
* [ENHANCEMENT] Validate metrics returned from remote read.
* [ENHANCEMENT] EC2 SD: Set a default region.
* [ENHANCEMENT] Changed help link to `https://prometheus.io/docs`.
* [BUGFIX] Fix floating-point precision issue in `deriv` function.
* [BUGFIX] Fix pprof endpoints when -web.route-prefix or -web.external-url is
used.
* [BUGFIX] Fix handling of `null` target groups in file-based SD.
* [BUGFIX] Set the sample timestamp in date-related PromQL functions.
* [BUGFIX] Apply path prefix to redirect from deprecated graph URL.
* [BUGFIX] Fixed tests on MS Windows.
* [BUGFIX] Check for invalid UTF-8 in label values after relabeling.
## v2.0.0-rc.0 / 2017-10-05
This release includes numerous changes to the new storage layer. The main changes are:

View file

@ -93,7 +93,7 @@ func (c *Client) Write(samples model.Samples) error {
t := float64(s.Timestamp.UnixNano()) / 1e9
v := float64(s.Value)
if math.IsNaN(v) || math.IsInf(v, 0) {
level.Warn(c.logger).Log("msg", "cannot send value to Graphite, skipping sample", "value", v, "sample", s)
level.Debug(c.logger).Log("msg", "cannot send value to Graphite, skipping sample", "value", v, "sample", s)
continue
}
fmt.Fprintf(&buf, "%s %f %f\n", k, v, t)

View file

@ -79,7 +79,7 @@ func (c *Client) Write(samples model.Samples) error {
for _, s := range samples {
v := float64(s.Value)
if math.IsNaN(v) || math.IsInf(v, 0) {
level.Warn(c.logger).Log("msg", "cannot send value to OpenTSDB, skipping sample", "value", v, "sample", s)
level.Debug(c.logger).Log("msg", "cannot send value to OpenTSDB, skipping sample", "value", v, "sample", s)
continue
}
metric := TagValue(s.Metric[model.MetricNameLabel])

View file

@ -106,10 +106,18 @@ type API struct {
now func() time.Time
config func() config.Config
ready func(http.HandlerFunc) http.HandlerFunc
}
// NewAPI returns an initialized API type.
func NewAPI(qe *promql.Engine, q promql.Queryable, tr targetRetriever, ar alertmanagerRetriever, configFunc func() config.Config) *API {
func NewAPI(
qe *promql.Engine,
q promql.Queryable,
tr targetRetriever,
ar alertmanagerRetriever,
configFunc func() config.Config,
readyFunc func(http.HandlerFunc) http.HandlerFunc,
) *API {
return &API{
QueryEngine: qe,
Queryable: q,
@ -117,6 +125,7 @@ func NewAPI(qe *promql.Engine, q promql.Queryable, tr targetRetriever, ar alertm
alertmanagerRetriever: ar,
now: time.Now,
config: configFunc,
ready: readyFunc,
}
}
@ -133,9 +142,9 @@ func (api *API) Register(r *route.Router) {
w.WriteHeader(http.StatusNoContent)
}
})
return prometheus.InstrumentHandler(name, httputil.CompressionHandler{
return api.ready(prometheus.InstrumentHandler(name, httputil.CompressionHandler{
Handler: hf,
})
}))
}
r.Options("/*path", instr("options", api.options))

View file

@ -104,6 +104,7 @@ func TestEndpoints(t *testing.T) {
alertmanagerRetriever: ar,
now: func() time.Time { return now },
config: func() config.Config { return samplePrometheusCfg },
ready: func(f http.HandlerFunc) http.HandlerFunc { return f },
}
start := time.Unix(0, 0)
@ -658,7 +659,7 @@ func TestParseDuration(t *testing.T) {
func TestOptionsMethod(t *testing.T) {
r := route.New()
api := &API{}
api := &API{ready: func(f http.HandlerFunc) http.HandlerFunc { return f }}
api.Register(r)
s := httptest.NewServer(r)

View file

@ -187,6 +187,7 @@ func New(logger log.Logger, o *Options) *Handler {
defer h.mtx.RUnlock()
return *h.config
},
h.testReady,
)
if o.RoutePrefix != "/" {