Skip to content

Commit 990f0f3

Browse files
MariusBgmVDanielEdwardsNadegeNag
authored
docs: add experimental metrics and SIL Kit Dashboard (#257)
Add documentation for the `Experimental: Metrics` configuration and mention the usage of the Vector SIL Kit Dashboard. The Default value for Experimental>>Metrics>>CollectFromRemote is true for the sil-kit-registry executable. --------- Co-authored-by: Daniel Edwards <daniel.edwards@vector.com> Co-authored-by: Nadege Griesser <nadege.griesser@vector.com>
1 parent ceb0c10 commit 990f0f3

File tree

12 files changed

+115
-25
lines changed

12 files changed

+115
-25
lines changed

SilKit/source/config/ParticipantConfiguration.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ struct MetricsSink
260260
struct Metrics
261261
{
262262
std::vector<MetricsSink> sinks;
263-
bool collectFromRemote{false};
263+
std::optional<bool> collectFromRemote;
264264
std::chrono::seconds updateInterval{1};
265265
};
266266

SilKit/source/config/ParticipantConfigurationFromXImpl.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,11 @@ void Cache(const TimeSynchronization& root, TimeSynchronizationCache& cache)
352352
void Cache(const Metrics& root, MetricsCache& cache)
353353
{
354354
static const Metrics defaultObject;
355-
CacheNonDefault(defaultObject.collectFromRemote, root.collectFromRemote, "Metrics.CollectFromRemote",
356-
cache.collectFromRemote);
355+
if(root.collectFromRemote.has_value())
356+
{
357+
CacheNonDefault(false, root.collectFromRemote.value(), "Metrics.CollectFromRemote",
358+
cache.collectFromRemote);
359+
}
357360

358361
for (const auto& sink : root.sinks)
359362
{
@@ -521,10 +524,13 @@ void MergeTimeSynchronizationCache(const TimeSynchronizationCache& cache, TimeSy
521524

522525
void MergeMetricsCache(const MetricsCache& cache, Metrics& metrics)
523526
{
524-
MergeCacheField(cache.collectFromRemote, metrics.collectFromRemote);
527+
if(metrics.collectFromRemote.has_value())
528+
{
529+
MergeCacheField(cache.collectFromRemote, metrics.collectFromRemote.value());
530+
}
525531
MergeCacheSet(cache.jsonFileSinks, metrics.sinks);
526532

527-
if (cache.remoteSink.has_value() && metrics.collectFromRemote)
533+
if (cache.remoteSink.has_value() && cache.collectFromRemote.value_or(false))
528534
{
529535
throw SilKit::ConfigurationError{
530536
"Cannot have 'Remote' metrics sink together with 'CollectFromRemote' being true"};

SilKit/source/config/YamlReader.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -242,18 +242,6 @@ void YamlReader::Read(SilKit::Config::Metrics& obj)
242242
{
243243
OptionalRead(obj.sinks, "Sinks");
244244
OptionalRead(obj.collectFromRemote, "CollectFromRemote");
245-
246-
if (obj.collectFromRemote)
247-
{
248-
for (auto&& sink : obj.sinks)
249-
{
250-
if (sink.type == SilKit::Config::MetricsSink::Type::Remote)
251-
{
252-
throw SilKit::ConfigurationError{
253-
"Metrics collectFromRemote is enabled while having a Remote MetricsSink active"};
254-
}
255-
}
256-
}
257245
}
258246

259247
void YamlReader::Read(SilKit::Config::MdfChannel& obj)

SilKit/source/config/YamlWriter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,9 @@ void YamlWriter::Write(const SilKit::Config::Metrics& obj)
282282
{
283283
MakeMap();
284284
OptionalWrite(obj.sinks, "Sinks");
285-
if (obj.collectFromRemote)
285+
if (obj.collectFromRemote.has_value())
286286
{
287-
WriteKeyValue("CollectFromRemote", obj.collectFromRemote);
287+
WriteKeyValue("CollectFromRemote", obj.collectFromRemote.value());
288288
}
289289
}
290290

SilKit/source/core/participant/Participant_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ void Participant<SilKitConnectionT>::SetupMetrics()
222222
(void)GetMetricsManager();
223223

224224
// NB: Create the metrics receiver if enabled in the configuration
225-
if (_participantConfig.experimental.metrics.collectFromRemote)
225+
if (_participantConfig.experimental.metrics.collectFromRemote.value_or(false))
226226
{
227227
Core::SupplementalData supplementalData;
228228
supplementalData[SilKit::Core::Discovery::controllerType] =

SilKit/source/core/vasio/VAsioRegistry.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ auto VAsioRegistry::StartListening(const std::string& listenUri) -> std::string
157157
_connection.StartIoWorker();
158158

159159
_connection.RegisterSilKitService(this);
160-
if (_vasioConfig->experimental.metrics.collectFromRemote)
160+
if (_vasioConfig->experimental.metrics.collectFromRemote.value_or(false))
161161
{
162162
_connection.RegisterSilKitService(_metricsReceiver.get());
163163
}
@@ -323,7 +323,7 @@ void VAsioRegistry::SetupMetrics()
323323
processor.SetSinks(std::move(sinks));
324324
}
325325

326-
if (_vasioConfig->experimental.metrics.collectFromRemote)
326+
if (_vasioConfig->experimental.metrics.collectFromRemote.value_or(false))
327327
{
328328
auto metricsReceiver = std::make_unique<VSilKit::MetricsReceiver>(nullptr, *this);
329329

Utilities/SilKitRegistry/Registry.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ void OverrideFromRegistryConfiguration(std::shared_ptr<SilKit::Config::IParticip
129129
}
130130

131131
config->experimental.metrics = registryConfiguration.experimental.metrics;
132+
133+
if(!registryConfiguration.experimental.metrics.collectFromRemote.has_value())
134+
{
135+
// implicitly enable collectFromRemote for the registry, if the user did not set it
136+
config->experimental.metrics.collectFromRemote = true;
137+
}
138+
132139
}
133140

134141
void OverrideRegistryUri(std::shared_ptr<SilKit::Config::IParticipantConfiguration> configuration,

docs/configuration/configuration.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ The Registry Configuration File
202202

203203
An instance of the |ProductName| Registry (``sil-kit-registry(.exe)``) can be configured via a YAML file.
204204
The configuration file is optional and overrides the settings specified on the command line.
205-
It also allows extended configuration, beyond what the command line allows, particularly for logging.
205+
It also allows extended configuration, beyond what the command line allows, particularly for logging and data export to a `Vector SIL Kit Dashboard <https://vector.com/sil-kit-dashboard>`_ instance.
206206

207207
The outline of a registry configuration file is as follows:
208208

@@ -266,15 +266,19 @@ Overview
266266

267267
**NOTE** The default URI to use for a local |ProductName| dashboard setup is http://localhost:8082.
268268

269+
* - :ref:`Experimental<sec:cfg-registry-experimental>`
270+
- Experimental configuration options for the |ProductName|.
271+
269272
.. _subsec:registry-config-options:
270273

271274
Configuration Options
272275
~~~~~~~~~~~~~~~~~~~~~
273276

274277
.. toctree::
275-
:maxdepth: 2
278+
:maxdepth: 1
276279

277280
logging-configuration
281+
experimental-configuration
278282

279283

280284
API and Data Type Reference

docs/configuration/experimental-configuration.rst

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,58 @@ TimeSynchronization
5454
.. note::
5555
Option *Auto* can be chosen without any concerns.
5656
In the case of option *On*, however, it is necessary to verify that the transmission of messages within a time step does not depend on incoming messages from other participants.
57-
In this case, the time step will not be terminated and the communication will block.
57+
In this case, the time step will not be terminated and the communication will block.
58+
59+
Metrics for participants
60+
------------------------
61+
Each participant supports collecting static attributes of a simulation and
62+
runtime performance metrics.
63+
They are collected and distributed to the configured sinks at the given update interval.
64+
65+
.. code-block:: yaml
66+
67+
Experimental:
68+
Metrics:
69+
Sinks:
70+
- Name: SomeSink1
71+
Type: Remote
72+
73+
74+
.. list-table:: Participant Metrics Configuration
75+
:widths: 15 85
76+
:header-rows: 1
77+
78+
* - Property Name
79+
- Description
80+
81+
* - Sinks
82+
- A list of named metric sinks. They can be of type ``JsonFile`` or ``Remote``.
83+
* - updateInterval
84+
- The time between sending batches of metrics to the registry in seconds.
85+
86+
.. _sec:cfg-registry-experimental:
87+
88+
Metrics for the registry
89+
------------------------
90+
91+
The registry configuration supports collecting metrics from remote participants
92+
and forwarding the collected data to the SIL Kit Dashboard for further
93+
analysis and visualization.
94+
Refer to the documentation of the `Vector SIL Kit Dashboard <https://vector.com/sil-kit-dashboard>`_ for further instructions.
95+
96+
.. code-block:: yaml
97+
98+
Experimental:
99+
Metrics:
100+
CollectFromRemote: true
101+
102+
103+
.. list-table:: Registry Metrics Configuration
104+
:widths: 15 85
105+
:header-rows: 1
106+
107+
* - Property Name
108+
- Description
109+
110+
* - CollectFromRemote
111+
- Collect metrics from all connected participants. Defaults to ``true``.

docs/troubleshooting/advanced.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Advanced
2+
========
3+
4+
This section shows how to use advanced tools like the `Vector SIL Kit Dashboard <https://vector.com/sil-kit-dashboard>`_ to visualize simulations, in order to identitfy participant misconfigurations, detect system misbehavior or analyze participant performance.
5+
6+
Getting Started with the dashboard
7+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8+
The dashboard is a freeware application that collects and visualizes SIL Kit simulation data.
9+
It can be used to show static attributes of participants and also show their simulation properties like active peer connections and simulated, active networks.
10+
In addition, the collection of performance metrics can be enabled in the configuration files of the SIL Kit participants.
11+
12+
This section shows how to enable the data collection of simulations for the Vector SIL Kit Dashboard.
13+
Please refer to the SIL Kit Dashboard documentation for updated instructions.
14+
15+
#. The SIL Kit registry will forward simulation data to a running Vector SIL Kit Dashboard instance, if configured properly.
16+
The ``sil-kit-registry`` executable supports the ``--dashboard-uri https://1.2.3.4`` command line flag and the registry's configuration supports the ``DashboardUri: https://1.2.3.4`` declaration.
17+
Ensure that the registry is able to connect to the Dashboard when started, e.g. by verifying the log output.
18+
The registry's configuration of ``CollectFromRemotes: true`` defaults to true -- it can be disabled explicitly.
19+
#. Each participant that should be included in the dashboard visualization, must add a remot metric sink to its conifugration file:
20+
```
21+
Experimental:
22+
Metrics:
23+
Sinks:
24+
- Name: RemoteSink1
25+
Type: Remote
26+
```
27+
This will enable the data updates from the participant to the registry, which will forward it to the dashboard.
28+
#. Start a simulation run, the dashboard will show the simulation's state, including the participant states, attributes and simulated network details. If the metrics sinks are enabled, detailed performance counters will be available for analysis.

0 commit comments

Comments
 (0)