-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HPCC-31775 Hook jlog to use api to log operator messages #18685
base: master
Are you sure you want to change the base?
Conversation
Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-31775 Jirabot Action Result: |
2a91c83
to
868c78c
Compare
fa54e96
to
7e305d4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shamser - looks good in general. Please see comments.
dali/base/daclient.cpp
Outdated
@@ -141,6 +142,8 @@ bool initClientProcess(IGroup *servergrp, DaliClientRole role, unsigned mpport, | |||
covengrp->Release(); | |||
queryLogMsgManager()->setSession(myProcessSession()); | |||
|
|||
if (getGlobalConfigSP()->getPropBool("@enableGlobalSysLog", true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we sure want to default on yet?
should add a entry in values.schema.json and a commented out entry in values.yaml showing how it can be enabled (or disabled if enabled by default).
id++; | ||
} | ||
Owned<ISysInfoLoggerMsgFilter> msgFilter = createSysInfoLoggerMsgFilter(); | ||
msgFilter->setVisibleOnly(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: to be later extended so service can pass filter types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created a jira for this: https://hpccsystems.atlassian.net/browse/HPCC-33089
dali/base/sysinfologger.cpp
Outdated
else | ||
{ | ||
queryLogMsgManager()->removeMonitor(msgHandler); | ||
msgHandler = NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trivial: nullptr
dali/base/sysinfologger.cpp
Outdated
ILogMsgFilter * operatorFilter = getCategoryLogMsgFilter(MSGAUD_operator, | ||
MSGCLS_disaster|MSGCLS_error|MSGCLS_warning, | ||
WarnMsgThreshold); | ||
queryLogMsgManager()->addMonitorOwn(msgHandler, operatorFilter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's slightly unsafe to pass ownership to the handler, but keep a reference to it (in the static).
Should change so it calls addMonitor( not addMonitorOwn, and change the static to static Owned msgHandler.
Also better if the static declaration is outside of the function, because being inside causes the compiler (>= c++11) to wrap them with thread safety code (and overhead).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shamser - please see follow comments/questions.
helm/hpcc/values.schema.json
Outdated
}, | ||
"enableGlobalSysLog": { | ||
"type": "boolean", | ||
"description" : "Enable the reporting of important user/operator messages in ECL Watch" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trivial: may not involve the UI (eclwatch), e.g. may programmatically get these messages from the esp service via soap. I'd rephrase to "Enable centralized reporting of important user/operator logging messages"
helm/hpcc/values.yaml
Outdated
@@ -24,6 +24,9 @@ global: | |||
# logging sets the default logging information for all components. Can be overridden locally | |||
logging: | |||
detail: 80 | |||
# GlobalSysLog records user/operator messages to dali so that messages are reported in ECL Watch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trivial: EclWatch may not be the only consumer/client of the service - I'd reword to convey that it is accessible via service (used by EclWatch)
dali/base/daclient.cpp
Outdated
@@ -142,8 +142,9 @@ bool initClientProcess(IGroup *servergrp, DaliClientRole role, unsigned mpport, | |||
covengrp->Release(); | |||
queryLogMsgManager()->setSession(myProcessSession()); | |||
|
|||
if (getGlobalConfigSP()->getPropBool("@enableGlobalSysLog", true)) | |||
UseDaliForOperatorMessages(); | |||
if (getComponentConfigSP()->getPropBool("logging/@enableGlobalSysLog") || getGlobalConfigSP()->getPropBool("logging/@enableGlobalSysLog")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be:
if (getComponentConfigSP()->getPropBool("logging/@enableGlobalSysLog", getGlobalConfigSP()->getPropBool("logging/@enableGlobalSysLog")))
so that the global property is the default, but the component can override, i.e. including setting it to false.
@@ -502,6 +510,27 @@ void WUDetails::processRequest(IEspWUDetailsRequest &req, IEspWUDetailsResponse | |||
espWuResponseNote->setErrorCode_null(); | |||
espWuResponseNote->setSeverity(cur.queryProp("@severity")); | |||
espWuResponseNote->setCost(0); | |||
VStringBuffer idstr("%" I64F "u", id|COMPONENT_NOTE_MASK); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The id's here, being returned in setId (WuResponseNote::Id), they're 64-bit ..
For the non-static warnings, they will have been created by makeMessageId ? i.e. the bottom 21 bits correspond to the year/month/day, the id lies in the top bits (id<<21).
Is that correct?
If so, then the id's created here for static's should follow the same format (and use makeMessageId). Otherwise these 32-bit id's with the top-bit set will always decodeMessageId to an id of 0, and some bits set for the date.
And, I think COMPONENT_NOTE_MASK should move to sysinfologger.hpp, and be used as the upper limit to wrap on instead of the current UINT_MAX.
dali/base/sysinfologger.cpp
Outdated
if (!msgHandler) | ||
{ | ||
msgHandler.setown(getDaliMsgLoggerHandler()); | ||
ILogMsgFilter * operatorFilter = getCategoryLogMsgFilter(MSGAUD_operator, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check, but this looks like it leaks ? addMonitor (via LogMsgMonitor ctor) links both the handler and the filter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding id's: I agree that different uses of the id may cause confusion and may lead to bugs in the future. I have created a PR to distinguish between message id's and "sequence numbers". Should this be merged first: #19367 @jakesmith
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it looks like a leak.
catch(IException *e) | ||
{ | ||
// Non-existant global messages may mean that /SysInfoLogs hasn't been created | ||
// so catch and ignore the exception |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This exception handler looks too broad, catching and silently ignoring any exception from the block of code above.
Would it make more sense to go around createSysInfoLoggerMsgIterator only?
And/or should createSysInfoLoggerMsgIterator be not throw an error if no messages yet - but instead return an iterator that returns none ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conclusion from an offline chat was to allow createSysInfoLoggerMsgIterator to return a null iterator, i.e. do not throw an exception if SYS_INFO_ROOT doesn't exist (i.e. if there have not been any messages yet).
I think there should be a single static factory method that makes the IRemoteConnection to SYS_INFO_ROOT, if it doesn't exist it creates/returns a CNullMsgIterator, if the connection is made, then it passes it to a ctor of CSysInfoLoggerMsgIterator.
This can be left to a subsequent JIRA/PR. @shamser - please open one and reference/link it to this one.
Use id or msgid for unique SysInfoLogger message identifier Use SeqNum for the sequence number used to the generated ensure id/msgid is unique Signed-off-by: Shamser Ahmed <[email protected]>
Signed-off-by: Shamser Ahmed <[email protected]>
Signed-off-by: Shamser Ahmed <[email protected]>
Signed-off-by: Shamser Ahmed <[email protected]>
Type of change:
Checklist:
Smoketest:
Testing: