As part of code coverage support we need to work with dumped profiles
for ScyllaDB executables.
Those profiles are created on two occasions:
1. When an application exits notmaly (which will trigger
__llvm_dump_profile registered in the exit hooks.
2. For ScyllaDB commit d7b524cf10 introduced a manual call to
__llvm_dump_profile upon receiving a SIGTERM signal.
This commit adds a third option, a rest API to dump the profile.
In addition the target file is logged and the counters are reset, which
enables incremental dumping of the profile.
Except for logging, if the executable is not instrumented, this API call
becomes a no-op so it bears minimal risk in keeping it in our releases.
Specifically for code coverage, the gain will be that we will not be
required to change the entire test run to shut down clusters gracefully
and this will cause minimal effect to the actual test behavior.
The change was tested by manually triggering the API in with and
without instrumentation as well as re triggering it with write
permissions for the profile file disabled (to test fault tolerance).
Signed-off-by: Eliran Sinvani <eliransin@scylladb.com>
200 lines
5.8 KiB
JSON
200 lines
5.8 KiB
JSON
{
|
|
"apiVersion":"0.0.1",
|
|
"swaggerVersion":"1.2",
|
|
"basePath":"{{Protocol}}://{{Host}}",
|
|
"resourcePath":"/system",
|
|
"produces":[
|
|
"application/json"
|
|
],
|
|
"apis":[
|
|
{
|
|
"path":"/system/logger",
|
|
"operations":[
|
|
{
|
|
"method":"GET",
|
|
"summary":"Get all logger names",
|
|
"type":"array",
|
|
"items":{
|
|
"type":"string"
|
|
},
|
|
"nickname":"get_all_logger_names",
|
|
"produces":[
|
|
"application/json"
|
|
],
|
|
"parameters":[
|
|
]
|
|
},
|
|
{
|
|
"method":"POST",
|
|
"summary":"Set all logger level",
|
|
"type":"void",
|
|
"nickname":"set_all_logger_level",
|
|
"produces":[
|
|
"application/json"
|
|
],
|
|
"parameters":[
|
|
{
|
|
"name":"level",
|
|
"description":"The new log level",
|
|
"required":true,
|
|
"allowMultiple":false,
|
|
"type":"string",
|
|
"enum":[
|
|
"error",
|
|
"warn",
|
|
"info",
|
|
"debug",
|
|
"trace"
|
|
],
|
|
"paramType":"query"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"path":"/system/log",
|
|
"operations":[
|
|
{
|
|
"method":"POST",
|
|
"summary":"Write a message to the Scylla log",
|
|
"type":"void",
|
|
"nickname":"write_log_message",
|
|
"produces":[
|
|
"application/json"
|
|
],
|
|
"parameters":[
|
|
{
|
|
"name":"message",
|
|
"description":"The message to write to the log",
|
|
"required":true,
|
|
"allowMultiple":false,
|
|
"type":"string",
|
|
"paramType":"query"
|
|
},
|
|
{
|
|
"name":"level",
|
|
"description":"The logging level to use",
|
|
"required":true,
|
|
"allowMultiple":false,
|
|
"type":"string",
|
|
"enum":[
|
|
"error",
|
|
"warn",
|
|
"info",
|
|
"debug",
|
|
"trace"
|
|
],
|
|
"paramType":"query"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"path":"/system/drop_sstable_caches",
|
|
"operations":[
|
|
{
|
|
"method":"POST",
|
|
"summary":"Drop in-memory caches for data which is in sstables",
|
|
"type":"void",
|
|
"nickname":"drop_sstable_caches",
|
|
"produces":[
|
|
"application/json"
|
|
],
|
|
"parameters":[
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"path":"/system/uptime_ms",
|
|
"operations":[
|
|
{
|
|
"method":"GET",
|
|
"summary":"Get system uptime, in milliseconds",
|
|
"type":"long",
|
|
"nickname":"get_system_uptime",
|
|
"produces":[
|
|
"application/json"
|
|
],
|
|
"parameters":[]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"path":"/system/logger/{name}",
|
|
"operations":[
|
|
{
|
|
"method":"GET",
|
|
"summary":"Get logger level",
|
|
"type":"string",
|
|
"nickname":"get_logger_level",
|
|
"produces":[
|
|
"application/json"
|
|
],
|
|
"parameters":[
|
|
{
|
|
"name":"name",
|
|
"description":"The logger to query about",
|
|
"required":true,
|
|
"allowMultiple":false,
|
|
"type":"string",
|
|
"paramType":"path"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"method":"POST",
|
|
"summary":"Set logger level",
|
|
"type":"void",
|
|
"nickname":"set_logger_level",
|
|
"produces":[
|
|
"application/json"
|
|
],
|
|
"parameters":[
|
|
{
|
|
"name":"name",
|
|
"description":"The logger to query about",
|
|
"required":true,
|
|
"allowMultiple":false,
|
|
"type":"string",
|
|
"paramType":"path"
|
|
},
|
|
{
|
|
"name":"level",
|
|
"description":"The new log level",
|
|
"required":true,
|
|
"allowMultiple":false,
|
|
"type":"string",
|
|
"enum":[
|
|
"error",
|
|
"warn",
|
|
"info",
|
|
"debug",
|
|
"trace"
|
|
],
|
|
"paramType":"query"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"path":"/system/dump_llvm_profile",
|
|
"operations":[
|
|
{
|
|
"method":"POST",
|
|
"summary":"Dump llvm profile data (raw profile data) that can later be used for coverage reporting or PGO (no-op if the current binary is not instrumented)",
|
|
"type":"void",
|
|
"nickname":"dump_profile",
|
|
"produces":[
|
|
"application/json"
|
|
],
|
|
"parameters":[]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|