mirror of
https://github.com/prometheus/prometheus
synced 2024-12-28 09:42:22 +00:00
Merge pull request #4174 from adamdecaf/upate-common-2018-05-18
update vendor'd github.com/prometheus/common/config
This commit is contained in:
commit
56e6679281
19
vendor/github.com/prometheus/common/config/config.go
generated
vendored
19
vendor/github.com/prometheus/common/config/config.go
generated
vendored
@ -11,24 +11,11 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// This package no longer handles safe yaml parsing. In order to
|
||||
// ensure correct yaml unmarshalling, use "yaml.UnmarshalStrict()".
|
||||
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func checkOverflow(m map[string]interface{}, ctx string) error {
|
||||
if len(m) > 0 {
|
||||
var keys []string
|
||||
for k := range m {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
return fmt.Errorf("unknown fields in %s: %s", ctx, strings.Join(keys, ", "))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Secret special type for storing secrets.
|
||||
type Secret string
|
||||
|
||||
|
32
vendor/github.com/prometheus/common/config/http_config.go
generated
vendored
32
vendor/github.com/prometheus/common/config/http_config.go
generated
vendored
@ -32,9 +32,6 @@ type BasicAuth struct {
|
||||
Username string `yaml:"username"`
|
||||
Password Secret `yaml:"password,omitempty"`
|
||||
PasswordFile string `yaml:"password_file,omitempty"`
|
||||
|
||||
// Catches all undefined fields and must be empty after parsing.
|
||||
XXX map[string]interface{} `yaml:",inline"`
|
||||
}
|
||||
|
||||
// URL is a custom URL type that allows validation at configuration load time.
|
||||
@ -77,9 +74,6 @@ type HTTPClientConfig struct {
|
||||
ProxyURL URL `yaml:"proxy_url,omitempty"`
|
||||
// TLSConfig to use to connect to the targets.
|
||||
TLSConfig TLSConfig `yaml:"tls_config,omitempty"`
|
||||
|
||||
// Catches all undefined fields and must be empty after parsing.
|
||||
XXX map[string]interface{} `yaml:",inline"`
|
||||
}
|
||||
|
||||
// Validate validates the HTTPClientConfig to check only one of BearerToken,
|
||||
@ -91,9 +85,6 @@ func (c *HTTPClientConfig) Validate() error {
|
||||
if c.BasicAuth != nil && (len(c.BearerToken) > 0 || len(c.BearerTokenFile) > 0) {
|
||||
return fmt.Errorf("at most one of basic_auth, bearer_token & bearer_token_file must be configured")
|
||||
}
|
||||
if c.BasicAuth != nil && c.BasicAuth.Username == "" {
|
||||
return fmt.Errorf("basic_auth requires a username")
|
||||
}
|
||||
if c.BasicAuth != nil && (string(c.BasicAuth.Password) != "" && c.BasicAuth.PasswordFile != "") {
|
||||
return fmt.Errorf("at most one of basic_auth password & password_file must be configured")
|
||||
}
|
||||
@ -103,25 +94,16 @@ func (c *HTTPClientConfig) Validate() error {
|
||||
// UnmarshalYAML implements the yaml.Unmarshaler interface
|
||||
func (c *HTTPClientConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
type plain HTTPClientConfig
|
||||
err := unmarshal((*plain)(c))
|
||||
if err != nil {
|
||||
if err := unmarshal((*plain)(c)); err != nil {
|
||||
return err
|
||||
}
|
||||
err = c.Validate()
|
||||
if err != nil {
|
||||
return c.Validate()
|
||||
}
|
||||
return checkOverflow(c.XXX, "http_client_config")
|
||||
return c.Validate()
|
||||
}
|
||||
|
||||
// UnmarshalYAML implements the yaml.Unmarshaler interface.
|
||||
func (a *BasicAuth) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
type plain BasicAuth
|
||||
err := unmarshal((*plain)(a))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return checkOverflow(a.XXX, "basic_auth")
|
||||
return unmarshal((*plain)(a))
|
||||
}
|
||||
|
||||
// NewClient returns a http.Client using the specified http.RoundTripper.
|
||||
@ -318,18 +300,12 @@ type TLSConfig struct {
|
||||
ServerName string `yaml:"server_name,omitempty"`
|
||||
// Disable target certificate validation.
|
||||
InsecureSkipVerify bool `yaml:"insecure_skip_verify"`
|
||||
|
||||
// Catches all undefined fields and must be empty after parsing.
|
||||
XXX map[string]interface{} `yaml:",inline"`
|
||||
}
|
||||
|
||||
// UnmarshalYAML implements the yaml.Unmarshaler interface.
|
||||
func (c *TLSConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
type plain TLSConfig
|
||||
if err := unmarshal((*plain)(c)); err != nil {
|
||||
return err
|
||||
}
|
||||
return checkOverflow(c.XXX, "TLS config")
|
||||
return unmarshal((*plain)(c))
|
||||
}
|
||||
|
||||
func (c HTTPClientConfig) String() string {
|
||||
|
4
vendor/github.com/prometheus/common/expfmt/decode.go
generated
vendored
4
vendor/github.com/prometheus/common/expfmt/decode.go
generated
vendored
@ -164,9 +164,9 @@ func (sd *SampleDecoder) Decode(s *model.Vector) error {
|
||||
}
|
||||
|
||||
// ExtractSamples builds a slice of samples from the provided metric
|
||||
// families. If an error occurs during sample extraction, it continues to
|
||||
// families. If an error occurrs during sample extraction, it continues to
|
||||
// extract from the remaining metric families. The returned error is the last
|
||||
// error that has occured.
|
||||
// error that has occurred.
|
||||
func ExtractSamples(o *DecodeOptions, fams ...*dto.MetricFamily) (model.Vector, error) {
|
||||
var (
|
||||
all model.Vector
|
||||
|
4
vendor/github.com/prometheus/common/expfmt/text_parse.go
generated
vendored
4
vendor/github.com/prometheus/common/expfmt/text_parse.go
generated
vendored
@ -556,8 +556,8 @@ func (p *TextParser) readTokenUntilWhitespace() {
|
||||
// byte considered is the byte already read (now in p.currentByte). The first
|
||||
// newline byte encountered is still copied into p.currentByte, but not into
|
||||
// p.currentToken. If recognizeEscapeSequence is true, two escape sequences are
|
||||
// recognized: '\\' tranlates into '\', and '\n' into a line-feed character. All
|
||||
// other escape sequences are invalid and cause an error.
|
||||
// recognized: '\\' translates into '\', and '\n' into a line-feed character.
|
||||
// All other escape sequences are invalid and cause an error.
|
||||
func (p *TextParser) readTokenUntilNewline(recognizeEscapeSequence bool) {
|
||||
p.currentToken.Reset()
|
||||
escaped := false
|
||||
|
4
vendor/github.com/prometheus/common/model/silence.go
generated
vendored
4
vendor/github.com/prometheus/common/model/silence.go
generated
vendored
@ -59,8 +59,8 @@ func (m *Matcher) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Silence defines the representation of a silence definiton
|
||||
// in the Prometheus eco-system.
|
||||
// Silence defines the representation of a silence definition in the Prometheus
|
||||
// eco-system.
|
||||
type Silence struct {
|
||||
ID uint64 `json:"id,omitempty"`
|
||||
|
||||
|
4
vendor/github.com/prometheus/common/model/value.go
generated
vendored
4
vendor/github.com/prometheus/common/model/value.go
generated
vendored
@ -100,7 +100,7 @@ func (s *SamplePair) UnmarshalJSON(b []byte) error {
|
||||
}
|
||||
|
||||
// Equal returns true if this SamplePair and o have equal Values and equal
|
||||
// Timestamps. The sematics of Value equality is defined by SampleValue.Equal.
|
||||
// Timestamps. The semantics of Value equality is defined by SampleValue.Equal.
|
||||
func (s *SamplePair) Equal(o *SamplePair) bool {
|
||||
return s == o || (s.Value.Equal(o.Value) && s.Timestamp.Equal(o.Timestamp))
|
||||
}
|
||||
@ -117,7 +117,7 @@ type Sample struct {
|
||||
}
|
||||
|
||||
// Equal compares first the metrics, then the timestamp, then the value. The
|
||||
// sematics of value equality is defined by SampleValue.Equal.
|
||||
// semantics of value equality is defined by SampleValue.Equal.
|
||||
func (s *Sample) Equal(o *Sample) bool {
|
||||
if s == o {
|
||||
return true
|
||||
|
38
vendor/vendor.json
vendored
38
vendor/vendor.json
vendored
@ -772,52 +772,52 @@
|
||||
"revisionTime": "2015-02-12T10:17:44Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "bgmAaHIDapEUVLIWaqpxG9t4mYQ=",
|
||||
"checksumSHA1": "cxLURB7wEFsMAZ6fi5Ptfdrwdc8=",
|
||||
"path": "github.com/prometheus/common/config",
|
||||
"revision": "e5b036cc37a466a0af27d604d1ee500211d16d6a",
|
||||
"revisionTime": "2018-04-23T14:05:01Z"
|
||||
"revision": "7600349dcfe1abd18d72d3a1770870d9800a7801",
|
||||
"revisionTime": "2018-05-18T15:47:59Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "+wZ+Pa6NX+NOxUvayXBXGOcqFe8=",
|
||||
"checksumSHA1": "vPdC/DzEm7YbzRir2wwnpLPfay8=",
|
||||
"path": "github.com/prometheus/common/expfmt",
|
||||
"revision": "38c53a9f4bfcd932d1b00bfc65e256a7fba6b37a",
|
||||
"revisionTime": "2018-03-26T16:04:09Z"
|
||||
"revision": "7600349dcfe1abd18d72d3a1770870d9800a7801",
|
||||
"revisionTime": "2018-05-18T15:47:59Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "GWlM3d2vPYyNATtTFgftS10/A9w=",
|
||||
"path": "github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg",
|
||||
"revision": "38c53a9f4bfcd932d1b00bfc65e256a7fba6b37a",
|
||||
"revisionTime": "2018-03-26T16:04:09Z"
|
||||
"revision": "7600349dcfe1abd18d72d3a1770870d9800a7801",
|
||||
"revisionTime": "2018-05-18T15:47:59Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "YU+/K48IMawQnToO4ETE6a+hhj4=",
|
||||
"checksumSHA1": "EXTRY7DL9gFW8c341Dk6LDXCBn8=",
|
||||
"path": "github.com/prometheus/common/model",
|
||||
"revision": "38c53a9f4bfcd932d1b00bfc65e256a7fba6b37a",
|
||||
"revisionTime": "2018-03-26T16:04:09Z"
|
||||
"revision": "7600349dcfe1abd18d72d3a1770870d9800a7801",
|
||||
"revisionTime": "2018-05-18T15:47:59Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "Yseprf8kAFr/s7wztkQnrFuFN+8=",
|
||||
"path": "github.com/prometheus/common/promlog",
|
||||
"revision": "38c53a9f4bfcd932d1b00bfc65e256a7fba6b37a",
|
||||
"revisionTime": "2018-03-26T16:04:09Z"
|
||||
"revision": "7600349dcfe1abd18d72d3a1770870d9800a7801",
|
||||
"revisionTime": "2018-05-18T15:47:59Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "1H28FCxsaAIm6kvue+Wfdd8Lq6M=",
|
||||
"path": "github.com/prometheus/common/promlog/flag",
|
||||
"revision": "38c53a9f4bfcd932d1b00bfc65e256a7fba6b37a",
|
||||
"revisionTime": "2018-03-26T16:04:09Z"
|
||||
"revision": "7600349dcfe1abd18d72d3a1770870d9800a7801",
|
||||
"revisionTime": "2018-05-18T15:47:59Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "9doPk0x0LONG/idxK61JnZYcxBs=",
|
||||
"path": "github.com/prometheus/common/route",
|
||||
"revision": "38c53a9f4bfcd932d1b00bfc65e256a7fba6b37a",
|
||||
"revisionTime": "2018-03-26T16:04:09Z"
|
||||
"revision": "7600349dcfe1abd18d72d3a1770870d9800a7801",
|
||||
"revisionTime": "2018-05-18T15:47:59Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "91KYK0SpvkaMJJA2+BcxbVnyRO0=",
|
||||
"path": "github.com/prometheus/common/version",
|
||||
"revision": "38c53a9f4bfcd932d1b00bfc65e256a7fba6b37a",
|
||||
"revisionTime": "2018-03-26T16:04:09Z"
|
||||
"revision": "7600349dcfe1abd18d72d3a1770870d9800a7801",
|
||||
"revisionTime": "2018-05-18T15:47:59Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "W218eJZPXJG783fUr/z6IaAZyes=",
|
||||
|
Loading…
Reference in New Issue
Block a user