Could not pushPluginDiagnosticEvent from Engine. (but DeviceAgent did)
AnsweredSummary
Could not pushPluginDiagnosticEvent from Engine. But we could do it from DeviceAgent. The sample plugin Stub: Plugin Diagnostic Event also have the same problem.
Environment
- Nx Witness Version: 5.0.0.35745
- Client OS: ubuntu 20.04
- Server OS: ubuntu 20.04
- Network Topology: testcamera
- Special features: no
Reproduction Scenario
- Enable stub plugin with enabledNxPluginsOptional in the vms_server_plugins.ini.
- In Nx Witness, go to system administration > plugins > Stub: Plugin Diagnostic Events
- Enable the check box: Generate Plugin Diagnostic Events from the Engine
- Click Apply. Then wait the desktop notification to pop the event.
Expected Behavior
- The checkbox in the system administration should keep selected.
- In default setting of event rules, plugin diagnostic event will trigger desktop notification. So we should see any desktop notification if any plugin diagnostic event from any plugin.
Actual Behavior
- The checkbox in the system administration turns off automatically after Apply is click.
- No desktop notification is thrown for plugin diagnostic event.
- If I enable the stub: plugin diagnostic event plugin on testcamera, and enable the checkbox for Generate Plugin Diagnostic Events from the DeviceAgent, there are three desktop notification for each level (error, warning, info) are thrown periodically.
Additional Information
Here is the stdout from the stub plugin, and I could only see the message from the DeviceAgent. Even when I toggle the setting for the "Generate Plugin Diagnostic Events from the Engine" in System Administration > Plugins > Stub: Plugin Diagnostic Events, nothing is shown in the stdout.
[stub_analytics_plugin_nx.stub.diagnostic_events_device_{e3e9a385-7fe0-3ba5-5482-a86cde7faf48}] Created 0x7f5e88028850
[stub_analytics_plugin_nx.stub.diagnostic_events_device_{e3e9a385-7fe0-3ba5-5482-a86cde7faf48}] pushPluginDiagnosticEvent(): INTERNAL ERROR: setHandler() was not called; ignoring Plugin Diagnostic Event.
[stub_analytics_plugin_nx.stub.diagnostic_events_device_{e3e9a385-7fe0-3ba5-5482-a86cde7faf48}] pushPluginDiagnosticEvent(): INTERNAL ERROR: setHandler() was not called; ignoring Plugin Diagnostic Event.
[stub_analytics_plugin_nx.stub.diagnostic_events_device_{e3e9a385-7fe0-3ba5-5482-a86cde7faf48}] pushPluginDiagnosticEvent(): INTERNAL ERROR: setHandler() was not called; ignoring Plugin Diagnostic Event.
[stub_analytics_plugin_nx.stub.diagnostic_events_device_{e3e9a385-7fe0-3ba5-5482-a86cde7faf48}] Received settings:
[stub_analytics_plugin_nx.stub.diagnostic_events_device_{e3e9a385-7fe0-3ba5-5482-a86cde7faf48}] {
[stub_analytics_plugin_nx.stub.diagnostic_events_device_{e3e9a385-7fe0-3ba5-5482-a86cde7faf48}] "generatePluginDiagnosticEventsFromDeviceAgent": "true"
[stub_analytics_plugin_nx.stub.diagnostic_events_device_{e3e9a385-7fe0-3ba5-5482-a86cde7faf48}] }
[stub_analytics_plugin_nx.stub.diagnostic_events_device_{e3e9a385-7fe0-3ba5-5482-a86cde7faf48}] settingsReceived(): Plugin Diagnostic Event generation enabled via settings.
[stub_analytics_plugin_nx.stub.diagnostic_events_device_{e3e9a385-7fe0-3ba5-5482-a86cde7faf48}] Producing Plugin Diagnostic Event:
{
"level": "info",
"caption": "Info message from DeviceAgent",
"description": "Info message description"
}
[stub_analytics_plugin_nx.stub.diagnostic_events_device_{e3e9a385-7fe0-3ba5-5482-a86cde7faf48}] Producing Plugin Diagnostic Event:
{
"level": "warning",
"caption": "Warning message from DeviceAgent",
"description": "Warning message description"
}
[stub_analytics_plugin_nx.stub.diagnostic_events_device_{e3e9a385-7fe0-3ba5-5482-a86cde7faf48}] Producing Plugin Diagnostic Event:
{
"level": "error",
"caption": "Error message from DeviceAgent",
"description": "Error message description"
}
What I want to do is to push diagnostic event for our own plugin at engine layer, but could not get the expected result (the desktop notification). That is why I try to use stub plugin in order to check if my implementation is wrong.
Here is what I capture from the stdout (with enableOutput in our own ini) when I try to push diagnostic event from engine:
Producing Plugin Diagnostic Event:
{
"level": "error",
"caption": "Foo",
"description": "Bar"
}
In my understanding, if I see this message from the below method in nx::sdk::analytics namespace, Nx server have defined the IEngine::IHandler properly. Then I should see the corresponding desktop notification.
void Engine::pushPluginDiagnosticEvent(
IPluginDiagnosticEvent::Level level,
std::string caption,
std::string description) const
{
std::lock_guard<std::mutex> lock(m_mutex);
if (!m_handler)
{
NX_PRINT << __func__ << "(): INTERNAL ERROR: "
<< "setHandler() was not called; ignoring the Plugin Diagnostic Event.";
return;
}
const auto event = makePtr<PluginDiagnosticEvent>(
level, std::move(caption), std::move(description));
NX_OUTPUT << "Producing Plugin Diagnostic Event:\n" + event->toString();
m_handler->handlePluginDiagnosticEvent(event.get());
}
In my personal guess, maybe the implementation of IEngine::IHandler::handlePluginDiagnosticEvent(IPluginDiagnosticEvent* event) in Nx server does not work properly.
-
Hello Jacky ,
Thank you for the detailed request.
I managed to reproduce the issue. It seems to be a bug.
I'll update here as we have progress.
JIRA-VMS-38817
-
Hello Jacky,
Do you see diagnostic events from the Engine in the "EVENTS" tab of the right panel?
Please sign in to leave a comment.
Comments
4 comments