summaryrefslogtreecommitdiff
path: root/vendor/github.com/prometheus/common/expfmt
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2022-02-17 13:46:51 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2022-02-22 14:38:57 -0500
commit80c5962dba7f5ecd6b602aecd0df479bd04391b1 (patch)
treea1d7fada738182c2eb8cd6993f33625ae704ba94 /vendor/github.com/prometheus/common/expfmt
parentd3903a85910979d8212028cf814574047015db58 (diff)
downloadpodman-80c5962dba7f5ecd6b602aecd0df479bd04391b1.tar.gz
podman-80c5962dba7f5ecd6b602aecd0df479bd04391b1.tar.bz2
podman-80c5962dba7f5ecd6b602aecd0df479bd04391b1.zip
Add containers-common spec and command to podman
Since containers-common package is tied to specific versions of Podman, add tools to build the package into the contrib directory This should help other distributions to figure out which commont package to ship. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'vendor/github.com/prometheus/common/expfmt')
-rw-r--r--vendor/github.com/prometheus/common/expfmt/decode.go2
-rw-r--r--vendor/github.com/prometheus/common/expfmt/encode.go2
-rw-r--r--vendor/github.com/prometheus/common/expfmt/text_parse.go13
3 files changed, 14 insertions, 3 deletions
diff --git a/vendor/github.com/prometheus/common/expfmt/decode.go b/vendor/github.com/prometheus/common/expfmt/decode.go
index c092723e8..7657f841d 100644
--- a/vendor/github.com/prometheus/common/expfmt/decode.go
+++ b/vendor/github.com/prometheus/common/expfmt/decode.go
@@ -164,7 +164,7 @@ func (sd *SampleDecoder) Decode(s *model.Vector) error {
}
// ExtractSamples builds a slice of samples from the provided metric
-// families. If an error occurrs during sample extraction, it continues to
+// families. If an error occurs during sample extraction, it continues to
// extract from the remaining metric families. The returned error is the last
// error that has occurred.
func ExtractSamples(o *DecodeOptions, fams ...*dto.MetricFamily) (model.Vector, error) {
diff --git a/vendor/github.com/prometheus/common/expfmt/encode.go b/vendor/github.com/prometheus/common/expfmt/encode.go
index bd4e34745..64dc0eb40 100644
--- a/vendor/github.com/prometheus/common/expfmt/encode.go
+++ b/vendor/github.com/prometheus/common/expfmt/encode.go
@@ -18,7 +18,7 @@ import (
"io"
"net/http"
- "github.com/golang/protobuf/proto"
+ "github.com/golang/protobuf/proto" //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
"github.com/matttproud/golang_protobuf_extensions/pbutil"
"github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg"
diff --git a/vendor/github.com/prometheus/common/expfmt/text_parse.go b/vendor/github.com/prometheus/common/expfmt/text_parse.go
index 342e5940d..84be0643e 100644
--- a/vendor/github.com/prometheus/common/expfmt/text_parse.go
+++ b/vendor/github.com/prometheus/common/expfmt/text_parse.go
@@ -24,7 +24,7 @@ import (
dto "github.com/prometheus/client_model/go"
- "github.com/golang/protobuf/proto"
+ "github.com/golang/protobuf/proto" //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
"github.com/prometheus/common/model"
)
@@ -299,6 +299,17 @@ func (p *TextParser) startLabelName() stateFn {
p.parseError(fmt.Sprintf("expected '=' after label name, found %q", p.currentByte))
return nil
}
+ // Check for duplicate label names.
+ labels := make(map[string]struct{})
+ for _, l := range p.currentMetric.Label {
+ lName := l.GetName()
+ if _, exists := labels[lName]; !exists {
+ labels[lName] = struct{}{}
+ } else {
+ p.parseError(fmt.Sprintf("duplicate label names for metric %q", p.currentMF.GetName()))
+ return nil
+ }
+ }
return p.startLabelValue
}