Skip to content

Commit

Permalink
Remote write compliance updates (#9196)
Browse files Browse the repository at this point in the history
  • Loading branch information
helenosheaa committed Apr 27, 2021
1 parent 598990b commit fe352db
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -99,7 +99,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.7.1
github.com/prometheus/client_model v0.2.0
github.com/prometheus/common v0.13.0
github.com/prometheus/common v0.15.0
github.com/prometheus/procfs v0.1.3
github.com/prometheus/prometheus v1.8.2-0.20200911110723-e83ef207b6c2
github.com/riemann/riemann-go-client v0.5.0
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Expand Up @@ -960,8 +960,9 @@ github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+
github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
github.com/prometheus/common v0.13.0 h1:vJlpe9wPgDRM1Z+7Wj3zUUjY1nr6/1jNKyl7llliccg=
github.com/prometheus/common v0.13.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s=
github.com/prometheus/common v0.15.0 h1:4fgOnadei3EZvgRwxJ7RMpG1k1pOZth5Pc13tyspaKM=
github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
Expand Down
Expand Up @@ -274,6 +274,11 @@ func (s *Serializer) createLabels(metric telegraf.Metric) []prompb.Label {
continue
}

// remove tags with empty values
if tag.Value == "" {
continue
}

labels = append(labels, prompb.Label{Name: name, Value: tag.Value})
}

Expand Down
Expand Up @@ -613,6 +613,28 @@ cpu_time_user{cpu="cpu3"} 94148
expected: []byte(`
rpc_duration_seconds_count 2693
rpc_duration_seconds_sum 17560473
`),
},
{
name: "empty label string value",
config: FormatConfig{
MetricSortOrder: SortMetrics,
StringHandling: StringAsLabel,
},
metrics: []telegraf.Metric{
testutil.MustMetric(
"prometheus",
map[string]string{
"cpu": "",
},
map[string]interface{}{
"time_idle": 42.0,
},
time.Unix(0, 0),
),
},
expected: []byte(`
time_idle 42
`),
},
}
Expand Down

0 comments on commit fe352db

Please sign in to comment.