|
| 1 | +[[benchmark-dotnet-data-shipper]] |
| 2 | +=== BenchmarkDotnet Exporter |
| 3 | + |
| 4 | +An exporter for https://github.com/dotnet/BenchmarkDotNet[BenchmarkDotnet] that will index benchmarking results directly into Elasticsearch. |
| 5 | + |
| 6 | +==== Installation |
| 7 | + |
| 8 | +Add a reference to the http://nuget.org/packages/Elastic.CommonSchema.BenchmarkDotNetExporter[Elastic.CommonSchema.BenchmarkDotNetExporter] package: |
| 9 | + |
| 10 | +[source,xml] |
| 11 | +[subs="attributes"] |
| 12 | +---- |
| 13 | +<PackageReference Include="Elastic.CommonSchema.BenchmarkDotNetExporter" Version="{ecs-logging-dotnet-version}" /> |
| 14 | +---- |
| 15 | + |
| 16 | +==== Usage |
| 17 | + |
| 18 | +[source,csharp] |
| 19 | +---- |
| 20 | +var options = new ElasticsearchBenchmarkExporterOptions(url) |
| 21 | +{ |
| 22 | + GitBranch = "externally-provided-branch", |
| 23 | + GitCommitMessage = "externally provided git commit message", |
| 24 | + GitRepositoryIdentifier = "repository" |
| 25 | +}; |
| 26 | +var exporter = new ElasticsearchBenchmarkExporter(options); |
| 27 | +
|
| 28 | +var config = CreateDefaultConfig().With(exporter); |
| 29 | +BenchmarkRunner.Run(typeof(Md5VsSha256), config); |
| 30 | +
|
| 31 | +---- |
| 32 | + |
| 33 | +The code snippet above configures the `ElasticsearchBenchmarkExporter` with the supplied `ElasticsearchBenchmarkExporterOptions`. It is possible to configure the exporter to use https://www.elastic.co/cloud/[Elastic Cloud] as follows: |
| 34 | + |
| 35 | +[source,csharp] |
| 36 | +---- |
| 37 | +var options = new ElasticsearchBenchmarkExporterOptions(url) |
| 38 | +{ |
| 39 | + CloudId = "CLOUD_ID_HERE" |
| 40 | +}; |
| 41 | +
|
| 42 | +---- |
| 43 | + |
| 44 | +Example _source from a search in Elasticsearch after a benchmark run: |
| 45 | + |
| 46 | +[source,json] |
| 47 | +---- |
| 48 | +{ |
| 49 | + "_index":"benchmark-dotnet-2020-01-01", |
| 50 | + "_type":"_doc", |
| 51 | + "_id":"pfFAh28B14pBZI_VO098", |
| 52 | + "_score":1.0, |
| 53 | + "_source":{ |
| 54 | + "agent":{ |
| 55 | + "git":{ |
| 56 | + "branch_name":"externally-provided-branch", |
| 57 | + "commit_message":"externally provided git commit message", |
| 58 | + "repository":"repository" |
| 59 | + }, |
| 60 | + "language":{ |
| 61 | + "jit_info":"RyuJIT", |
| 62 | + "dot_net_sdk_version":"3.0.101", |
| 63 | + "benchmark_dot_net_caption":"BenchmarkDotNet", |
| 64 | + "has_ryu_jit":true, |
| 65 | + "build_configuration":"RELEASE", |
| 66 | + "benchmark_dot_net_version":"0.12.0", |
| 67 | + "version":".NET Core 3.0.1 (CoreCLR 4.700.19.47502, CoreFX 4.700.19.51008)" |
| 68 | + }, |
| 69 | + "type":"Elastic.CommonSchema.BenchmarkDotNetExporter", |
| 70 | + "version":"1.0.0+7cedae2aaa06092ea253155279b835cee6160b3a" |
| 71 | + }, |
| 72 | + "os":{ |
| 73 | + "name":"Linux", |
| 74 | + "version":"ubuntu 18.10", |
| 75 | + "platform":"unix" |
| 76 | + }, |
| 77 | + "message":null, |
| 78 | + "benchmark":{ |
| 79 | + "q1":3632.625, |
| 80 | + "lower_outliers":[], |
| 81 | + "q3":5047.625, |
| 82 | + "confidence_interval":{ |
| 83 | + "margin":14613.282591693971, |
| 84 | + "level":12, |
| 85 | + "mean":4123.291666666667, |
| 86 | + "lower":-10489.990925027305, |
| 87 | + "n":3, |
| 88 | + "standard_error":462.4594877151704 |
| 89 | + }, |
| 90 | + "percentiles":{ |
| 91 | + "p0":3632.625, |
| 92 | + "p67":4151.345, |
| 93 | + "p25":3661.125, |
| 94 | + "p100":5047.625, |
| 95 | + "p90":4776.025000000001, |
| 96 | + "p80":4504.425, |
| 97 | + "p50":3689.625, |
| 98 | + "p85":4640.225, |
| 99 | + "p95":4911.825 |
| 100 | + }, |
| 101 | + "memory":{ |
| 102 | + "bytes_allocated_per_operation":112, |
| 103 | + "total_operations":4, |
| 104 | + "gen2_collections":0, |
| 105 | + "gen1_collections":0, |
| 106 | + "gen0_collections":0 |
| 107 | + }, |
| 108 | + "max":5047.625, |
| 109 | + "interquartile_range":1415, |
| 110 | + "all_outliers":[], |
| 111 | + "upper_fence":7170.125, |
| 112 | + "standard_deviation":801.0033291649501, |
| 113 | + "kurtosis":0.6666666666666661, |
| 114 | + "n":3, |
| 115 | + "standard_error":462.4594877151704, |
| 116 | + "min":3632.625, |
| 117 | + "median":3689.625, |
| 118 | + "upper_outliers":[], |
| 119 | + "variance":641606.3333333333, |
| 120 | + "mean":4123.291666666667, |
| 121 | + "lower_fence":1510.125, |
| 122 | + "skewness":0.3827086238595402 |
| 123 | + }, |
| 124 | + "@timestamp":"2020-01-08T22:22:10.7917398+00:00", |
| 125 | + "host":{ |
| 126 | + "hardware_timer_kind":"Unknown", |
| 127 | + "physical_processor_count":1, |
| 128 | + "logical_core_count":12, |
| 129 | + "in_docker":false, |
| 130 | + "processor_name":"Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz", |
| 131 | + "chronometer_frequency_hertz":1000000000, |
| 132 | + "has_attached_debugger":false, |
| 133 | + "physical_core_count":6, |
| 134 | + "architecture":"X64" |
| 135 | + }, |
| 136 | + "log.level":null, |
| 137 | + "event":{ |
| 138 | + "duration":1385324200, |
| 139 | + "measurement_stages":[ |
| 140 | + { |
| 141 | + "operations":2, |
| 142 | + "iteration_mode":"Overhead", |
| 143 | + "iteration_stage":"Jitting" |
| 144 | + }, |
| 145 | + { |
| 146 | + "operations":2, |
| 147 | + "iteration_mode":"Workload", |
| 148 | + "iteration_stage":"Jitting" |
| 149 | + }, |
| 150 | + { |
| 151 | + "operations":4, |
| 152 | + "iteration_mode":"Overhead", |
| 153 | + "iteration_stage":"Warmup" |
| 154 | + }, |
| 155 | + { |
| 156 | + "operations":4, |
| 157 | + "iteration_mode":"Overhead", |
| 158 | + "iteration_stage":"Actual" |
| 159 | + }, |
| 160 | + { |
| 161 | + "operations":4, |
| 162 | + "iteration_mode":"Workload", |
| 163 | + "iteration_stage":"Warmup" |
| 164 | + }, |
| 165 | + { |
| 166 | + "operations":4, |
| 167 | + "iteration_mode":"Workload", |
| 168 | + "iteration_stage":"Actual" |
| 169 | + }, |
| 170 | + { |
| 171 | + "operations":4, |
| 172 | + "iteration_mode":"Workload", |
| 173 | + "iteration_stage":"Result" |
| 174 | + } |
| 175 | + ], |
| 176 | + "job_config":{ |
| 177 | + "run_time":".NET Core 3.0", |
| 178 | + "jit":"Default", |
| 179 | + "launch":{ |
| 180 | + "unroll_factor":2, |
| 181 | + "max_iteration_count":0, |
| 182 | + "launch_count":1, |
| 183 | + "iteration_count":3, |
| 184 | + "run_strategy":"Throughput", |
| 185 | + "iteration_time_in_milliseconds":0, |
| 186 | + "warm_count":3, |
| 187 | + "max_warmup_iteration_count":0, |
| 188 | + "invocation_count":4, |
| 189 | + "min_warmup_iteration_count":0, |
| 190 | + "min_iteration_count":0 |
| 191 | + }, |
| 192 | + "id":"ShortRun", |
| 193 | + "gc":{ |
| 194 | + "heap_affinitize_mask":0, |
| 195 | + "server":false, |
| 196 | + "no_affinitize":false, |
| 197 | + "allow_very_large_objects":false, |
| 198 | + "retain_vm":false, |
| 199 | + "cpu_groups":false, |
| 200 | + "concurrent":false, |
| 201 | + "heap_count":0, |
| 202 | + "force":false |
| 203 | + }, |
| 204 | + "platform":"AnyCpu" |
| 205 | + }, |
| 206 | + "original":"Md5VsSha256.Sha256: ShortRun(Runtime=.NET Core 3.0, InvocationCount=4, IterationCount=3, LaunchCount=1, UnrollFactor=2, WarmupCount=3) [N=1000]", |
| 207 | + "method":"Elastic.CommonSchema.BenchmarkDotNetExporter.IntegrationTests.Md5VsSha256.Sha256(N: 1000)", |
| 208 | + "module":"Elastic.CommonSchema.BenchmarkDotNetExporter.IntegrationTests", |
| 209 | + "description":"Sha256", |
| 210 | + "action":"Sha256", |
| 211 | + "category":"Elastic.CommonSchema.BenchmarkDotNetExporter.IntegrationTests.Md5VsSha256-20200108-232208", |
| 212 | + "type":"Md5VsSha256", |
| 213 | + "parameters":"N=1000", |
| 214 | + "repetitions":{ |
| 215 | + "measured":4, |
| 216 | + "warmup":4 |
| 217 | + } |
| 218 | + } |
| 219 | + } |
| 220 | +} |
| 221 | +---- |
0 commit comments