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

[chore] [exporter/splunkhec] Remove redundant state data and allocation #21765

Merged
merged 1 commit into from
May 10, 2023

Conversation

dmitryax
Copy link
Member

Remove redundant bufferState.index field and avoid an allocation when profiling and logs data are not send together which is the most common case

Before:

goos: darwin
goarch: arm64
pkg: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/splunkhecexporter
Benchmark_pushLogData_100_10_10_1024
Benchmark_pushLogData_100_10_10_1024-10     	     410	   2702689 ns/op	 2441942 B/op	   34326 allocs/op
Benchmark_pushLogData_10_100_100_1024
Benchmark_pushLogData_10_100_100_1024-10    	     409	   2672872 ns/op	 2443447 B/op	   34506 allocs/op
Benchmark_pushLogData_10_0_100_1024
Benchmark_pushLogData_10_0_100_1024-10      	     840	   1331842 ns/op	 1226277 B/op	   17175 allocs/op
Benchmark_pushLogData_10_100_0_1024
Benchmark_pushLogData_10_100_0_1024-10      	     836	   1336186 ns/op	 1231659 B/op	   17342 allocs/op
Benchmark_pushLogData_10_10_10_256
Benchmark_pushLogData_10_10_10_256-10       	    2034	    568102 ns/op	  557723 B/op	    7689 allocs/op
Benchmark_pushLogData_10_10_10_1024
Benchmark_pushLogData_10_10_10_1024-10      	    4033	    267946 ns/op	  252992 B/op	    3456 allocs/op
Benchmark_pushLogData_10_10_10_8K
Benchmark_pushLogData_10_10_10_8K-10        	    1746	    687386 ns/op	 1861394 B/op	    2683 allocs/op
Benchmark_pushLogData_10_10_10_1M
Benchmark_pushLogData_10_10_10_1M-10        	    1555	    988593 ns/op	 6039903 B/op	    2684 allocs/op
Benchmark_pushLogData_10_1_1_1024
Benchmark_pushLogData_10_1_1_1024-10        	   41257	     27364 ns/op	   36548 B/op	     351 allocs/op
BenchmarkPushLogRecords
BenchmarkPushLogRecords-10                  	  205251	      5427 ns/op	   31409 B/op	      13 allocs/op
PASS

After:

Benchmark_pushLogData_100_10_10_1024
Benchmark_pushLogData_100_10_10_1024-10     	     446	   2550308 ns/op	 2436061 B/op	   33992 allocs/op
Benchmark_pushLogData_10_100_100_1024
Benchmark_pushLogData_10_100_100_1024-10    	     447	   2605696 ns/op	 2437463 B/op	   34172 allocs/op
Benchmark_pushLogData_10_0_100_1024
Benchmark_pushLogData_10_0_100_1024-10      	     852	   1307304 ns/op	 1222155 B/op	   17008 allocs/op
Benchmark_pushLogData_10_100_0_1024
Benchmark_pushLogData_10_100_0_1024-10      	     836	   1300739 ns/op	 1227657 B/op	   17175 allocs/op
Benchmark_pushLogData_10_10_10_256
Benchmark_pushLogData_10_10_10_256-10       	    1970	    530659 ns/op	  553186 B/op	    7489 allocs/op
Benchmark_pushLogData_10_10_10_1024
Benchmark_pushLogData_10_10_10_1024-10      	    4017	    258693 ns/op	  252180 B/op	    3422 allocs/op
Benchmark_pushLogData_10_10_10_8K
Benchmark_pushLogData_10_10_10_8K-10        	    1958	    666062 ns/op	 1861313 B/op	    2681 allocs/op
Benchmark_pushLogData_10_10_10_1M
Benchmark_pushLogData_10_10_10_1M-10        	    1567	    936454 ns/op	 6039842 B/op	    2682 allocs/op
Benchmark_pushLogData_10_1_1_1024
Benchmark_pushLogData_10_1_1_1024-10        	   41476	     27076 ns/op	   36451 B/op	     347 allocs/op
BenchmarkPushLogRecords
BenchmarkPushLogRecords-10                  	  213703	      5317 ns/op	   31408 B/op	      13 allocs/op
PASS

Remove redundant bufferState.index field and avoid an allocation when profiling and logs data are not send together which is the most common case
@dmitryax dmitryax requested a review from a team May 10, 2023 19:29
@dmitryax dmitryax requested a review from atoulme as a code owner May 10, 2023 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants