Skip to content

Commit

Permalink
output/json: Removed tainted field
Browse files Browse the repository at this point in the history
The `metric.tainted` has been removed from the flushed struct because
metrics are flush only the first time a metric has been seen and tainted
will be updated only after so the tainted field's value hasn't been never different
from a null value.
  • Loading branch information
codebien committed Jul 14, 2022
1 parent a8a3452 commit 0127a50
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 23 deletions.
7 changes: 0 additions & 7 deletions output/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,6 @@ func (o *Output) handleMetric(m *metrics.Metric, jw *jwriter.Writer) {
wrapped.Data.Thresholds = ts
}

// TODO: refactor after the other refactors
// in the metrics area will be completed.
//
// This parts can be racy because
// they are controlled and written from the metrics.Engine.
wrapped.Data.Tainted = m.Tainted

wrapped.MarshalEasyJSON(jw)
jw.RawByte('\n')
}
12 changes: 0 additions & 12 deletions output/json/json_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions output/json/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ func generateTestMetricSamples(t testing.TB) ([]metrics.SampleContainer, func(io
metrics.Sample{Time: time3, Metric: metric2, Value: float64(5), Tags: metrics.NewSampleTags(map[string]string{"tag3": "val3"})},
}
expected := []string{
`{"type":"Metric","data":{"name":"my_metric1","type":"gauge","contains":"default","tainted":null,"thresholds":["rate<0.01","p(99)<250"],"submetrics":[{"name":"my_metric1{a:1,b:2}","suffix":"a:1,b:2","tags":{"a":"1","b":"2"}}]},"metric":"my_metric1"}`,
`{"type":"Metric","data":{"name":"my_metric1","type":"gauge","contains":"default","thresholds":["rate<0.01","p(99)<250"],"submetrics":[{"name":"my_metric1{a:1,b:2}","suffix":"a:1,b:2","tags":{"a":"1","b":"2"}}]},"metric":"my_metric1"}`,
`{"type":"Point","data":{"time":"2021-02-24T13:37:10Z","value":1,"tags":{"tag1":"val1"}},"metric":"my_metric1"}`,
`{"type":"Point","data":{"time":"2021-02-24T13:37:10Z","value":2,"tags":{"tag2":"val2"}},"metric":"my_metric1"}`,
`{"type":"Metric","data":{"name":"my_metric2","type":"counter","contains":"data","tainted":null,"thresholds":[],"submetrics":null},"metric":"my_metric2"}`,
`{"type":"Metric","data":{"name":"my_metric2","type":"counter","contains":"data","thresholds":[],"submetrics":null},"metric":"my_metric2"}`,
`{"type":"Point","data":{"time":"2021-02-24T13:37:20Z","value":3,"tags":{"key":"val"}},"metric":"my_metric2"}`,
`{"type":"Point","data":{"time":"2021-02-24T13:37:20Z","value":4,"tags":{"key":"val"}},"metric":"my_metric1"}`,
`{"type":"Point","data":{"time":"2021-02-24T13:37:30Z","value":5,"tags":{"tag3":"val3"}},"metric":"my_metric2"}`,
Expand Down
2 changes: 0 additions & 2 deletions output/json/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"time"

"go.k6.io/k6/metrics"
"gopkg.in/guregu/null.v3"
)

//go:generate easyjson -pkg -no_std_marshalers -gen_build_flags -mod=mod .
Expand Down Expand Up @@ -60,7 +59,6 @@ type metricEnvelope struct {
Name string `json:"name"`
Type metrics.MetricType `json:"type"`
Contains metrics.ValueType `json:"contains"`
Tainted null.Bool `json:"tainted"`
Thresholds metrics.Thresholds `json:"thresholds"`
Submetrics []*metrics.Submetric `json:"submetrics"`
} `json:"data"`
Expand Down

0 comments on commit 0127a50

Please sign in to comment.