Skip to content

Add branch name to benchmarking results, add command line parameter #2827

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

Merged
merged 2 commits into from
Aug 10, 2017
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
9 changes: 6 additions & 3 deletions build/scripts/Benchmarking.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,12 @@ module Benchmarker =
member val Statistics=statistics with get, set
member val Memory=memory with get, set

type BenchmarkReport(title: string, totalTime:TimeSpan, date:DateTime, commit:string, host:HostEnvironmentInfo, benchmarks:Benchmark list) =
type BenchmarkReport(title: string, totalTime:TimeSpan, date:DateTime, commit:string, branchName:string, host:HostEnvironmentInfo, benchmarks:Benchmark list) =
member val Title = title with get, set
member val TotalTime = totalTime with get, set
member val Date = date with get, set
member val Commit = commit with get, set
member val BranchName = branchName with get, set
member val HostEnvironmentInfo = host with get, set
member val Benchmarks = benchmarks with get, set

Expand Down Expand Up @@ -150,13 +151,14 @@ module Benchmarker =
for file in benchmarkOutputFiles do copyToOutput file
DeleteFiles benchmarkOutputFiles

let IndexResult (client:ElasticClient, file:string, date:DateTime, commit:string, indexName, typeName) =
let IndexResult (client:ElasticClient, file:string, date:DateTime, commit:string, branchName:string, indexName, typeName) =

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

let document = JsonConvert.DeserializeObject<BenchmarkReport>(File.ReadAllText(file))
document.Date <- date
document.Commit <- commit
document.BranchName <- branchName

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

let date = DateTime.UtcNow
let commit = getSHA1 "." "HEAD"
let branchName = getBranchName "."

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

for file in benchmarkJsonFiles
do IndexResult (client, file, date, commit, indexName, typeName)
do IndexResult (client, file, date, commit, branchName, indexName, typeName)

trace "Indexed benchmark reports into Elasticsearch"
6 changes: 6 additions & 0 deletions build/scripts/Commandline.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ module Commandline =

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

| ["benchmark"; IsUrl elasticsearch; username; password; "non-interactive"] ->
setBuildParam "elasticsearch" elasticsearch
setBuildParam "nonInteractive" "1"
setBuildParam "username" username
setBuildParam "password" password

| ["benchmark"; IsUrl elasticsearch; username; password] ->
setBuildParam "elasticsearch" elasticsearch
setBuildParam "nonInteractive" "0"
Expand Down