Open aabmass opened 3 years ago
Fix:
diff --git a/internal/validation/mock_metric_validation.go b/internal/validation/mock_metric_validation.go
index 61c65d6..0ddc4ea 100644
--- a/internal/validation/mock_metric_validation.go
+++ b/internal/validation/mock_metric_validation.go
@@ -472,12 +472,14 @@ func serializeTimeSeries(ts *monitoring.TimeSeries) string {
}
// Add resource type.
- result.WriteString("-" + ts.Resource.Type + "-")
+ if ts.Resource != nil {
+ result.WriteString("-" + ts.Resource.Type + "-")
- // Add resource labels.
- for k, v := range ts.Resource.Labels {
- result.WriteString(k + " ")
- result.WriteString(v + " ")
+ // Add resource labels.
+ for k, v := range ts.Resource.Labels {
+ result.WriteString(k + " ")
+ result.WriteString(v + " ")
+ }
}
return result.String()
Mock server crashes when sending the following request without a
Resource
:repro
Invoke
CreateTimeSeries
:Output: