Skip to content

Commit 17c4a1d

Browse files
committed
Add machine info
1 parent 836ecd1 commit 17c4a1d

File tree

8 files changed

+189
-22
lines changed

8 files changed

+189
-22
lines changed

benchmark/flags/flags.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,31 @@ var (
8484
Usage: "Custom benchmark run ID (auto-generated if not provided)",
8585
EnvVars: prefixEnvVars("BENCHMARK_RUN_ID"),
8686
}
87+
88+
MachineTypeFlag = &cli.StringFlag{
89+
Name: "machine-type",
90+
Usage: "Machine type (e.g., i4i.32xlarge)",
91+
EnvVars: prefixEnvVars("MACHINE_TYPE"),
92+
}
93+
94+
MachineProviderFlag = &cli.StringFlag{
95+
Name: "machine-provider",
96+
Usage: "Cloud provider (aws or gcp)",
97+
EnvVars: prefixEnvVars("MACHINE_PROVIDER"),
98+
}
99+
100+
MachineRegionFlag = &cli.StringFlag{
101+
Name: "machine-region",
102+
Usage: "Machine region",
103+
EnvVars: prefixEnvVars("MACHINE_REGION"),
104+
}
105+
106+
FileSystemFlag = &cli.StringFlag{
107+
Name: "file-system",
108+
Usage: "File system type",
109+
Value: "ext4",
110+
EnvVars: prefixEnvVars("FILE_SYSTEM"),
111+
}
87112
)
88113

89114
// Flags contains the list of configuration options available to the binary.
@@ -98,6 +123,10 @@ var RunFlags = []cli.Flag{
98123
EnableS3Flag,
99124
S3BucketFlag,
100125
BenchmarkRunIDFlag,
126+
MachineTypeFlag,
127+
MachineProviderFlag,
128+
MachineRegionFlag,
129+
FileSystemFlag,
101130
}
102131

103132
func init() {

report/src/components/BenchmarkRunDetails.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { BenchmarkRun } from "../types";
2+
import MachineInfo from "./MachineInfo";
23

34
interface ProvidedProps {
45
benchmarkRuns: BenchmarkRun[];
@@ -21,6 +22,7 @@ const BenchmarkRunDetails = ({ benchmarkRuns }: ProvidedProps) => {
2122
<p className="text-sm text-slate-700 max-w-2xl">
2223
{benchmarkRuns[0].testDescription}
2324
</p>
25+
<MachineInfo machineInfo={benchmarkRuns[0].machineInfo} />
2426
</div>
2527
);
2628
};
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import { MachineInfo as MachineInfoType } from "../types";
2+
3+
interface MachineInfoProps {
4+
machineInfo?: MachineInfoType;
5+
}
6+
7+
const getProviderUrl = (provider: string, machineType: string): string | null => {
8+
if (provider === "aws") {
9+
// Extract instance family from machine type (e.g., i4i from i4i.32xlarge)
10+
const instanceFamily = machineType.split('.')[0];
11+
return `https://aws.amazon.com/ec2/instance-types/${instanceFamily}/`;
12+
} else if (provider === "gcp") {
13+
const instanceFamily = machineType.split('-')[0];
14+
return `https://cloud.google.com/compute/docs/storage-optimized-machines#${instanceFamily}_machine_types`;
15+
}
16+
return null;
17+
};
18+
19+
const MachineInfo = ({ machineInfo }: MachineInfoProps) => {
20+
if (!machineInfo || (!machineInfo.type && !machineInfo.provider && !machineInfo.region && !machineInfo.fileSystem)) {
21+
return null;
22+
}
23+
24+
const providerUrl = machineInfo.provider && machineInfo.type
25+
? getProviderUrl(machineInfo.provider, machineInfo.type)
26+
: null;
27+
28+
return (
29+
<div className="bg-slate-50 rounded-lg p-4 border border-slate-200">
30+
<h3 className="text-sm font-semibold text-slate-700 mb-3">Machine Information</h3>
31+
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 text-sm">
32+
{machineInfo.type && (
33+
<div>
34+
<span className="text-slate-500 block">Type</span>
35+
{providerUrl ? (
36+
<a
37+
href={providerUrl}
38+
target="_blank"
39+
rel="noopener noreferrer"
40+
className="text-blue-600 hover:text-blue-800 hover:underline font-medium"
41+
>
42+
{machineInfo.type}
43+
</a>
44+
) : (
45+
<span className="text-slate-900 font-medium">{machineInfo.type}</span>
46+
)}
47+
</div>
48+
)}
49+
{machineInfo.provider && (
50+
<div>
51+
<span className="text-slate-500 block">Provider</span>
52+
<span className="text-slate-900 font-medium uppercase">{machineInfo.provider}</span>
53+
</div>
54+
)}
55+
{machineInfo.region && (
56+
<div>
57+
<span className="text-slate-500 block">Region</span>
58+
<span className="text-slate-900 font-medium">{machineInfo.region}</span>
59+
</div>
60+
)}
61+
{machineInfo.fileSystem && (
62+
<div>
63+
<span className="text-slate-500 block">File System</span>
64+
<span className="text-slate-900 font-medium">{machineInfo.fileSystem}</span>
65+
</div>
66+
)}
67+
</div>
68+
</div>
69+
);
70+
};
71+
72+
export default MachineInfo;

report/src/components/RunList.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import StatusBadge from "./StatusBadge";
77
import StatusSummary from "./StatusSummary";
88
import ConfigurationTags from "./ConfigurationTags";
99
import Tooltip from "./Tooltip";
10+
import MachineInfo from "./MachineInfo";
1011
import clsx from "clsx";
1112

1213
interface ProvidedProps {
@@ -209,6 +210,12 @@ const RunList = ({
209210

210211
{isExpanded && (
211212
<div className="mt-4">
213+
{/* Machine Information Section */}
214+
{section.runs.length > 0 && section.runs[0].machineInfo && (
215+
<div className="mb-6">
216+
<MachineInfo machineInfo={section.runs[0].machineInfo} />
217+
</div>
218+
)}
212219
<table className="min-w-full">
213220
<thead className="bg-slate-50">
214221
<tr>

report/src/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ export interface ChartConfig {
5252
| "blocks"; // Add 'gas/s', ensure 's' is present
5353
}
5454

55+
export interface MachineInfo {
56+
type?: string; // e.g., i4i.32xlarge
57+
provider?: string; // aws or gcp
58+
region?: string; // e.g., us-east-1
59+
fileSystem?: string; // e.g., ext4
60+
}
61+
5562
export interface BenchmarkRun {
5663
id: string;
5764
sourceFile: string;
@@ -61,6 +68,7 @@ export interface BenchmarkRun {
6168
bucketPath?: string;
6269
createdAt: string;
6370
testConfig: Record<string, string | number>;
71+
machineInfo?: MachineInfo;
6472
thresholds?: {
6573
warning?: Record<string, number>;
6674
error?: Record<string, number>;

runner/benchmark/result_metadata.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ type RunResult struct {
1313
ValidatorMetrics types.ValidatorKeyMetrics `json:"validatorMetrics"`
1414
}
1515

16+
// MachineInfo contains information about the machine running the benchmark
17+
type MachineInfo struct {
18+
Type string `json:"type,omitempty"` // e.g., i4i.32xlarge
19+
Provider string `json:"provider,omitempty"` // aws or gcp
20+
Region string `json:"region,omitempty"` // e.g., us-east-1
21+
FileSystem string `json:"fileSystem,omitempty"` // e.g., ext4
22+
}
23+
1624
// Run is the output JSON metadata for a benchmark run.
1725
type Run struct {
1826
ID string `json:"id"`
@@ -25,6 +33,7 @@ type Run struct {
2533
Result *RunResult `json:"result"`
2634
Thresholds *ThresholdConfig `json:"thresholds"`
2735
CreatedAt *time.Time `json:"createdAt"`
36+
MachineInfo *MachineInfo `json:"machineInfo,omitempty"`
2837
}
2938

3039
// RunGroup is a group of runs that is meant to be compared.
@@ -45,7 +54,7 @@ const (
4554
BenchmarkRunTag = "BenchmarkRun"
4655
)
4756

48-
func RunGroupFromTestPlans(testPlans []TestPlan) RunGroup {
57+
func RunGroupFromTestPlans(testPlans []TestPlan, machineInfo *MachineInfo) RunGroup {
4958
now := time.Now()
5059
metadata := RunGroup{
5160
Runs: make([]Run, 0),
@@ -62,6 +71,7 @@ func RunGroupFromTestPlans(testPlans []TestPlan) RunGroup {
6271
OutputDir: params.OutputDir,
6372
Thresholds: testPlan.Thresholds,
6473
CreatedAt: &now,
74+
MachineInfo: machineInfo,
6575
})
6676
}
6777
}

runner/config/config.go

Lines changed: 48 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,45 @@ type Config interface {
2424
EnableS3() bool
2525
S3Bucket() string
2626
BenchmarkRunID() string
27+
MachineType() string
28+
MachineProvider() string
29+
MachineRegion() string
30+
FileSystem() string
2731
}
2832

2933
type config struct {
30-
logConfig oplog.CLIConfig
31-
configPath string
32-
dataDir string
33-
outputDir string
34-
clientOptions ClientOptions
35-
txFuzzBinary string
36-
proxyPort int
37-
enableS3 bool
38-
s3Bucket string
39-
benchmarkRunID string
34+
logConfig oplog.CLIConfig
35+
configPath string
36+
dataDir string
37+
outputDir string
38+
clientOptions ClientOptions
39+
txFuzzBinary string
40+
proxyPort int
41+
enableS3 bool
42+
s3Bucket string
43+
benchmarkRunID string
44+
machineType string
45+
machineProvider string
46+
machineRegion string
47+
fileSystem string
4048
}
4149

4250
func NewConfig(ctx *cli.Context) Config {
4351
return &config{
44-
logConfig: oplog.ReadCLIConfig(ctx),
45-
configPath: ctx.String(appFlags.ConfigFlagName),
46-
dataDir: ctx.String(appFlags.RootDirFlagName),
47-
outputDir: ctx.String(appFlags.OutputDirFlagName),
48-
txFuzzBinary: ctx.String(appFlags.TxFuzzBinFlagName),
49-
proxyPort: ctx.Int(appFlags.ProxyPortFlagName),
50-
enableS3: ctx.Bool(appFlags.EnableS3FlagName),
51-
s3Bucket: ctx.String(appFlags.S3BucketFlagName),
52-
benchmarkRunID: ctx.String(appFlags.BenchmarkRunIDFlagName),
53-
clientOptions: ReadClientOptions(ctx),
52+
logConfig: oplog.ReadCLIConfig(ctx),
53+
configPath: ctx.String(appFlags.ConfigFlagName),
54+
dataDir: ctx.String(appFlags.RootDirFlagName),
55+
outputDir: ctx.String(appFlags.OutputDirFlagName),
56+
txFuzzBinary: ctx.String(appFlags.TxFuzzBinFlagName),
57+
proxyPort: ctx.Int(appFlags.ProxyPortFlagName),
58+
enableS3: ctx.Bool(appFlags.EnableS3FlagName),
59+
s3Bucket: ctx.String(appFlags.S3BucketFlagName),
60+
benchmarkRunID: ctx.String(appFlags.BenchmarkRunIDFlagName),
61+
machineType: ctx.String("machine-type"),
62+
machineProvider: ctx.String("machine-provider"),
63+
machineRegion: ctx.String("machine-region"),
64+
fileSystem: ctx.String("file-system"),
65+
clientOptions: ReadClientOptions(ctx),
5466
}
5567
}
5668

@@ -114,3 +126,19 @@ func (c *config) S3Bucket() string {
114126
func (c *config) BenchmarkRunID() string {
115127
return c.benchmarkRunID
116128
}
129+
130+
func (c *config) MachineType() string {
131+
return c.machineType
132+
}
133+
134+
func (c *config) MachineProvider() string {
135+
return c.machineProvider
136+
}
137+
138+
func (c *config) MachineRegion() string {
139+
return c.machineRegion
140+
}
141+
142+
func (c *config) FileSystem() string {
143+
return c.fileSystem
144+
}

runner/service.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,18 @@ func (s *service) Run(ctx context.Context) error {
574574
return errors.Wrap(err, "failed to setup initial snapshots")
575575
}
576576

577-
metadata := benchmark.RunGroupFromTestPlans(testPlans)
577+
// Create machine info from config
578+
var machineInfo *benchmark.MachineInfo
579+
if s.config.MachineType() != "" || s.config.MachineProvider() != "" || s.config.MachineRegion() != "" || s.config.FileSystem() != "" {
580+
machineInfo = &benchmark.MachineInfo{
581+
Type: s.config.MachineType(),
582+
Provider: s.config.MachineProvider(),
583+
Region: s.config.MachineRegion(),
584+
FileSystem: s.config.FileSystem(),
585+
}
586+
}
587+
588+
metadata := benchmark.RunGroupFromTestPlans(testPlans, machineInfo)
578589

579590
// Apply BenchmarkRunID to all runs in metadata
580591
for i := range metadata.Runs {

0 commit comments

Comments
 (0)