Merge pull request #4730 from prometheus/release-2.4

Release 2.4
This commit is contained in:
Goutham Veeramachaneni 2018-10-12 14:15:42 -07:00 committed by GitHub
commit ffb7f829ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 60 additions and 12 deletions

View File

@ -1,3 +1,9 @@
## 2.4.3 / 2018-10-04
* [BUGFIX] Fix panic when using custom EC2 API for SD #4672
* [BUGFIX] Fix panic when Zookeeper SD cannot connect to servers #4669
* [BUGFIX] Make the skip_head an optional parameter for snapshot API #4674
## 2.4.2 / 2018-09-21
The last release didn't have bugfix included due to a vendoring error.

View File

@ -1 +1 @@
2.4.2
2.4.3

View File

@ -241,9 +241,13 @@ func (d *Discovery) refresh() (tg *targetgroup.Group, err error) {
continue
}
labels := model.LabelSet{
ec2LabelOwnerID: model.LabelValue(*r.OwnerId),
ec2LabelInstanceID: model.LabelValue(*inst.InstanceId),
}
if r.OwnerId != nil {
labels[ec2LabelOwnerID] = model.LabelValue(*r.OwnerId)
}
labels[ec2LabelPrivateIP] = model.LabelValue(*inst.PrivateIpAddress)
addr := net.JoinHostPort(*inst.PrivateIpAddress, fmt.Sprintf("%d", d.port))
labels[model.AddressLabel] = model.LabelValue(addr)

View File

@ -345,12 +345,12 @@ func (m *Manager) registerProviders(cfg sd_config.ServiceDiscoveryConfig, setNam
}
for _, c := range cfg.ServersetSDConfigs {
add(c, func() (Discoverer, error) {
return zookeeper.NewServersetDiscovery(c, log.With(m.logger, "discovery", "zookeeper")), nil
return zookeeper.NewServersetDiscovery(c, log.With(m.logger, "discovery", "zookeeper"))
})
}
for _, c := range cfg.NerveSDConfigs {
add(c, func() (Discoverer, error) {
return zookeeper.NewNerveDiscovery(c, log.With(m.logger, "discovery", "nerve")), nil
return zookeeper.NewNerveDiscovery(c, log.With(m.logger, "discovery", "nerve"))
})
}
for _, c := range cfg.EC2SDConfigs {

View File

@ -115,12 +115,12 @@ type Discovery struct {
}
// NewNerveDiscovery returns a new Discovery for the given Nerve config.
func NewNerveDiscovery(conf *NerveSDConfig, logger log.Logger) *Discovery {
func NewNerveDiscovery(conf *NerveSDConfig, logger log.Logger) (*Discovery, error) {
return NewDiscovery(conf.Servers, time.Duration(conf.Timeout), conf.Paths, logger, parseNerveMember)
}
// NewServersetDiscovery returns a new Discovery for the given serverset config.
func NewServersetDiscovery(conf *ServersetSDConfig, logger log.Logger) *Discovery {
func NewServersetDiscovery(conf *ServersetSDConfig, logger log.Logger) (*Discovery, error) {
return NewDiscovery(conf.Servers, time.Duration(conf.Timeout), conf.Paths, logger, parseServersetMember)
}
@ -132,7 +132,7 @@ func NewDiscovery(
paths []string,
logger log.Logger,
pf func(data []byte, path string) (model.LabelSet, error),
) *Discovery {
) (*Discovery, error) {
if logger == nil {
logger = log.NewNopLogger()
}
@ -143,7 +143,7 @@ func NewDiscovery(
c.SetLogger(treecache.NewZookeeperLogger(logger))
})
if err != nil {
return nil
return nil, err
}
updates := make(chan treecache.ZookeeperTreeCacheEvent)
sd := &Discovery{
@ -156,7 +156,7 @@ func NewDiscovery(
for _, path := range paths {
sd.treeCaches = append(sd.treeCaches, treecache.NewZookeeperTreeCache(conn, path, updates, logger))
}
return sd
return sd, nil
}
// Run implements the Discoverer interface.

View File

@ -0,0 +1,32 @@
// Copyright 2018 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 zookeeper
import (
"testing"
"time"
"github.com/prometheus/common/model"
)
func TestNewDiscoveryError(t *testing.T) {
_, err := NewDiscovery(
[]string{"unreachable.test"},
time.Second, []string{"/"},
nil,
func(data []byte, path string) (model.LabelSet, error) { return nil, nil })
if err == nil {
t.Fatalf("expected error, got nil")
}
}

View File

@ -926,9 +926,15 @@ func (api *API) snapshot(r *http.Request) (interface{}, *apiError, func()) {
if !api.enableAdmin {
return nil, &apiError{errorUnavailable, errors.New("Admin APIs disabled")}, nil
}
skipHead, err := strconv.ParseBool(r.FormValue("skip_head"))
if err != nil {
return nil, &apiError{errorUnavailable, fmt.Errorf("unable to parse boolean 'skip_head' argument: %v", err)}, nil
var (
skipHead bool
err error
)
if r.FormValue("skip_head") != "" {
skipHead, err = strconv.ParseBool(r.FormValue("skip_head"))
if err != nil {
return nil, &apiError{errorUnavailable, fmt.Errorf("unable to parse boolean 'skip_head' argument: %v", err)}, nil
}
}
db := api.db()