@@ -1030,7 +1030,7 @@ func (d *Distributor) visitSampleSeries(req *distributormodel.PushRequest, visit
1030
1030
validation .DiscardedProfiles .WithLabelValues (string (validation .ReasonOf (err )), req .TenantID ).Add (float64 (req .TotalProfiles ))
1031
1031
validation .DiscardedBytes .WithLabelValues (string (validation .ReasonOf (err )), req .TenantID ).Add (float64 (req .TotalBytesUncompressed ))
1032
1032
usageGroups .CountDiscardedBytes (string (validation .ReasonOf (err )), req .TotalBytesUncompressed )
1033
- return err
1033
+ return connect . NewError ( connect . CodeInvalidArgument , err )
1034
1034
}
1035
1035
for _ , s := range visitor .series {
1036
1036
s .Annotations = series .Annotations
@@ -1045,8 +1045,13 @@ func (d *Distributor) visitSampleSeries(req *distributormodel.PushRequest, visit
1045
1045
}
1046
1046
}
1047
1047
1048
- validation .DiscardedBytes .WithLabelValues (string (validation .DroppedByRelabelRules ), req .TenantID ).Add (float64 (req .DiscardedBytesRelabeling ))
1049
- validation .DiscardedProfiles .WithLabelValues (string (validation .DroppedByRelabelRules ), req .TenantID ).Add (float64 (req .DiscardedProfilesRelabeling ))
1048
+ if req .DiscardedBytesRelabeling > 0 {
1049
+ validation .DiscardedBytes .WithLabelValues (string (validation .DroppedByRelabelRules ), req .TenantID ).Add (float64 (req .DiscardedBytesRelabeling ))
1050
+ }
1051
+ if req .DiscardedProfilesRelabeling > 0 {
1052
+ validation .DiscardedProfiles .WithLabelValues (string (validation .DroppedByRelabelRules ), req .TenantID ).Add (float64 (req .DiscardedProfilesRelabeling ))
1053
+ }
1054
+
1050
1055
req .Series = result
1051
1056
removeEmptySeries (req )
1052
1057
return nil
@@ -1075,10 +1080,7 @@ type sampleSeriesVisitor struct {
1075
1080
}
1076
1081
1077
1082
func (v * sampleSeriesVisitor ) ValidateLabels (labels phlaremodel.Labels ) error {
1078
- if err := validation .ValidateLabels (v .limits , v .tenantID , labels ); err != nil {
1079
- return connect .NewError (connect .CodeInvalidArgument , err )
1080
- }
1081
- return nil
1083
+ return validation .ValidateLabels (v .limits , v .tenantID , labels )
1082
1084
}
1083
1085
1084
1086
func (v * sampleSeriesVisitor ) VisitProfile (labels phlaremodel.Labels ) {
0 commit comments