Config
Config File
Oaklean uses a .oaklean config file that defines how measurements are taken, which sensor interface is used and where those measurements files are stored.
The .oaklean file needs to be stored in the root directory of the project to measure.
The schema of a .oaklean config file looks like this:
// .oaklean
{
"projectOptions": {...},
"exportOptions": {...},
"runtimeOptions": {...},
"registryOptions": {...}
}
Only the project options are mandatory.
Available options
Project Options
{
...
"projectOptions": {
"identifier": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" // uuid
}
...
}
⚠️ The project identifier:
As you see above the config file always needs a project identifier, this is a uuid4 string that you can choose by yourself. This is necessary to clearly assign the measurement data to a project, which enables the analysis and comparison of measurement values over a development period.
Export Options
Export options describe which measurement data should be exported and where should it be stored.
All attributes are optional, if not specified the default value is used:
// default export options
{
"exportOptions": {
"outDir": 'profiles/',
"outHistoryDir": 'profiles_history/',
"rootDir": './',
"exportV8Profile": false,
"exportReport": true,
"exportSensorInterfaceData": false
}
}
All paths are relative to the directory the .oaklean file is stored, absolute paths are also supported.
Detailed description:
- outDir stores measurements (overwritten with each measurement)
- outHistoryDir stores measurements long-term (but only when using
@oaklean/profiler-jest-environment). This enables comparison between measurements over a development period. - rootDir defines where the root dir of the project is
- exportV8Profile when
truethe V8 cpuprofiler files that were used during the measurement are also exported - exportReport when
truethe measurement report files are exported.falseis only relevant if you use the profiler package within code and you store the report your self - exportSensorInterfaceData when
trueall metric data files that were collected from the sensor interface are also exported
Runtime Options
// default runtime options
{
"runtimeOptions": {
"seeds": {},
"v8": {
"cpu": {
"sampleInterval": 1
}
}
},
}
Detailed description:
- seeds: set a seed for a random algorithm (currently only Math.random is supported) like this:
{
...
"runtimeOptions": {
..
"seeds": {
"Math.random": "0"
}
...
}
...
} - sensorInterface: specify which sensor interface should be used. For further information read the Sensor Interface Docs
{
...
"runtimeOptions": {
...
"sensorInterface": {
"type": "powermetrics",
"options": {
"sampleInterval": 100,
"outputFilePath": "energy-measurements.data"
}
}
...
}
...
} - v8: specify the sample interval of the V8 profiler that is used for the measurement like this:
{
...
"runtimeOptions": {
...
"v8": {
"cpu": {
"sampleInterval": 1
}
}
...
}
...
}
Registry Options
// default registry options
{
"registryOptions": {
"url": "oaklean.io/project-report"
}
}
Detailed description:
- url: Sets the registry the report should be uploaded to. Disable uploads in general by setting this url to an empty string.