mirror of
https://github.com/prometheus/prometheus.git
synced 2026-05-05 04:16:15 +02:00
Use stringlabels by default
This removes the stringlabels build tag, makes that implementation the default one, and moves the old labels implementation under the slicelabels build tag. Fixes #16064. Signed-off-by: Lukasz Mierzwa <l.mierzwa@gmail.com>
This commit is contained in:
parent
bce72b93d9
commit
bb76966992
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -18,8 +18,8 @@ jobs:
|
||||
- uses: ./.github/promci/actions/setup_environment
|
||||
with:
|
||||
enable_npm: true
|
||||
- run: make GOOPTS=--tags=stringlabels GO_ONLY=1 SKIP_GOLANGCI_LINT=1
|
||||
- run: go test --tags=stringlabels ./tsdb/ -test.tsdb-isolation=false
|
||||
- run: make GO_ONLY=1 SKIP_GOLANGCI_LINT=1
|
||||
- run: go test ./tsdb/ -test.tsdb-isolation=false
|
||||
- run: make -C documentation/examples/remote_storage
|
||||
- run: make -C documentation/examples
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build !stringlabels && !dedupelabels
|
||||
//go:build slicelabels
|
||||
|
||||
package labels
|
||||
|
||||
@ -453,7 +453,7 @@ func (b *ScratchBuilder) Add(name, value string) {
|
||||
}
|
||||
|
||||
// UnsafeAddBytes adds a name/value pair, using []byte instead of string.
|
||||
// The '-tags stringlabels' version of this function is unsafe, hence the name.
|
||||
// The default version of this function is unsafe, hence the name.
|
||||
// This version is safe - it copies the strings immediately - but we keep the same name so everything compiles.
|
||||
func (b *ScratchBuilder) UnsafeAddBytes(name, value []byte) {
|
||||
b.add = append(b.add, Label{Name: string(name), Value: string(value)})
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build stringlabels
|
||||
//go:build !slicelabels && !dedupelabels
|
||||
|
||||
package labels
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build !stringlabels && !dedupelabels
|
||||
//go:build slicelabels
|
||||
|
||||
package labels
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build stringlabels
|
||||
//go:build !slicelabels && !dedupelabels
|
||||
|
||||
package labels
|
||||
|
||||
|
||||
@ -77,13 +77,13 @@ func TestNoDeadlock(t *testing.T) {
|
||||
|
||||
func labelsWithHashCollision() (labels.Labels, labels.Labels) {
|
||||
// These two series have the same XXHash; thanks to https://github.com/pstibrany/labels_hash_collisions
|
||||
ls1 := labels.FromStrings("__name__", "metric", "lbl1", "value", "lbl2", "l6CQ5y")
|
||||
ls2 := labels.FromStrings("__name__", "metric", "lbl1", "value", "lbl2", "v7uDlF")
|
||||
ls1 := labels.FromStrings("__name__", "metric", "lbl", "HFnEaGl")
|
||||
ls2 := labels.FromStrings("__name__", "metric", "lbl", "RqcXatm")
|
||||
|
||||
if ls1.Hash() != ls2.Hash() {
|
||||
// These ones are the same when using -tags stringlabels
|
||||
ls1 = labels.FromStrings("__name__", "metric", "lbl", "HFnEaGl")
|
||||
ls2 = labels.FromStrings("__name__", "metric", "lbl", "RqcXatm")
|
||||
// These ones are the same when using -tags slicelabels
|
||||
ls1 = labels.FromStrings("__name__", "metric", "lbl1", "value", "lbl2", "l6CQ5y")
|
||||
ls2 = labels.FromStrings("__name__", "metric", "lbl1", "value", "lbl2", "v7uDlF")
|
||||
}
|
||||
|
||||
if ls1.Hash() != ls2.Hash() {
|
||||
|
||||
@ -6286,13 +6286,13 @@ func TestHeadCompactionWhileAppendAndCommitExemplar(t *testing.T) {
|
||||
|
||||
func labelsWithHashCollision() (labels.Labels, labels.Labels) {
|
||||
// These two series have the same XXHash; thanks to https://github.com/pstibrany/labels_hash_collisions
|
||||
ls1 := labels.FromStrings("__name__", "metric", "lbl1", "value", "lbl2", "l6CQ5y")
|
||||
ls2 := labels.FromStrings("__name__", "metric", "lbl1", "value", "lbl2", "v7uDlF")
|
||||
ls1 := labels.FromStrings("__name__", "metric", "lbl", "HFnEaGl")
|
||||
ls2 := labels.FromStrings("__name__", "metric", "lbl", "RqcXatm")
|
||||
|
||||
if ls1.Hash() != ls2.Hash() {
|
||||
// These ones are the same when using -tags stringlabels
|
||||
ls1 = labels.FromStrings("__name__", "metric", "lbl", "HFnEaGl")
|
||||
ls2 = labels.FromStrings("__name__", "metric", "lbl", "RqcXatm")
|
||||
// These ones are the same when using -tags slicelabels
|
||||
ls1 = labels.FromStrings("__name__", "metric", "lbl1", "value", "lbl2", "l6CQ5y")
|
||||
ls2 = labels.FromStrings("__name__", "metric", "lbl1", "value", "lbl2", "v7uDlF")
|
||||
}
|
||||
|
||||
if ls1.Hash() != ls2.Hash() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user