Skip to content

Commit

Permalink
minor updates
Browse files Browse the repository at this point in the history
fix integration test
fix expdiff
better marking of debug stuff in timeseries

Signed-off-by: György Krajcsovits <[email protected]>
  • Loading branch information
krajorama committed Jan 16, 2025
1 parent 1e8c389 commit 377e37e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 29 deletions.
2 changes: 1 addition & 1 deletion integration/distributor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ func TestDistributorRemoteWrite2(t *testing.T) {
}

res, err := client.PushRW2(ser)
require.Error(t, err)
require.NoError(t, err)
require.True(t, res.StatusCode == http.StatusOK || res.StatusCode == http.StatusAccepted, res.Status)
}

Expand Down
20 changes: 10 additions & 10 deletions pkg/mimirpb/mimir.pb.go.expdiff
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/pkg/mimirpb/mimir.pb.go b/pkg/mimirpb/mimir.pb.go
index 2fcc5ccde1..0688358568 100644
index 36005dbcae..d6b7955d30 100644
--- a/pkg/mimirpb/mimir.pb.go
+++ b/pkg/mimirpb/mimir.pb.go
@@ -243,9 +243,6 @@ type WriteRequest struct {
@@ -282,9 +282,6 @@ type WriteRequest struct {
SkipLabelValidation bool `protobuf:"varint,1000,opt,name=skip_label_validation,json=skipLabelValidation,proto3" json:"skip_label_validation,omitempty"`
// Skip label count validation.
SkipLabelCountValidation bool `protobuf:"varint,1001,opt,name=skip_label_count_validation,json=skipLabelCountValidation,proto3" json:"skip_label_count_validation,omitempty"`
Expand All @@ -12,31 +12,31 @@ index 2fcc5ccde1..0688358568 100644
}

func (m *WriteRequest) Reset() { *m = WriteRequest{} }
@@ -392,9 +389,6 @@ type TimeSeries struct {
Samples []Sample `protobuf:"bytes,2,rep,name=samples,proto3" json:"samples"`
Exemplars []Exemplar `protobuf:"bytes,3,rep,name=exemplars,proto3" json:"exemplars"`
Histograms []Histogram `protobuf:"bytes,4,rep,name=histograms,proto3" json:"histograms"`
@@ -437,9 +434,6 @@ type TimeSeries struct {
// Zero value means value not set. If you need to use exactly zero value for
// the timestamp, use 1 millisecond before or after.
CreatedTimestamp int64 `protobuf:"varint,6,opt,name=created_timestamp,json=createdTimestamp,proto3" json:"created_timestamp,omitempty"`
-
- // Skip unmarshaling of exemplars.
- SkipUnmarshalingExemplars bool
}

func (m *TimeSeries) Reset() { *m = TimeSeries{} }
@@ -6212,7 +6206,6 @@ func (m *WriteRequest) Unmarshal(dAtA []byte) error {
@@ -7337,7 +7331,6 @@ func (m *WriteRequest) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
m.Timeseries = append(m.Timeseries, PreallocTimeseries{})
- m.Timeseries[len(m.Timeseries)-1].skipUnmarshalingExemplars = m.skipUnmarshalingExemplars
if err := m.Timeseries[len(m.Timeseries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
@@ -6585,11 +6578,9 @@ func (m *TimeSeries) Unmarshal(dAtA []byte) error {
@@ -7710,11 +7703,9 @@ func (m *TimeSeries) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
- if !m.SkipUnmarshalingExemplars {
- m.Exemplars = append(m.Exemplars, Exemplar{})
- if err := m.Exemplars[len(m.Exemplars)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
- m.Exemplars = append(m.Exemplars, Exemplar{})
- if err := m.Exemplars[len(m.Exemplars)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
- return err
- }
+ m.Exemplars = append(m.Exemplars, Exemplar{})
Expand Down
33 changes: 15 additions & 18 deletions pkg/mimirpb/timeseries.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (p *PreallocWriteRequest) unmarshalRW2(data []byte) error {
return err
}

// Debugging.
// For debugging.
metadataReceived := 0
metadataBytes := 0
metricFamilies := map[string]*MetricMetadata{}
Expand Down Expand Up @@ -159,33 +159,30 @@ func (p *PreallocWriteRequest) unmarshalRW2(data []byte) error {
Help: help,
Unit: unit,
}

// if strings.HasPrefix(seriesName, "cortex_request_duration_seconds") {
// fmt.Printf("KRAJO: seriesName=%v, metricFamily=%v, type=%v, help=%v, unit=%v\n", seriesName, metricFamily, metricFamilies[metricFamily].Type, help, unit)
// }
}

// Fill the metadata
p.Metadata = make([]*MetricMetadata, 0, len(metricFamilies))
for _, metadata := range metricFamilies {
// fmt.Printf("KRAJO: adding metadata %v\n", metadata)
p.Metadata = append(p.Metadata, metadata)
}

// Debugging
familyBytes := 0
for metricFamily, metadata := range metricFamilies {
familyBytes += len(metricFamily)
familyBytes += 4 // type
familyBytes += len(metadata.Help)
familyBytes += len(metadata.Unit)
}
{
// Debugging
familyBytes := 0
for metricFamily, metadata := range metricFamilies {
familyBytes += len(metricFamily)
familyBytes += 4 // type
familyBytes += len(metadata.Help)
familyBytes += len(metadata.Unit)
}

for symbol := range symbolsInMeta {
metadataBytes += len(rw2req.Symbols[symbol])
}
for symbol := range symbolsInMeta {
metadataBytes += len(rw2req.Symbols[symbol])
}

fmt.Printf("KRAJO: RW2 timeseries=%v, metadata=%v, series meta=%v bytes, family meta=%v bytes\n", len(p.Timeseries), metadataReceived, metadataBytes, familyBytes)
fmt.Printf("KRAJO: RW2 timeseries=%v, metadata=%v, series meta=%v bytes, family meta=%v bytes\n", len(p.Timeseries), metadataReceived, metadataBytes, familyBytes)
}

return nil
}
Expand Down

0 comments on commit 377e37e

Please sign in to comment.