From 321e5491efd71b34933084c40685c2395e49210a Mon Sep 17 00:00:00 2001 From: olagacek Date: Mon, 2 Sep 2019 17:43:47 +0200 Subject: [PATCH] Fix incorrect slice creation (#196) * Added mapping for kubernetes pod resource * Add mapping for k8s node resource * Extend k8s node test * Fix incorrect slice creation --- metrics_proto.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metrics_proto.go b/metrics_proto.go index a34d949..6e186aa 100644 --- a/metrics_proto.go +++ b/metrics_proto.go @@ -243,7 +243,7 @@ func (se *statsExporter) protoMetricToTimeSeries(ctx context.Context, mappedRsc metricType := se.metricTypeFromProto(metricName) metricLabelKeys := metric.GetMetricDescriptor().GetLabelKeys() metricKind, valueType := protoMetricDescriptorTypeToMetricKind(metric) - labelKeys := make([]string, len(metricLabelKeys)) + labelKeys := make([]string, 0, len(metricLabelKeys)) for _, key := range metricLabelKeys { labelKeys = append(labelKeys, sanitize(key.GetKey())) }