Skip to content

Feature/2621 add export name for joined exports - #3214

Open
sheddy123 wants to merge 5 commits into
dotnet:masterfrom
sheddy123:feature/2621-add-export-name-for-joined-exports
Open

Feature/2621 add export name for joined exports#3214
sheddy123 wants to merge 5 commits into
dotnet:masterfrom
sheddy123:feature/2621-add-export-name-for-joined-exports

Conversation

@sheddy123

@sheddy123 sheddy123 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

#2621
These implementations were carried out:
Added a configurable Title on the config, used as the joined summary's title. This drives the exported file names (via ExporterBase.GetFileName → summary.
Title for multi-type/joined summaries). When unset, the existing BenchmarkRun-joined-{timestamp} default is used, so behavior is unchanged for everyone else..

You can now set it two ways:

// Fluent API
ManualConfig.Create(DefaultConfig.Instance).WithTitle("MyBenchmarks");
// CLI
--join --title=MyBenchmarks

Scenario How title is set Exported files HTML <title>
Code API .WithTitle("MyCustomBenchmarks") MyCustomBenchmarks-report.csv / -report-github.md / -report.html MyCustomBenchmarks
CLI --join --title CliCustomTitle CliCustomTitle-report.csv / ... CliCustomTitle
Default (unchanged) (nothing) BenchmarkRun-joined-2026-07-29-15-25-19-report.csv / ... BenchmarkRun-joined-2026-07-29-15-25-19

Document the new --title command-line option for customizing joined summary titles and export file names in benchmarks. Updated console-args.md and IntroJoin.md with descriptions and usage examples.
Introduce a Title property to IConfig and its implementations, enabling users to set a custom summary title and base name for exported result files when using joined summaries. Add fluent config methods and a --title CLI option. Update summary joining logic and config builders to support the new property.
Added unit tests to verify correct parsing, preservation, and fallback behavior of the Title property in configuration and summary classes. Ensured command-line parsing, immutable config creation, and summary joining all handle custom and default titles as expected.
@sheddy123

Copy link
Copy Markdown
Contributor Author

@timcassell this is up for approval/merge

@timcassell

Copy link
Copy Markdown
Collaborator

Does it not affect the title of non-joined summaries? Should it?

@sheddy123

Copy link
Copy Markdown
Contributor Author

@timcassell
It doesn't config.Title is only read for Summary.Join; non-joined summaries still get their title from GetTitle(...).

@timcassell

Copy link
Copy Markdown
Collaborator

I think it should. The simplest fix looks like would be to prepend the title in the single type case in

if (targets.Length == 1)
return FolderNameHelper.ToFolderName(targets.Single());

$"{summary.Title}-{FolderNameHelper.ToFolderName(targets.Single())}"

With an added benefit of preventing overwriting multiple run results (the same way the joined title behaves).

Also, this option should override the log file name. Currently it looks like the log file uses different logic and results in a different name than the exported files, it might be good to unify them.

@sheddy123

Copy link
Copy Markdown
Contributor Author

@timcassell
Based on the literal suggestion, for a non-joined run, summary.Title is already {FullTypeName}-{timestamp}
so $"{summary.Title}-{ToFolderName(targets.Single())}" produces:

BenchmarkDotNet.Samples.IntroBasic-20260730-101112-BenchmarkDotNet.Samples.IntroBasic-report.csv

The type name lands twice whenever no custom title is set. The prepend only adds information when the title is custom.

@timcassell

Copy link
Copy Markdown
Collaborator

We should redesign how it works, then. The implementation for ExporterBase.GetFileName looks pretty hacky as it is. It's fine if it requires breaking changes to get it right.

Refactor file naming to use summary titles derived from benchmarked types or custom config/CLI titles. Introduce TitleHelper to ensure unique, valid, and truncated artifact names, preventing overwrites. Update docs, tests, and related code to use the new naming logic.
@sheddy123

Copy link
Copy Markdown
Contributor Author

@timcassell

This was the redesign I did

The design

Summary.Title is now the single source of truth; the runner guarantees it is unique within a run, and GetArtifactFullName is one expression over it; the heuristic is gone. All the rules live in the new Helpers/TitleHelper.cs:

  • custom title set - used verbatim; -{TypeName} appended only when the run reports more than one summary, so their files can't collide
  • no custom title - {FullTypeName} for a single type, BenchmarkRun-joined for a joined summary
  • no timestamp in the base name; ToFolderName already includes the namespace so No namespace in export filenames can lead to data loss #529 is covered, and DontOverwriteResults (timestamped folder) already owns run retention
  • the .log file stays {title}-{timestamp}.log, since --resume has to find previous runs; GetIdToResume now matches {title}-*.log
  • titles are escaped for path validity and truncated against a budget that accounts for the results folder, so export paths are protected too

I have included a screenshot of testing this locally. Let me know if this implementation suffices

image

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.

Feature Request: Add ability to set export name for joined exports.

2 participants