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

Send correct payload when doing JSON push requests #11

Merged
merged 2 commits into from
Dec 13, 2021
Merged

Conversation

chaudum
Copy link
Collaborator

@chaudum chaudum commented Dec 1, 2021

This implementation is not very efficient, as it makes use of the Batch struct that is designed for the usage with Protobufs.

$ go test -bench BenchmarkEncode -benchmem -benchtime 15s
goos: linux
goarch: amd64
pkg: github.com/grafana/xk6-loki
cpu: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
BenchmarkEncode/encode_protobuf-8         	79969106	       238.6 ns/op	     232 B/op	       2 allocs/op
BenchmarkEncode/encode_json-8             	 3477244	      5355 ns/op	    3384 B/op	      50 allocs/op
PASS
ok  	github.com/grafana/xk6-loki	43.172s

Signed-off-by: Christian Haudum christian.haudum@gmail.com

@chaudum chaudum force-pushed the chaudum/issue-9 branch 2 times, most recently from 01c400a to 1ddb2c2 Compare December 1, 2021 15:32
@chaudum chaudum marked this pull request as ready for review December 11, 2021 20:22
This implementation is rather inefficient as it depends on the `Batch`
struct that is optimized for Protobuf usage.

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
```console
$ go test -bench BenchmarkEncode -benchmem -benchtime 15s
goos: linux
goarch: amd64
pkg: github.com/grafana/xk6-loki
cpu: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
BenchmarkEncode/encode_protobuf-8         	79969106	       238.6 ns/op	     232 B/op	       2 allocs/op
BenchmarkEncode/encode_json-8             	 3477244	      5355 ns/op	    3384 B/op	      50 allocs/op
PASS
ok  	github.com/grafana/xk6-loki	43.172s
```

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
Copy link
Contributor

@vlad-diachenko vlad-diachenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants