Skip to content

Commit df57db2

Browse files
Stuart Camawelburn
Stuart Cam
authored and
awelburn
committed
Add branch name to benchmarking results, add command line parameter (elastic#2827)
* Add branch name to benchmarking results, add command line parameter.
1 parent 2459abc commit df57db2

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

build/scripts/Benchmarking.fsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,12 @@ module Benchmarker =
111111
member val Statistics=statistics with get, set
112112
member val Memory=memory with get, set
113113

114-
type BenchmarkReport(title: string, totalTime:TimeSpan, date:DateTime, commit:string, host:HostEnvironmentInfo, benchmarks:Benchmark list) =
114+
type BenchmarkReport(title: string, totalTime:TimeSpan, date:DateTime, commit:string, branchName:string, host:HostEnvironmentInfo, benchmarks:Benchmark list) =
115115
member val Title = title with get, set
116116
member val TotalTime = totalTime with get, set
117117
member val Date = date with get, set
118118
member val Commit = commit with get, set
119+
member val BranchName = branchName with get, set
119120
member val HostEnvironmentInfo = host with get, set
120121
member val Benchmarks = benchmarks with get, set
121122

@@ -150,13 +151,14 @@ module Benchmarker =
150151
for file in benchmarkOutputFiles do copyToOutput file
151152
DeleteFiles benchmarkOutputFiles
152153

153-
let IndexResult (client:ElasticClient, file:string, date:DateTime, commit:string, indexName, typeName) =
154+
let IndexResult (client:ElasticClient, file:string, date:DateTime, commit:string, branchName:string, indexName, typeName) =
154155

155156
trace (sprintf "Indexing report %s into Elasticsearch" file)
156157

157158
let document = JsonConvert.DeserializeObject<BenchmarkReport>(File.ReadAllText(file))
158159
document.Date <- date
159160
document.Commit <- commit
161+
document.BranchName <- branchName
160162

161163
let indexRequest = new IndexRequest<BenchmarkReport>(indexName, typeName)
162164
indexRequest.Document <- document
@@ -173,6 +175,7 @@ module Benchmarker =
173175

174176
let date = DateTime.UtcNow
175177
let commit = getSHA1 "." "HEAD"
178+
let branchName = getBranchName "."
176179

177180
let benchmarkJsonFiles =
178181
Directory.EnumerateFiles(benchmarkOutput.FullName, "*-custom.json", SearchOption.AllDirectories)
@@ -238,6 +241,6 @@ module Benchmarker =
238241
raise (Exception("Unable to create pipeline"))
239242

240243
for file in benchmarkJsonFiles
241-
do IndexResult (client, file, date, commit, indexName, typeName)
244+
do IndexResult (client, file, date, commit, branchName, indexName, typeName)
242245

243246
trace "Indexed benchmark reports into Elasticsearch"

build/scripts/Commandline.fsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ module Commandline =
7777

7878
| ["test"; testFilter] -> setBuildParam "testfilter" testFilter
7979

80+
| ["benchmark"; IsUrl elasticsearch; username; password; "non-interactive"] ->
81+
setBuildParam "elasticsearch" elasticsearch
82+
setBuildParam "nonInteractive" "1"
83+
setBuildParam "username" username
84+
setBuildParam "password" password
85+
8086
| ["benchmark"; IsUrl elasticsearch; username; password] ->
8187
setBuildParam "elasticsearch" elasticsearch
8288
setBuildParam "nonInteractive" "0"

0 commit comments

Comments
 (0)