[PRW 2.0] Moved rw2 proto to the full path (both package name and placement) (#13973)

undefined
This commit is contained in:
Bartlomiej Plotka 2024-05-08 09:08:00 +02:00 committed by GitHub
parent 7b88101cf5
commit 6673c346e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 194 additions and 196 deletions

View file

@ -25,7 +25,7 @@ func (h Histogram) IsFloatHistogram() bool {
return ok
}
func (m *WriteRequest) OptimizedMarshal(dst []byte) ([]byte, error) {
func (m *Request) OptimizedMarshal(dst []byte) ([]byte, error) {
siz := m.Size()
if cap(dst) < siz {
dst = make([]byte, siz)
@ -41,7 +41,7 @@ func (m *WriteRequest) OptimizedMarshal(dst []byte) ([]byte, error) {
// OptimizedMarshalToSizedBuffer is mostly a copy of the generated MarshalToSizedBuffer,
// but calls OptimizedMarshalToSizedBuffer on the timeseries.
func (m *WriteRequest) OptimizedMarshalToSizedBuffer(dAtA []byte) (int, error) {
func (m *Request) OptimizedMarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int

View file

@ -23,7 +23,7 @@ func TestOptimizedMarshal(t *testing.T) {
tests := []struct {
name string
m *WriteRequest
m *Request
}{
// {
// name: "empty",
@ -31,7 +31,7 @@ func TestOptimizedMarshal(t *testing.T) {
// },
{
name: "simple",
m: &WriteRequest{
m: &Request{
Timeseries: []TimeSeries{
{
LabelsRefs: []uint32{
@ -90,7 +90,7 @@ func TestOptimizedMarshal(t *testing.T) {
require.Equal(t, expected, got)
// round trip
m := &WriteRequest{}
m := &Request{}
require.NoError(t, m.Unmarshal(got))
require.Equal(t, tt.m, m)
})

View file

@ -1,5 +1,5 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: write/v2/types.proto
// source: io/prometheus/write/v2/types.proto
package writev2
@ -64,7 +64,7 @@ func (x Metadata_MetricType) String() string {
}
func (Metadata_MetricType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_4919b8b88a093366, []int{4, 0}
return fileDescriptor_f139519efd9fa8d7, []int{4, 0}
}
type Histogram_ResetHint int32
@ -95,40 +95,44 @@ func (x Histogram_ResetHint) String() string {
}
func (Histogram_ResetHint) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_4919b8b88a093366, []int{5, 0}
return fileDescriptor_f139519efd9fa8d7, []int{5, 0}
}
// WriteRequest represents a Remote Write 2.0 request to write given time series
// to remote destination. Note that Remote Write 2.0 requires a content
// negotiation for version and compressions, explained in
// https://docs.google.com/document/d/1jx1fqpRnM0pAndeo3AgY7g6BLxN3Ah8R0Mm8RvNsHoU/edit
// TODO(bwplotka): Change URL to Prometheus docs once ready.
type WriteRequest struct {
// symbols contains de-duplicated array of string elements used for various
// items in WriteRequest like labels and some metadata items. To decode
// Request represents a request to write the given timeseries to a remote destination.
// This was introduced in the Remote Write 2.0 specification:
// https://prometheus.io/docs/concepts/remote_write_spec_2_0/
// The canonical Content-Type request header value for this message is
// "application/x-protobuf;proto=io.prometheus.write.v2.Request"
//
// NOTE: gogoproto options might change in future for this file, they
// 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
type Request struct {
// symbols contains a de-duplicated array of string elements used for various
// items in a Request message, like labels and metadata items. To decode
// each of those items, 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 client, server should not assume any particular encoding.
Symbols []string `protobuf:"bytes,1,rep,name=symbols,proto3" json:"symbols,omitempty"`
// timeseries represents array of distinct series with 0 or more samples.
// timeseries represents an array of distinct series with 0 or more samples.
Timeseries []TimeSeries `protobuf:"bytes,2,rep,name=timeseries,proto3" json:"timeseries"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *WriteRequest) Reset() { *m = WriteRequest{} }
func (m *WriteRequest) String() string { return proto.CompactTextString(m) }
func (*WriteRequest) ProtoMessage() {}
func (*WriteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_4919b8b88a093366, []int{0}
func (m *Request) Reset() { *m = Request{} }
func (m *Request) String() string { return proto.CompactTextString(m) }
func (*Request) ProtoMessage() {}
func (*Request) Descriptor() ([]byte, []int) {
return fileDescriptor_f139519efd9fa8d7, []int{0}
}
func (m *WriteRequest) XXX_Unmarshal(b []byte) error {
func (m *Request) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *WriteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_WriteRequest.Marshal(b, m, deterministic)
return xxx_messageInfo_Request.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
@ -138,26 +142,26 @@ func (m *WriteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return b[:n], nil
}
}
func (m *WriteRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_WriteRequest.Merge(m, src)
func (m *Request) XXX_Merge(src proto.Message) {
xxx_messageInfo_Request.Merge(m, src)
}
func (m *WriteRequest) XXX_Size() int {
func (m *Request) XXX_Size() int {
return m.Size()
}
func (m *WriteRequest) XXX_DiscardUnknown() {
xxx_messageInfo_WriteRequest.DiscardUnknown(m)
func (m *Request) XXX_DiscardUnknown() {
xxx_messageInfo_Request.DiscardUnknown(m)
}
var xxx_messageInfo_WriteRequest proto.InternalMessageInfo
var xxx_messageInfo_Request proto.InternalMessageInfo
func (m *WriteRequest) GetSymbols() []string {
func (m *Request) GetSymbols() []string {
if m != nil {
return m.Symbols
}
return nil
}
func (m *WriteRequest) GetTimeseries() []TimeSeries {
func (m *Request) GetTimeseries() []TimeSeries {
if m != nil {
return m.Timeseries
}
@ -167,45 +171,36 @@ func (m *WriteRequest) GetTimeseries() []TimeSeries {
// TimeSeries represents a single series.
type TimeSeries struct {
// labels_refs is a list of label name-value pair references, encoded
// as indices to the WriteRequest.symbols array. This list's len is always
// a multiple of 2, and the underlying labels should be sorted.
// as indices to the Request.symbols array. This list's length is always
// a multiple of two, and the underlying labels should be sorted.
//
// Note that there might be multiple TimeSeries objects in the same
// WriteRequests with the same labels e.g. for different exemplars, metadata
// Requests with the same labels e.g. for different exemplars, metadata
// or created timestamp.
LabelsRefs []uint32 `protobuf:"varint,1,rep,packed,name=labels_refs,json=labelsRefs,proto3" json:"labels_refs,omitempty"`
// samples contain zero or more samples for a given timeseries. For typical
// clients, in healthy cases, there will be only one sample, for ~real
// time metric streaming. Samples can, in theory, co-exist with histogram samples
// (histograms field), although it should be extremely rare in practice (e.g.
// only when classic histogram series and native histogram share exactly the
// same metric name).
// Timeseries messages can either specify samples or (native) histogram samples
// (histogram field), but not both. For typical clients (~real-time metric
// streaming), in healthy cases, there will be only one sample or histogram.
//
// Samples are sorted by timestamp (older first).
Samples []Sample `protobuf:"bytes,2,rep,name=samples,proto3" json:"samples"`
// histograms contain zero or more histogram samples for a given timeseries.
// For typical clients, in healthy cases, there will be only one sample, for ~real
// time metric streaming. histograms can co-exist with samples (see samples
// for details).
//
// histograms are sorted by timestamp (older first).
// Samples and histograms are sorted by timestamp (older first).
Samples []Sample `protobuf:"bytes,2,rep,name=samples,proto3" json:"samples"`
Histograms []Histogram `protobuf:"bytes,3,rep,name=histograms,proto3" json:"histograms"`
// exemplars represents optional set of exemplars attached to this series' samples.
// exemplars represents an optional set of exemplars attached to this series' samples.
Exemplars []Exemplar `protobuf:"bytes,4,rep,name=exemplars,proto3" json:"exemplars"`
// metadata represents the metadata associated with the given series' samples.
Metadata Metadata `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata"`
// created_timestamp represents an optional created timestamp associated with
// this series' samples in ms format, typically for counter or histogram type
// metrics. Note that some servers might require this and in return fail to
// ingest such series within the WriteRequest.
// ingest such samples within the Request.
//
// For Go, see github.com/prometheus/prometheus/model/timestamp/timestamp.go
// for conversion from/to time.Time to Prometheus timestamp.
//
// NOTE: Optional key word is omitted due to
// Note that the "optional" keyword is omitted due to
// https://cloud.google.com/apis/design/design_patterns.md#optional_primitive_fields
// Zero value means value not set. If you need to use exactly zero value for
// timestamp, use 1 millisecond before or after.
// the timestamp, use 1 millisecond before or after.
CreatedTimestamp int64 `protobuf:"varint,6,opt,name=created_timestamp,json=createdTimestamp,proto3" json:"created_timestamp,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@ -216,7 +211,7 @@ func (m *TimeSeries) Reset() { *m = TimeSeries{} }
func (m *TimeSeries) String() string { return proto.CompactTextString(m) }
func (*TimeSeries) ProtoMessage() {}
func (*TimeSeries) Descriptor() ([]byte, []int) {
return fileDescriptor_4919b8b88a093366, []int{1}
return fileDescriptor_f139519efd9fa8d7, []int{1}
}
func (m *TimeSeries) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -292,7 +287,7 @@ func (m *TimeSeries) GetCreatedTimestamp() int64 {
// the metric changes.
type Exemplar struct {
// labels_refs is a list of label name-value pair references, encoded
// as indices to the WriteRequest.symbols array. This list's len is always
// as indices to the Request.symbols array. This list's len is always
// a multiple of 2, and the underlying labels should be sorted.
LabelsRefs []uint32 `protobuf:"varint,1,rep,packed,name=labels_refs,json=labelsRefs,proto3" json:"labels_refs,omitempty"`
// value represents an exact example value. This can be useful when the exemplar
@ -302,10 +297,10 @@ type Exemplar struct {
// For Go, see github.com/prometheus/prometheus/model/timestamp/timestamp.go
// for conversion from/to time.Time to Prometheus timestamp.
//
// NOTE: Optional key word is omitted due to
// Note that the "optional" keyword is omitted due to
// https://cloud.google.com/apis/design/design_patterns.md#optional_primitive_fields
// Zero value means value not set. If you need to use exactly zero value for
// timestamp, use 1 millisecond before or after.
// the timestamp, use 1 millisecond before or after.
Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@ -316,7 +311,7 @@ func (m *Exemplar) Reset() { *m = Exemplar{} }
func (m *Exemplar) String() string { return proto.CompactTextString(m) }
func (*Exemplar) ProtoMessage() {}
func (*Exemplar) Descriptor() ([]byte, []int) {
return fileDescriptor_4919b8b88a093366, []int{2}
return fileDescriptor_f139519efd9fa8d7, []int{2}
}
func (m *Exemplar) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -383,7 +378,7 @@ func (m *Sample) Reset() { *m = Sample{} }
func (m *Sample) String() string { return proto.CompactTextString(m) }
func (*Sample) ProtoMessage() {}
func (*Sample) Descriptor() ([]byte, []int) {
return fileDescriptor_4919b8b88a093366, []int{3}
return fileDescriptor_f139519efd9fa8d7, []int{3}
}
func (m *Sample) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -428,11 +423,11 @@ func (m *Sample) GetTimestamp() int64 {
// Metadata represents the metadata associated with the given series' samples.
type Metadata struct {
Type Metadata_MetricType `protobuf:"varint,1,opt,name=type,proto3,enum=write.v2.Metadata_MetricType" json:"type,omitempty"`
// help_ref is a reference to the WriteRequest.symbols array representing help
Type Metadata_MetricType `protobuf:"varint,1,opt,name=type,proto3,enum=io.prometheus.write.v2.Metadata_MetricType" json:"type,omitempty"`
// help_ref is a reference to the Request.symbols array representing help
// text for the metric.
HelpRef uint32 `protobuf:"varint,3,opt,name=help_ref,json=helpRef,proto3" json:"help_ref,omitempty"`
// unit_ref is a reference to the WriteRequest.symbols array representing unit
// unit_ref is a reference to the Request.symbols array representing unit
// for the metric.
UnitRef uint32 `protobuf:"varint,4,opt,name=unit_ref,json=unitRef,proto3" json:"unit_ref,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -444,7 +439,7 @@ func (m *Metadata) Reset() { *m = Metadata{} }
func (m *Metadata) String() string { return proto.CompactTextString(m) }
func (*Metadata) ProtoMessage() {}
func (*Metadata) Descriptor() ([]byte, []int) {
return fileDescriptor_4919b8b88a093366, []int{4}
return fileDescriptor_f139519efd9fa8d7, []int{4}
}
func (m *Metadata) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -544,7 +539,7 @@ type Histogram struct {
// float histograms.
PositiveDeltas []int64 `protobuf:"zigzag64,12,rep,packed,name=positive_deltas,json=positiveDeltas,proto3" json:"positive_deltas,omitempty"`
PositiveCounts []float64 `protobuf:"fixed64,13,rep,packed,name=positive_counts,json=positiveCounts,proto3" json:"positive_counts,omitempty"`
ResetHint Histogram_ResetHint `protobuf:"varint,14,opt,name=reset_hint,json=resetHint,proto3,enum=write.v2.Histogram_ResetHint" json:"reset_hint,omitempty"`
ResetHint Histogram_ResetHint `protobuf:"varint,14,opt,name=reset_hint,json=resetHint,proto3,enum=io.prometheus.write.v2.Histogram_ResetHint" json:"reset_hint,omitempty"`
// timestamp represents timestamp of the sample in ms.
// For Go, see github.com/prometheus/prometheus/model/timestamp/timestamp.go
// for conversion from/to time.Time to Prometheus timestamp.
@ -586,7 +581,7 @@ func (m *Histogram) Reset() { *m = Histogram{} }
func (m *Histogram) String() string { return proto.CompactTextString(m) }
func (*Histogram) ProtoMessage() {}
func (*Histogram) Descriptor() ([]byte, []int) {
return fileDescriptor_4919b8b88a093366, []int{5}
return fileDescriptor_f139519efd9fa8d7, []int{5}
}
func (m *Histogram) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -796,7 +791,7 @@ func (m *BucketSpan) Reset() { *m = BucketSpan{} }
func (m *BucketSpan) String() string { return proto.CompactTextString(m) }
func (*BucketSpan) ProtoMessage() {}
func (*BucketSpan) Descriptor() ([]byte, []int) {
return fileDescriptor_4919b8b88a093366, []int{6}
return fileDescriptor_f139519efd9fa8d7, []int{6}
}
func (m *BucketSpan) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -840,81 +835,84 @@ func (m *BucketSpan) GetLength() uint32 {
}
func init() {
proto.RegisterEnum("write.v2.Metadata_MetricType", Metadata_MetricType_name, Metadata_MetricType_value)
proto.RegisterEnum("write.v2.Histogram_ResetHint", Histogram_ResetHint_name, Histogram_ResetHint_value)
proto.RegisterType((*WriteRequest)(nil), "write.v2.WriteRequest")
proto.RegisterType((*TimeSeries)(nil), "write.v2.TimeSeries")
proto.RegisterType((*Exemplar)(nil), "write.v2.Exemplar")
proto.RegisterType((*Sample)(nil), "write.v2.Sample")
proto.RegisterType((*Metadata)(nil), "write.v2.Metadata")
proto.RegisterType((*Histogram)(nil), "write.v2.Histogram")
proto.RegisterType((*BucketSpan)(nil), "write.v2.BucketSpan")
proto.RegisterEnum("io.prometheus.write.v2.Metadata_MetricType", Metadata_MetricType_name, Metadata_MetricType_value)
proto.RegisterEnum("io.prometheus.write.v2.Histogram_ResetHint", Histogram_ResetHint_name, Histogram_ResetHint_value)
proto.RegisterType((*Request)(nil), "io.prometheus.write.v2.Request")
proto.RegisterType((*TimeSeries)(nil), "io.prometheus.write.v2.TimeSeries")
proto.RegisterType((*Exemplar)(nil), "io.prometheus.write.v2.Exemplar")
proto.RegisterType((*Sample)(nil), "io.prometheus.write.v2.Sample")
proto.RegisterType((*Metadata)(nil), "io.prometheus.write.v2.Metadata")
proto.RegisterType((*Histogram)(nil), "io.prometheus.write.v2.Histogram")
proto.RegisterType((*BucketSpan)(nil), "io.prometheus.write.v2.BucketSpan")
}
func init() { proto.RegisterFile("write/v2/types.proto", fileDescriptor_4919b8b88a093366) }
var fileDescriptor_4919b8b88a093366 = []byte{
// 897 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xdd, 0x6e, 0x1b, 0x45,
0x14, 0xce, 0x78, 0x1d, 0xff, 0x9c, 0xd8, 0xee, 0x7a, 0xea, 0xb4, 0xdb, 0x40, 0x53, 0x63, 0x04,
0x58, 0x20, 0x39, 0x60, 0x10, 0x12, 0x28, 0x37, 0x76, 0xba, 0x89, 0x7d, 0x61, 0xa7, 0x1a, 0x6f,
0x40, 0xe1, 0x66, 0xb5, 0xb1, 0xc7, 0xf6, 0x8a, 0xfd, 0x63, 0x67, 0x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e, 0x1a, 0x7b, 0xcb, 0x87, 0xa1, 0x91,
0xe3, 0x6e, 0xf5, 0x99, 0x8a, 0x70, 0x13, 0xea, 0x39, 0x6c, 0x7a, 0xad, 0x16, 0xc4, 0x7e, 0xe4,
0xa0, 0x68, 0x13, 0x95, 0x61, 0x19, 0x0e, 0x65, 0x1b, 0x86, 0x35, 0x80, 0x6c, 0x8a, 0x3a, 0xe7,
0x00, 0x59, 0xcb, 0xc5, 0x20, 0xfb, 0xcb, 0x25, 0xa3, 0xd1, 0x66, 0x34, 0x49, 0x7c, 0x13, 0xb8,
0x43, 0xbd, 0x15, 0x5f, 0xcb, 0x85, 0xa8, 0x93, 0xf8, 0x36, 0x3c, 0x7e, 0xfb, 0x70, 0x8a, 0xfe,
0x7a, 0x38, 0x45, 0xff, 0x3d, 0x9c, 0xa2, 0x9f, 0xca, 0xb2, 0x69, 0xdb, 0xfe, 0x5d, 0x49, 0xfe,
0x16, 0x7e, 0xfd, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd6, 0x86, 0xd6, 0x1e, 0x43, 0x07, 0x00,
0x00,
func init() {
proto.RegisterFile("io/prometheus/write/v2/types.proto", fileDescriptor_f139519efd9fa8d7)
}
func (m *WriteRequest) Marshal() (dAtA []byte, err error) {
var fileDescriptor_f139519efd9fa8d7 = []byte{
// 915 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, 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1, 0xef, 0x25, 0xa6, 0x2f,
0xa0, 0x9e, 0xa5, 0xc6, 0x27, 0x70, 0x4c, 0xc4, 0x84, 0x5b, 0xc3, 0xd1, 0xc4, 0x7c, 0xb0, 0xa6,
0x18, 0x9a, 0x85, 0xd8, 0xb5, 0x31, 0x53, 0x11, 0x3e, 0x80, 0x46, 0x01, 0x9b, 0x4c, 0xd5, 0x92,
0xd8, 0xa4, 0x02, 0x14, 0xef, 0xac, 0x32, 0xa8, 0xc2, 0xae, 0x6c, 0xca, 0x60, 0x1f, 0x20, 0x9f,
0x37, 0xfd, 0x0d, 0x40, 0xfe, 0x01, 0xc4, 0xc8, 0x07, 0xcb, 0x25, 0xa3, 0xf1, 0x0e, 0x1d, 0x90,
0xe4, 0x26, 0x70, 0x97, 0xfa, 0x2b, 0xbe, 0x96, 0xab, 0xd3, 0x20, 0xc9, 0x6d, 0x70, 0xf4, 0xee,
0xae, 0x85, 0x7e, 0xbf, 0x6b, 0xa1, 0xbf, 0xee, 0x5a, 0xe8, 0x87, 0xaa, 0x6c, 0xda, 0xb6, 0x7f,
0x53, 0x91, 0x7f, 0xc2, 0x5f, 0xff, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x14, 0x33, 0x22, 0x66, 0xd8,
0x07, 0x00, 0x00,
}
func (m *Request) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
@ -924,12 +922,12 @@ func (m *WriteRequest) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil
}
func (m *WriteRequest) MarshalTo(dAtA []byte) (int, error) {
func (m *Request) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *WriteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
@ -1470,7 +1468,7 @@ func encodeVarintTypes(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
return base
}
func (m *WriteRequest) Size() (n int) {
func (m *Request) Size() (n int) {
if m == nil {
return 0
}
@ -1728,7 +1726,7 @@ func sovTypes(x uint64) (n int) {
func sozTypes(x uint64) (n int) {
return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *WriteRequest) Unmarshal(dAtA []byte) error {
func (m *Request) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@ -1751,10 +1749,10 @@ func (m *WriteRequest) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: WriteRequest: wiretype end group for non-group")
return fmt.Errorf("proto: Request: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: WriteRequest: illegal tag %d (wire type %d)", fieldNum, wire)
return fmt.Errorf("proto: Request: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:

View file

@ -1,4 +1,4 @@
// Copyright 2017 Prometheus Team
// 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
@ -11,58 +11,55 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// NOTE: This file is also available on https://buf.build/prometheus/prometheus/docs/main:io.prometheus.write.v2
syntax = "proto3";
package write.v2;
package io.prometheus.write.v2;
option go_package = "writev2";
import "gogoproto/gogo.proto";
// WriteRequest represents a Remote Write 2.0 request to write given time series
// to remote destination. Note that Remote Write 2.0 requires a content
// negotiation for version and compressions, explained in
// https://docs.google.com/document/d/1jx1fqpRnM0pAndeo3AgY7g6BLxN3Ah8R0Mm8RvNsHoU/edit
// TODO(bwplotka): Change URL to Prometheus docs once ready.
message WriteRequest {
// symbols contains de-duplicated array of string elements used for various
// items in WriteRequest like labels and some metadata items. To decode
// Request represents a request to write the given timeseries to a remote destination.
// This was introduced in the Remote Write 2.0 specification:
// https://prometheus.io/docs/concepts/remote_write_spec_2_0/
// The canonical Content-Type request header value for this message is
// "application/x-protobuf;proto=io.prometheus.write.v2.Request"
//
// NOTE: gogoproto options might change in future for this file, they
// 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 {
// symbols contains a de-duplicated array of string elements used for various
// items in a Request message, like labels and metadata items. To decode
// each of those items, 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 client, server should not assume any particular encoding.
repeated string symbols = 1;
// timeseries represents array of distinct series with 0 or more samples.
// timeseries represents an array of distinct series with 0 or more samples.
repeated TimeSeries timeseries = 2 [(gogoproto.nullable) = false];
}
// TimeSeries represents a single series.
message TimeSeries {
// labels_refs is a list of label name-value pair references, encoded
// as indices to the WriteRequest.symbols array. This list's len is always
// a multiple of 2, and the underlying labels should be sorted.
// as indices to the Request.symbols array. This list's length is always
// a multiple of two, and the underlying labels should be sorted.
//
// Note that there might be multiple TimeSeries objects in the same
// WriteRequests with the same labels e.g. for different exemplars, metadata
// Requests with the same labels e.g. for different exemplars, metadata
// or created timestamp.
repeated uint32 labels_refs = 1;
// samples contain zero or more samples for a given timeseries. For typical
// clients, in healthy cases, there will be only one sample, for ~real
// time metric streaming. Samples can, in theory, co-exist with histogram samples
// (histograms field), although it should be extremely rare in practice (e.g.
// only when classic histogram series and native histogram share exactly the
// same metric name).
// Timeseries messages can either specify samples or (native) histogram samples
// (histogram field), but not both. For typical clients (~real-time metric
// streaming), in healthy cases, there will be only one sample or histogram.
//
// Samples are sorted by timestamp (older first).
// Samples and histograms are sorted by timestamp (older first).
repeated Sample samples = 2 [(gogoproto.nullable) = false];
// histograms contain zero or more histogram samples for a given timeseries.
// For typical clients, in healthy cases, there will be only one sample, for ~real
// time metric streaming. histograms can co-exist with samples (see samples
// for details).
//
// histograms are sorted by timestamp (older first).
repeated Histogram histograms = 3 [(gogoproto.nullable) = false];
// exemplars represents optional set of exemplars attached to this series' samples.
// exemplars represents an optional set of exemplars attached to this series' samples.
repeated Exemplar exemplars = 4 [(gogoproto.nullable) = false];
// metadata represents the metadata associated with the given series' samples.
@ -71,15 +68,15 @@ message TimeSeries {
// created_timestamp represents an optional created timestamp associated with
// this series' samples in ms format, typically for counter or histogram type
// metrics. Note that some servers might require this and in return fail to
// ingest such series within the WriteRequest.
// ingest such samples within the Request.
//
// For Go, see github.com/prometheus/prometheus/model/timestamp/timestamp.go
// for conversion from/to time.Time to Prometheus timestamp.
//
// NOTE: Optional key word is omitted due to
// Note that the "optional" keyword is omitted due to
// https://cloud.google.com/apis/design/design_patterns.md#optional_primitive_fields
// Zero value means value not set. If you need to use exactly zero value for
// timestamp, use 1 millisecond before or after.
// the timestamp, use 1 millisecond before or after.
int64 created_timestamp = 6;
}
@ -88,7 +85,7 @@ message TimeSeries {
// the metric changes.
message Exemplar {
// labels_refs is a list of label name-value pair references, encoded
// as indices to the WriteRequest.symbols array. This list's len is always
// as indices to the Request.symbols array. This list's len is always
// a multiple of 2, and the underlying labels should be sorted.
repeated uint32 labels_refs = 1;
// value represents an exact example value. This can be useful when the exemplar
@ -97,11 +94,11 @@ message Exemplar {
// timestamp represents an optional timestamp of the example in ms.
// For Go, see github.com/prometheus/prometheus/model/timestamp/timestamp.go
// for conversion from/to time.Time to Prometheus timestamp.
//
// NOTE: Optional key word is omitted due to
//
// Note that the "optional" keyword is omitted due to
// https://cloud.google.com/apis/design/design_patterns.md#optional_primitive_fields
// Zero value means value not set. If you need to use exactly zero value for
// timestamp, use 1 millisecond before or after.
// the timestamp, use 1 millisecond before or after.
int64 timestamp = 3;
}
@ -128,10 +125,10 @@ message Metadata {
METRIC_TYPE_STATESET = 7;
}
MetricType type = 1;
// help_ref is a reference to the WriteRequest.symbols array representing help
// help_ref is a reference to the Request.symbols array representing help
// text for the metric.
uint32 help_ref = 3;
// unit_ref is a reference to the WriteRequest.symbols array representing unit
// unit_ref is a reference to the Request.symbols array representing unit
// for the metric.
uint32 unit_ref = 4;
}

View file

@ -42,7 +42,7 @@ for dir in ${DIRS}; do
./*.proto
protoc --gogofast_out=plugins=grpc:. -I=. \
-I="${GOGOPROTO_PATH}" \
./write/v2/*.proto
./io/prometheus/write/v2/*.proto
protoc --gogofast_out=Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,paths=source_relative:. -I=. \
-I="${GOGOPROTO_PATH}" \
./io/prometheus/client/*.proto

View file

@ -35,7 +35,7 @@ import (
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/model/metadata"
"github.com/prometheus/prometheus/prompb"
writev2 "github.com/prometheus/prometheus/prompb/write/v2"
writev2 "github.com/prometheus/prometheus/prompb/io/prometheus/write/v2"
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/tsdb/chunkenc"
"github.com/prometheus/prometheus/tsdb/chunks"
@ -1059,7 +1059,7 @@ func DecodeOTLPWriteRequest(r *http.Request) (pmetricotlp.ExportRequest, error)
return otlpReq, nil
}
func DecodeMinimizedWriteRequestStr(r io.Reader) (*writev2.WriteRequest, error) {
func DecodeMinimizedWriteRequestStr(r io.Reader) (*writev2.Request, error) {
compressed, err := io.ReadAll(r)
if err != nil {
return nil, err
@ -1070,7 +1070,7 @@ func DecodeMinimizedWriteRequestStr(r io.Reader) (*writev2.WriteRequest, error)
return nil, err
}
var req writev2.WriteRequest
var req writev2.Request
if err := proto.Unmarshal(reqBuf, &req); err != nil {
return nil, err
}
@ -1078,7 +1078,7 @@ func DecodeMinimizedWriteRequestStr(r io.Reader) (*writev2.WriteRequest, error)
return &req, nil
}
func MinimizedWriteRequestToWriteRequest(redReq *writev2.WriteRequest) (*prompb.WriteRequest, error) {
func MinimizedWriteRequestToWriteRequest(redReq *writev2.Request) (*prompb.WriteRequest, error) {
req := &prompb.WriteRequest{
Timeseries: make([]prompb.TimeSeries, len(redReq.Timeseries)),
// TODO handle metadata?

View file

@ -27,7 +27,7 @@ import (
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/prompb"
writev2 "github.com/prometheus/prometheus/prompb/write/v2"
writev2 "github.com/prometheus/prometheus/prompb/io/prometheus/write/v2"
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/tsdb/chunkenc"
"github.com/prometheus/prometheus/tsdb/chunks"
@ -77,7 +77,7 @@ var writeRequestFixture = &prompb.WriteRequest{
}
// writeRequestMinimizedFixture represents the same request as writeRequestFixture, but using the minimized representation.
var writeRequestMinimizedFixture = func() *writev2.WriteRequest {
var writeRequestMinimizedFixture = func() *writev2.Request {
st := newRwSymbolTable()
var labels []uint32
for _, s := range []string{
@ -97,7 +97,7 @@ var writeRequestMinimizedFixture = func() *writev2.WriteRequest {
st.RefStr(s)
}
return &writev2.WriteRequest{
return &writev2.Request{
Timeseries: []writev2.TimeSeries{
{
LabelsRefs: labels,

View file

@ -34,6 +34,8 @@ import (
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
"go.uber.org/atomic"
writev2 "github.com/prometheus/prometheus/prompb/io/prometheus/write/v2"
"github.com/prometheus/prometheus/config"
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"
@ -41,7 +43,6 @@ import (
"github.com/prometheus/prometheus/model/relabel"
"github.com/prometheus/prometheus/model/timestamp"
"github.com/prometheus/prometheus/prompb"
writev2 "github.com/prometheus/prometheus/prompb/write/v2"
"github.com/prometheus/prometheus/scrape"
"github.com/prometheus/prometheus/tsdb/chunks"
"github.com/prometheus/prometheus/tsdb/record"
@ -2233,7 +2234,7 @@ func buildV2WriteRequest(logger log.Logger, samples []writev2.TimeSeries, labels
level.Debug(logger).Log("msg", "dropped data due to their age", "droppedSamples", droppedSamples, "droppedExemplars", droppedExemplars, "droppedHistograms", droppedHistograms)
}
req := &writev2.WriteRequest{
req := &writev2.Request{
Symbols: labels,
Timeseries: timeSeries,
}

View file

@ -36,13 +36,14 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/atomic"
writev2 "github.com/prometheus/prometheus/prompb/io/prometheus/write/v2"
"github.com/prometheus/prometheus/config"
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/model/relabel"
"github.com/prometheus/prometheus/model/timestamp"
"github.com/prometheus/prometheus/prompb"
writev2 "github.com/prometheus/prometheus/prompb/write/v2"
"github.com/prometheus/prometheus/scrape"
"github.com/prometheus/prometheus/tsdb/chunks"
"github.com/prometheus/prometheus/tsdb/record"
@ -1129,7 +1130,7 @@ func (c *TestWriteClient) Store(_ context.Context, req []byte, attemptNos int, r
reqProto = &prompb.WriteRequest{}
err = proto.Unmarshal(reqBuf, reqProto)
case Version2:
var reqMin writev2.WriteRequest
var reqMin writev2.Request
err = proto.Unmarshal(reqBuf, &reqMin)
if err == nil {
reqProto, err = MinimizedWriteRequestToWriteRequest(&reqMin)

View file

@ -24,6 +24,8 @@ import (
"github.com/go-kit/log"
"github.com/go-kit/log/level"
writev2 "github.com/prometheus/prometheus/prompb/io/prometheus/write/v2"
"github.com/gogo/protobuf/proto"
"github.com/golang/snappy"
@ -33,7 +35,6 @@ import (
"github.com/prometheus/prometheus/model/exemplar"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/prompb"
writev2 "github.com/prometheus/prometheus/prompb/write/v2"
"github.com/prometheus/prometheus/storage"
otlptranslator "github.com/prometheus/prometheus/storage/remote/otlptranslator/prometheusremotewrite"
)
@ -204,7 +205,7 @@ func (h *writeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
err = h.write(r.Context(), &req)
case RemoteWriteVersion20HeaderValue:
// 2.0 request.
var reqMinStr writev2.WriteRequest
var reqMinStr writev2.Request
if err := proto.Unmarshal(decompressed, &reqMinStr); err != nil {
level.Error(h.logger).Log("msg", "Error decoding remote write request", "err", err.Error())
http.Error(w, err.Error(), http.StatusBadRequest)
@ -452,7 +453,7 @@ func (h *otlpWriteHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}
func (h *writeHandler) writeMinStr(ctx context.Context, req *writev2.WriteRequest) (err error) {
func (h *writeHandler) writeMinStr(ctx context.Context, req *writev2.Request) (err error) {
outOfOrderExemplarErrs := 0
app := h.appendable.Appender(ctx)