[PRW 2.0] Updated spec proto (2.0-rc.1); deterministic v1 interop; to be sympathetic with implementation. (#14330)

* [PRW 2.0] Updated spec proto (2.0-rc.1); deterministic v1 interop; to be sympathetic with implementation.

Signed-off-by: bwplotka <bwplotka@gmail.com>

* update custom marshalling

Signed-off-by: bwplotka <bwplotka@gmail.com>

* Removed confusing comments.

Signed-off-by: bwplotka <bwplotka@gmail.com>

---------

Signed-off-by: bwplotka <bwplotka@gmail.com>
This commit is contained in:
Bartlomiej Plotka 2024-06-21 21:38:56 +02:00 committed by GitHub
parent 36830f64d1
commit 0c0883e3cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 172 additions and 68 deletions

View file

@ -61,7 +61,7 @@ func (m *Request) OptimizedMarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintTypes(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
dAtA[i] = 0x2a
}
}
if len(m.Symbols) > 0 {
@ -70,7 +70,7 @@ func (m *Request) OptimizedMarshalToSizedBuffer(dAtA []byte) (int, error) {
copy(dAtA[i:], m.Symbols[iNdEx])
i = encodeVarintTypes(dAtA, i, uint64(len(m.Symbols[iNdEx])))
i--
dAtA[i] = 0xa
dAtA[i] = 0x22
}
}
return len(dAtA) - i, nil

View file

@ -117,9 +117,9 @@ type Request struct {
// To decode each of the symbolized strings, referenced, by "ref(s)" suffix, you
// need to lookup the actual string by index from symbols array. The order of
// strings is up to the sender. The receiver should not assume any particular encoding.
Symbols []string `protobuf:"bytes,1,rep,name=symbols,proto3" json:"symbols,omitempty"`
Symbols []string `protobuf:"bytes,4,rep,name=symbols,proto3" json:"symbols,omitempty"`
// timeseries represents an array of distinct series with 0 or more samples.
Timeseries []TimeSeries `protobuf:"bytes,2,rep,name=timeseries,proto3" json:"timeseries"`
Timeseries []TimeSeries `protobuf:"bytes,5,rep,name=timeseries,proto3" json:"timeseries"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -865,65 +865,65 @@ func init() {
}
var fileDescriptor_f139519efd9fa8d7 = []byte{
// 915 bytes of a gzipped FileDescriptorProto
// 926 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0x5d, 0x6f, 0xe3, 0x44,
0x14, 0xed, 0xc4, 0x69, 0x3e, 0x6e, 0x9b, 0xac, 0x3b, 0xb4, 0x5d, 0x6f, 0x81, 0x6c, 0xd6, 0x08,
0x88, 0x58, 0x29, 0x91, 0xc2, 0xeb, 0x0a, 0xd4, 0xb4, 0x6e, 0x13, 0xa4, 0x24, 0xab, 0x89, 0x8b,
0x54, 0x5e, 0x2c, 0x37, 0x99, 0x24, 0x16, 0xfe, 0xc2, 0x33, 0x09, 0x94, 0xdf, 0xc7, 0xc3, 0x3e,
0xf2, 0x07, 0x40, 0xd0, 0x77, 0xfe, 0x03, 0x9a, 0xf1, 0x67, 0x0b, 0xed, 0x6a, 0xdf, 0x66, 0xce,
0x3d, 0xe7, 0xde, 0x93, 0xeb, 0x7b, 0x27, 0xa0, 0x3b, 0x41, 0x2f, 0x8c, 0x02, 0x8f, 0xf2, 0x35,
0xdd, 0xb0, 0xde, 0xcf, 0x91, 0xc3, 0x69, 0x6f, 0xdb, 0xef, 0xf1, 0xdb, 0x90, 0xb2, 0x6e, 0x18,
0x05, 0x3c, 0xc0, 0xc7, 0x4e, 0xd0, 0xcd, 0x39, 0x5d, 0xc9, 0xe9, 0x6e, 0xfb, 0x27, 0x87, 0xab,
0x60, 0x15, 0x48, 0x4a, 0x4f, 0x9c, 0x62, 0xb6, 0xee, 0x41, 0x95, 0xd0, 0x9f, 0x36, 0x94, 0x71,
0xac, 0x41, 0x95, 0xdd, 0x7a, 0x37, 0x81, 0xcb, 0x34, 0xd4, 0x56, 0x3a, 0x75, 0x92, 0x5e, 0xf1,
0x10, 0x80, 0x3b, 0x1e, 0x65, 0x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c, 0xde, 0x07, 0x00, 0x00,
}
func (m *Request) Marshal() (dAtA []byte, err error) {
@ -961,7 +961,7 @@ func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintTypes(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
dAtA[i] = 0x2a
}
}
if len(m.Symbols) > 0 {
@ -970,7 +970,7 @@ func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error) {
copy(dAtA[i:], m.Symbols[iNdEx])
i = encodeVarintTypes(dAtA, i, uint64(len(m.Symbols[iNdEx])))
i--
dAtA[i] = 0xa
dAtA[i] = 0x22
}
}
return len(dAtA) - i, nil
@ -1769,7 +1769,7 @@ func (m *Request) Unmarshal(dAtA []byte) error {
return fmt.Errorf("proto: Request: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Symbols", wireType)
}
@ -1801,7 +1801,7 @@ func (m *Request) Unmarshal(dAtA []byte) error {
}
m.Symbols = append(m.Symbols, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
case 2:
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Timeseries", wireType)
}

View file

@ -31,6 +31,13 @@ import "gogoproto/gogo.proto";
// are not part of the spec proto (they only modify the generated Go code, not
// the serialized message). See: https://github.com/prometheus/prometheus/issues/11908
message Request {
// Since Request supersedes 1.0 spec's prometheus.WriteRequest, we reserve the top-down message
// for the deterministic interop between those two, see types_test.go for details.
// Generally it's not needed, because Receivers must use the Content-Type header, but we want to
// be sympathetic to adopters with mistaken implementations and have deterministic error (empty
// message if you use the wrong proto schema).
reserved 1 to 3;
// symbols contains a de-duplicated array of string elements used for various
// items in a Request message, like labels and metadata items. For the sender's convenience
// around empty values for optional fields like unit_ref, symbols array MUST start with
@ -39,9 +46,9 @@ message Request {
// To decode each of the symbolized strings, referenced, by "ref(s)" suffix, you
// need to lookup the actual string by index from symbols array. The order of
// strings is up to the sender. The receiver should not assume any particular encoding.
repeated string symbols = 1;
repeated string symbols = 4;
// timeseries represents an array of distinct series with 0 or more samples.
repeated TimeSeries timeseries = 2 [(gogoproto.nullable) = false];
repeated TimeSeries timeseries = 5 [(gogoproto.nullable) = false];
}
// TimeSeries represents a single series.

View file

@ -0,0 +1,97 @@
// Copyright 2024 Prometheus Team
// 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 writev2
import (
"testing"
"time"
"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/require"
"github.com/prometheus/prometheus/prompb"
)
func TestInteropV2UnmarshalWithV1_DeterministicEmpty(t *testing.T) {
expectedV1Empty := &prompb.WriteRequest{}
for _, tc := range []struct{ incoming *Request }{
{
incoming: &Request{}, // Technically wrong, should be at least empty string in symbol.
},
{
incoming: &Request{
Symbols: []string{""},
}, // NOTE: Without reserved fields, failed with "corrupted" ghost TimeSeries element.
},
{
incoming: &Request{
Symbols: []string{"", "__name__", "metric1"},
Timeseries: []TimeSeries{
{LabelsRefs: []uint32{1, 2}},
{Samples: []Sample{{Value: 21.4, Timestamp: time.Now().UnixMilli()}}},
}, // NOTE: Without reserved fields, proto: illegal wireType 7
},
},
} {
t.Run("", func(t *testing.T) {
in, err := proto.Marshal(tc.incoming)
require.NoError(t, err)
// Test accidental unmarshal of v2 payload with v1 proto.
out := &prompb.WriteRequest{}
require.NoError(t, proto.Unmarshal(in, out))
// Drop unknowns, we expect them when incoming payload had some fields.
// This field & method will be likely gone after gogo removal.
out.XXX_unrecognized = nil // NOTE: out.XXX_DiscardUnknown() does not work with nullables.
require.Equal(t, expectedV1Empty, out)
})
}
}
func TestInteropV1UnmarshalWithV2_DeterministicEmpty(t *testing.T) {
expectedV2Empty := &Request{}
for _, tc := range []struct{ incoming *prompb.WriteRequest }{
{
incoming: &prompb.WriteRequest{},
},
{
incoming: &prompb.WriteRequest{
Timeseries: []prompb.TimeSeries{
{
Labels: []prompb.Label{{Name: "__name__", Value: "metric1"}},
Samples: []prompb.Sample{{Value: 21.4, Timestamp: time.Now().UnixMilli()}},
},
},
},
// NOTE: Without reserved fields, results in corrupted v2.Request.Symbols.
},
} {
t.Run("", func(t *testing.T) {
in, err := proto.Marshal(tc.incoming)
require.NoError(t, err)
// Test accidental unmarshal of v1 payload with v2 proto.
out := &Request{}
require.NoError(t, proto.Unmarshal(in, out))
// Drop unknowns, we expect them when incoming payload had some fields.
// This field & method will be likely gone after gogo removal.
out.XXX_unrecognized = nil // NOTE: out.XXX_DiscardUnknown() does not work with nullables.
require.Equal(t, expectedV2Empty, out)
})
}
}