Add missing Context type to MetricReport
During EventService subscription, user can specify the "Context" type to
identify the node. This "Context" must be sent to event listener for
every Events/MetricReports. For MetricReports context filed is missing
and its added as part of this commit.
Tested:
- Added MetricReport subscription with "Context" type set and can see
the "Context" data on every metric report.
Change-Id: Idcf4826c8e4cd13ce8c8078b6c6223584669be4c
Signed-off-by: AppaRao Puli <apparao.puli@intel.com>
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index cf1cdde..3c47698 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -529,6 +529,13 @@
return;
}
+ // Context is set by user during Event subscription and it must be
+ // set for MetricReport response.
+ if (!customText.empty())
+ {
+ msg["Context"] = customText;
+ }
+
std::string strMsg =
msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace);
this->sendEvent(strMsg);