hmon: Define configuration schema#340
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //:license-checkStatus: Click to expand output |
|
The created documentation from the pull request is available at: docu-html |
| } | ||
|
|
||
| /// Thread parameters for the monitoring thread. | ||
| table ThreadParameters { |
There was a problem hiding this comment.
What if certain parameters are optional?
There was a problem hiding this comment.
Everything is optional unless explicitly marked as required, as I understand.
There was a problem hiding this comment.
For scalar types flatbuffer will use a default value (e.g. 0) and you will not know whether it was actually configured or not.
If that is not suitable, you can use " = null;" to truly make it optional.
For non-scalar types you get nullptr from flatbuffer api in case it is not configured.
8c18416 to
7863fe8
Compare
7863fe8 to
032724b
Compare
|
|
||
| /// A time range with minimum and maximum durations in milliseconds. | ||
| table TimeRange { | ||
| min_ms: uint32 (id:0); |
There was a problem hiding this comment.
I think you do not need to manually state these ids and can just remove them
| version_minor: uint32 = 0 (id:1); | ||
| supervisor_api_cycle_ms: uint32 (id:2); | ||
| internal_processing_cycle_ms: uint32 (id:3); | ||
| thread_parameters: ThreadParameters (id:4); |
There was a problem hiding this comment.
Not related to these changed, but I would be curious @eduard-moskalchuk if this thread configuration is working in your context.
I would assume in production environment application process will not have the privileges to changes the affinity or scheduling policy / priority for any of its threads.
There was a problem hiding this comment.
Probably not. In QNX some secpol abilities would be required for that, and most applications don't have them.
| /// Root configuration for a HealthMonitor instance. | ||
| table HealthMonitorConfig { | ||
| version_major: uint32 = 1 (id:0); | ||
| version_minor: uint32 = 0 (id:1); |
There was a problem hiding this comment.
Probably we should align some versioning concept. In the launch manager config we only have a single schema version here
032724b to
4cb138a
Compare
SimonKozik
left a comment
There was a problem hiding this comment.
It is difficult for me to comment on the LogicMonitor, StateNode, HeartbeatMonitor, DeadlineMonitor and DeadlineEntry definitions without seeing an example configuration.
I would appreciate if we could have an example configuration (for all possible configuration parameters), so we could better asses the schema.
| @@ -0,0 +1,180 @@ | |||
| { | |||
| "$schema": "http://json-schema.org/draft-07/schema#", | |||
There was a problem hiding this comment.
The LM schema is based on 2020-12 version. Maybe we can use newer version to keep this in sync?
| "schema_version": { | ||
| "type": "integer", | ||
| "minimum": 1, | ||
| "default": 1, | ||
| "description": "Schema version" | ||
| }, |
There was a problem hiding this comment.
LM is using following construct:
"schema_version": {
"type": "integer",
"description": "Specifies the schema version number that the Launch Manager uses to determine how to parse and validate this configuration file.",
"enum": [
1
]
}With your current proposal, integrator can configure 12 as schema_version and configuration will still pass validation.
Additionally I would be careful with using default in schema. They are not applied during validation and need to be added during configuration read. Populating not configured parameters with default values, during configuration load, is also a bit of a hassle.
I would suggest to go for enum here, and keep defined values always to a single number. Additionally I would define schema_version as required at the object level.
This way you will force integrator to declare which version of schema was used for configuration and if configuration validates against that schema, you will know that this schema can be used for reading this configuration file.
| "title": "HealthMonitorConfig", | ||
| "description": "Configuration schema for HealthMonitor (compatible with health_monitor_config.fbs)", | ||
| "type": "object", | ||
| "required": ["supervisor_api_cycle_ms", "internal_processing_cycle_ms"], |
There was a problem hiding this comment.
It may be worth to add schema_version here as well.
| "supervisor_api_cycle_ms": { | ||
| "type": "integer", | ||
| "minimum": 1, | ||
| "description": "Cycle duration in ms for supervisor API notifications" | ||
| }, |
There was a problem hiding this comment.
LM is using seconds as the measurement unit of time (e.g., '0.5' for 500 milliseconds). I would be tempted to suggest that we should use the same approach for health monitoring.
This way integrator will be not restricted with precision they would like to use. Encoding precision in parameter name will force configuration change, when we would allow different precision.
Additionally it may be useful to define time as a reusable type. This type can be then used by supervisor_api_cycle, internal_processing_cycle and TimeRange
There was a problem hiding this comment.
If we use floating point numbers, we may have to prove that we do it in a safe way. An activity that can be avoided. Please see the issue #345
| "SchedulerPolicy": { | ||
| "type": "string", | ||
| "enum": ["Other", "Fifo", "RoundRobin"], | ||
| "description": "Scheduler policy for the monitoring thread" | ||
| }, |
There was a problem hiding this comment.
LM is using this construct to define scheduling policy:
"scheduling_policy": {
"type": "string",
"description": "Specifies the scheduling policy applied to the component's initial thread. Supported values correspond to OS-defined policies (e.g., FIFO, RR, OTHER).",
"anyOf": [
{
"enum": [
"SCHED_FIFO",
"SCHED_RR",
"SCHED_OTHER"
]
},
{
"type": "string"
}
]
}This way you can get autocomplete, in some text editors, for POSIX defined schedulers, but you also allow configuration of OS specific schedulers.
Current version will restrict integrator to ["Other", "Fifo", "RoundRobin"] and force implementation to do translation from Fifo to SCHED_FIFO when reading config.
| "description": "Thread priority" | ||
| } | ||
| }, | ||
| "required": ["policy", "priority"], |
There was a problem hiding this comment.
Are we sure that we would like to force integrator to always configure policy and priority? I would prefer to keep required configuration to bare minimum.
| "required": ["policy", "priority"], | ||
| "additionalProperties": false | ||
| }, | ||
| "ThreadParameters": { |
There was a problem hiding this comment.
I would suggest to merge SchedulerPolicy, SchedulerParameters and ThreadParameters into a single type.
I'm not sure if I see benefits of keeping SchedulerPolicy and SchedulerParameters as a separate type.
No description provided.