Problem/Motivation
The resultVerbose method does a lot with DatabaseAggregator.
If sensors only want to alter parts such as the unaggregated result table, it needs to reimplement the whole method.
Proposed resolution
Reduce the method and outsource the unaggregated results in a separate method.
A sensor like Watchdog or 404 can then reinvent that method and not call the parent.
Establish the patterns similarly for DB and Entity aggregator.
Do not work with return values. Just call:
$this->verboseResultUnaggregated($output) where output is passed by reference.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #33 | monitoring_2525426_unaggregated_33.interdiff.txt | 2.5 KB | miro_dietiker |
| #33 | monitoring_2525426_unaggregated_33.patch | 13.94 KB | miro_dietiker |
| #30 | interdiff_26-30.txt | 2.11 KB | LKS90 |
| #30 | separate_unaggregated-2525426-30.patch | 13.73 KB | LKS90 |
| #26 | interdiff_23-26.txt | 4.34 KB | LKS90 |
Comments
Comment #1
LKS90 commentedHere is a beginning. I started with a watchdog sensor, if messages and variables are available, I replace the variables and drop the variables field.
Comment #2
LKS90 commentedLine 195 is a mistake, probably cut instead of copy.
Comment #3
miro_dietikerAnd inherited from what? :-)
Are you sure saving the sensor does not lead to deleting the verbose fields?
Comment #4
LKS90 commented1. From DatabaseSensorAggregatorPluginBase, but not yet :D.
2. The table field is the database table which will be queried (The watchdog sensor only queries watchdog, so configuring it doesn't make sense), the result is in output_table (tehehe).
Comment #5
miro_dietiker2. Still my question: Is the field accidentally emptied when saving (other sensor configuration)? Because it might be needed that you set this a hidden item or just access false instead.
Comment #6
LKS90 commentedYou were correct, unsetting the fields deleted the sensor config table entry and made life more complicated, changed the fields that shouldn't be changed to be disabled.
Comment #7
miro_dietikerInterdiff? :-)
At the same time you now introduce the watchdog plugin. If we are going to do this, then please also update all default configuration for watchdog table sensors to use the new sensor plugin.
Rest looks fine.
Add a comment why we hide it.
Finally, i think, for the new Watchdog behaviour we really need a tests.
Comment #8
LKS90 commentedModified configuration of sensors which use the watchdog table to use the watchdog_aggregator plugin, was able to removed sensor specific plugins. Also amended the test with the replaced name. Only tested MonitoringCoreWebTest (which passed).
Comment #9
LKS90 commentedForgot the interdiff again...
Comment #10
LKS90 commentedThe patch had one uncommitted change (a space at the end of the user sensor test string).
Comment #11
LKS90 commentedAdded test for the watchdog sensor and it's functionality.
Comment #17
LKS90 commentedRebase.
Edit: Actually the wrong issue...
Comment #18
LKS90 commentedCorrect patch this time.
Edit: The test fails are all related to the sensors which I removed (and replaced with watchdog).
Comment #20
miro_dietikerYou are deleting multiple files. Why? .-)
Really switch them to the currentl watchdog sensor? Is the new watchdog sensor providing everything
Comment #21
LKS90 commentedI thought it was worth a try :D.
They are missing some things when using the WatchdogSensor. Dblog404 and UserFailedLogin just have custom messages, the ImageMissingStyleSensor is a little more complicated (loads file results and adds information [listUsage($file)] to the message). Here is a patch that simply readds them.
Comment #22
miro_dietikerBecause we want NICE messages. That's the whole point of monitoring.
Fine if you want to subclass the watchdog sensor in case it makes sense. Dunno. Can be a followup.
Hm, The DatabaseAggregatorSensorPluginBase is not really an interface definition. It provides default implementations for database aggregators. By adding a stub here, we won't gain anything. Just add it on DatabaseAggregatorSensorPlugin and move it up once there is a common part... If anything it would be extending the Interface where resultVerbose originates (ExtendedInfoSensorPluginInterface) but that's a different story. For now we shouls just improve again and again our verbose outputs until we know how to better define an "extended info" interface. ;-)
Try harder.
You could just call parent verboseResultUnaggregated() and then alter the rows in 'result'. You repeat too much code.
Missing "unaggregated". Too much copy paste.
Active session count?
Comment #23
LKS90 commentedNew version, moved the resultVerboseUnaggregated down to the DatabaseAggregatorSensorPlugin, shortened the watchdog resultVerboseUnaggregated by editing the parent output, changed the comments as requested.
Comment #24
LKS90 commentedThe patch...
Comment #25
miro_dietikerPlz pull / rebase...
Comment #26
LKS90 commentedRebased, 20KB of breaking HEAD are gone.
Comment #29
miro_dietikerThose are summaries. Be specific in what specificity is provided or don't mention it. You might want to mention the variable handling.
Comment #30
LKS90 commentedChanged the description, mentioning the variables replacement in messages. Also added a check to make sure there actually are messages to replace (the exception in the test above).
Comment #31
LKS90 commentedSome of the code from #2495613: Sensor for php notices should be ported here. In case the variables have HTML tags/the string isn't marked safe, this version has ugly results.
Comment #32
miro_dietikerEDIT: Discussed, reviewed...
Comment #33
miro_dietikerLooks good, but providing some cleanup. Hope it passes then i can commit.
Comment #34
miro_dietikerYay! committed.