Skip to content

Commit 7a60349

Browse files
committed
Added ResultString to StatusTrace event
1 parent 139847e commit 7a60349

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/common/telemetry/Telemetry.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ static inline void OSConfigGetElapsedTime(int64_t* elapsed_us_var)
167167
const char* _timestamp = GetFormattedTime(); \
168168
int64_t _elapsed_us = 0; \
169169
const char* _distroName = OSConfigTelemetryGetCachedOsName(); \
170+
const char* _resultString = strerror(status); \
170171
OSConfigGetElapsedTime(&_elapsed_us); \
171172
telemetry_json = FormatAllocateString( \
172173
"{" \
@@ -178,6 +179,7 @@ static inline void OSConfigGetElapsedTime(int64_t* elapsed_us_var)
178179
"\"RuleCodename\":\"%s\"," \
179180
"\"CallingFunctionName\":\"%s\"," \
180181
"\"ResultCode\":\"%d\"," \
182+
"\"ResultString\":\"%s\"," \
181183
"\"ScenarioName\":\"%s\"," \
182184
"\"Microseconds\":\"%" PRId64 \
183185
"\"," \
@@ -186,7 +188,8 @@ static inline void OSConfigGetElapsedTime(int64_t* elapsed_us_var)
186188
"\"Version\":\"%s\"" \
187189
"}", \
188190
_timestamp ? _timestamp : TELEMETRY_NOTFOUND_STRING, __FILE__, line, __func__, _ruleCodename ? _ruleCodename : TELEMETRY_NOTFOUND_STRING, \
189-
(callingFunctionName) ? (callingFunctionName) : TELEMETRY_NOTFOUND_STRING, status, _scenarioName, _elapsed_us, \
191+
(callingFunctionName) ? (callingFunctionName) : TELEMETRY_NOTFOUND_STRING, status, \
192+
_resultString ? _resultString : TELEMETRY_NOTFOUND_STRING, _scenarioName, _elapsed_us, \
190193
_distroName ? _distroName : TELEMETRY_NOTFOUND_STRING, _correlationId ? _correlationId : TELEMETRY_NOTFOUND_STRING, OSCONFIG_VERSION); \
191194
if (NULL != telemetry_json) \
192195
{ \

src/common/telemetry/lib/ParameterSets.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const std::set<std::string> RULE_COMPLETE_OPTIONAL_PARAMS = {
3434

3535
// StatusTrace
3636
const std::set<std::string> STATUS_TRACE_REQUIRED_PARAMS = {
37-
"FileName", "LineNumber", "ScenarioName", "FunctionName", "RuleCodename", "CallingFunctionName", "Microseconds", "ResultCode"};
37+
"FileName", "LineNumber", "ScenarioName", "FunctionName", "RuleCodename", "CallingFunctionName", "Microseconds", "ResultCode", "ResultString"};
3838
const std::set<std::string> STATUS_TRACE_OPTIONAL_PARAMS = {
3939
// No optional params for now
4040
};

0 commit comments

Comments
 (0)