Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update xk6-output-prometheus-remote to its latest main commit #3210

Merged
merged 1 commit into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/gorilla/websocket v1.5.0
github.com/grafana/xk6-browser v0.10.0
github.com/grafana/xk6-grpc v0.1.2
github.com/grafana/xk6-output-prometheus-remote v0.2.1
github.com/grafana/xk6-output-prometheus-remote v0.2.2-0.20230719110733-69f101ee8ade
github.com/grafana/xk6-redis v0.1.1
github.com/grafana/xk6-timers v0.1.2
github.com/grafana/xk6-webcrypto v0.1.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ github.com/grafana/xk6-browser v0.10.0 h1:Mnx0Ho+mlyFGlV7zW7zXkN0njRglh9JflLV+Oz
github.com/grafana/xk6-browser v0.10.0/go.mod h1:ax6OHARpNEu9hSGYOAI4grAwiRapsNPi9TBQxDYurKw=
github.com/grafana/xk6-grpc v0.1.2 h1:gNN3PYV2dIPoq1zTVz8YOxrWhl1D15jhRR0EA9ZYhBw=
github.com/grafana/xk6-grpc v0.1.2/go.mod h1:iq6qHN64XgAEmDHKf0OXZ4mvoqF4Udr22fiCIXNpXA0=
github.com/grafana/xk6-output-prometheus-remote v0.2.1 h1:/JOMHwByfCkFe17iokUDKCIjh8e5g0gqqnrg8zSnxf4=
github.com/grafana/xk6-output-prometheus-remote v0.2.1/go.mod h1:JWUOn1fY8Yp3dM+IaPSNMM6t+sF3aJ2AA7Qzs6lKGww=
github.com/grafana/xk6-output-prometheus-remote v0.2.2-0.20230719110733-69f101ee8ade h1:DY8H7hMVBpP4yuKlNnPBykL+WJ4hBobwT0BG8nDcFLw=
github.com/grafana/xk6-output-prometheus-remote v0.2.2-0.20230719110733-69f101ee8ade/go.mod h1:rI7naMHdQ+vLVoonZ6LYkrXz8ZiWIptTstVbV2CSahY=
github.com/grafana/xk6-redis v0.1.1 h1:rvWnLanRB2qzDwuY6NMBe6PXei3wJ3kjYvfCwRJ+q+8=
github.com/grafana/xk6-redis v0.1.1/go.mod h1:z7el1Tz8advY+ex419KfLbENzSQYgaA2lQYwMlt9yMM=
github.com/grafana/xk6-timers v0.1.2 h1:YVM6hPDgvy4SkdZQpd+/r9M0kDi1g+QdbSxW5ClfwDk=
Expand Down
2 changes: 1 addition & 1 deletion metrics/engine/ingester_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestIngesterOutputFlushMetrics(t *testing.T) {
assert.Equal(t, testMetric, metric)

sink := metric.Sink.(*metrics.TrendSink) //nolint:forcetypeassert
assert.Equal(t, 42.0, sink.Sum)
assert.Equal(t, 42.0, sink.Total())
}

func TestIngesterOutputFlushSubmetrics(t *testing.T) {
Expand Down
10 changes: 4 additions & 6 deletions metrics/sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ type TrendSink struct {

count uint64
min, max float64
// TODO: unexport after this dependency is removed:
// https://github.com/grafana/xk6-output-prometheus-remote/blob/v0.2.1/pkg/remotewrite/remotewrite.go#L173
Sum float64
sum float64
}

// IsEmpty indicates whether the TrendSink is empty.
Expand All @@ -122,7 +120,7 @@ func (t *TrendSink) Add(s Sample) {
t.values = append(t.values, s.Value)
t.sorted = false
t.count++
t.Sum += s.Value
t.sum += s.Value
}

// P calculates the given percentile from sink values.
Expand Down Expand Up @@ -167,14 +165,14 @@ func (t *TrendSink) Count() uint64 {
// Avg returns the average (i.e. mean) value.
func (t *TrendSink) Avg() float64 {
if t.count > 0 {
return t.Sum / float64(t.count)
return t.sum / float64(t.count)
}
return 0
}

// Total returns the total (i.e. "sum") value for all measurements.
func (t *TrendSink) Total() float64 {
return t.Sum
return t.sum
}

func (t *TrendSink) Format(tt time.Duration) map[string]float64 {
Expand Down

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

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

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ github.com/grafana/xk6-browser/storage
## explicit; go 1.19
github.com/grafana/xk6-grpc/grpc
github.com/grafana/xk6-grpc/lib/netext/grpcext
# github.com/grafana/xk6-output-prometheus-remote v0.2.1
# github.com/grafana/xk6-output-prometheus-remote v0.2.2-0.20230719110733-69f101ee8ade
## explicit; go 1.18
github.com/grafana/xk6-output-prometheus-remote/pkg/remote
github.com/grafana/xk6-output-prometheus-remote/pkg/remotewrite
Expand Down