Problem/Motivation
We did quite some renaming with these issues:
#2383993: Rename Sensor* to *Sensor, Sensor/Sensors/* to Sensor/*, Sensor to SensorBase
#2382539: Rename SensorInfo to SensorConfig
The remaining question is if we should use the term SensorType instead of Sensor for the plugins.
Proposed resolution
Decide about adoption of SensorType and rename.
Remaining tasks
User interface changes
API changes
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | monitoring_2384601_plugin_19.patch | 62.08 KB | miro_dietiker |
| #19 | monitoring_2384601_plugin_19.interdiff.txt | 4.27 KB | miro_dietiker |
| #15 | monitoring_2384601_plugin_14.patch | 59.74 KB | miro_dietiker |
| #15 | monitoring_2384601_plugin_14.interdiff.txt | 703 bytes | miro_dietiker |
| #12 | monitoring_2384601_plugin_11.patch | 59.47 KB | miro_dietiker |
Comments
Comment #1
miro_dietikerDiscussed today about the whole naming.
Berdir was noch happy with renaming Sensor to SensorType... Staying with Sensor only seems still kinda unsatisfying and unclear.
So we decided to try SensorPlugin, the (almost too) obvious naming.
Comment #2
miro_dietikerRenamed quite a bit...
I was unsure about MonitoringSensorConfigResource.php...
It currently lists sensor definitions from config.
However, logically, it possibly is a list of Sensors (existing plugin instances), so the config fact can be considered an implementation detail.
Unsure about final naming (namespaces?)
monitoring/src/Result/SensorResult.php
monitoring/src/Result/SensorResultInterface.php
monitoring/src/SensorConfigAccessControlHandler.php
monitoring/src/SensorListBuilder.php
monitoring/src/SensorRunner.php
Moving them all into \Sensor and drop \Result?
And the exceptions:
monitoring/src/Sensor/DisabledSensorException.php
monitoring/src/Sensor/NonExistingSensorException.php
monitoring/src/Sensor/SensorCompilationException.php
Yes, i believe those are all concepts that are neither related to Config nor Plugin, just Sensor.
EDIT: also contains some renaming from #2383873: Rename sensor_info: services to sensor / drush to sensor-config
Comment #3
miro_dietikerops .-)
Comment #5
miro_dietikerContinued renaming and reverted wrong text replacements.
API tests pass locally.
The Drupal\monitoring\Sensor namespace still exists and needs cleanup, also Drupal\monitoring.
Base classes for the plugins reside in Drupal\monitoring\SensorPlugin
Comment #7
miro_dietikerWith fixed message.. ;-)
Comment #9
berdirUff ;)
Started reviewing this before reading the comments, as you said, a lot that IMHO should be done in #2383873: Rename sensor_info: services to sensor / drush to sensor-config (everything drush/services related). Will put that back to needs work with instructions to extract everything related to those topics from this patch. This will be more than big enough without that.
But additionally to that, there are a lot of wrong renames and also a bunch of unrelated things that I noticed in code that got changed.
isn't it SensorPluginInterface? And should then say custom sensor plugins.
This whole block needs to be rewritten in 8.x (and mention config overrides instead, not this)
I don't think this rename is correct. This is the UI and I'm pretty sure it refers to an actual sensor.
Same here.
This is technically correct, but we should use Sensor plugin in the UI, not as a class name.
Not sure about that, they are settings for the sensor plugin but stored on the sensor config. but again at least not as a class name.
This is unrelated and wrong, we need to rename this as part of the rest plugin rename.
Same, also belongs in the other issue.
Also wrong.
Also unrelated.
Just no :)
all drush related renames are likely also unrelated/wrong.
Not sure if this is really better, the second one now has Sensor twice, but OK ;)
This however is IMHO wrong. It doesn't autocomplete SensorConfig's, it autocompletes config names and is used by ConfigSensorPlugin.
We really need to revisit this file and get rid of it, I'm sure it has a lot of very outdated information.
getName()? I think that's a weird left-over, we afaik use sensor_id?
We should add an interface four our config entity...
Not sure why this doesn't type hint on the interface. And we'd rather type hint on $sensor_config if that doesn't work already, then getPlugin() should just work?
I don't think this is correct?
sensableors. nice :)
Comment #10
miro_dietikerYeah, one refactoring from Sensor to SensorPlugin resulted in big mess... I already reverted quite a bit.
"It just happened" without intention, that i found again some info stuff and pushed the kill button while on it... ;-P
Fine if we do this drush/service stuff in the other issue. I'm happy to drop it from this patch.
With "a lot of wrong renames", you refer in your review to accidental SensorPlugin autorenames... and ForceRunController...
Much more unclear (and unanswered) is everything remaining "Sensor" without Plugin nor Config. I'm fine if we deal with it as a followup, but i'm really not happy with these remaining parts. Do we agree on a followup for this?
I will still leave the nonfunctional neighborhood doc~/typo fixes in it though. Also please open followups about SensorConfigInterfaces and other things to keep track of them.
Comment #11
berdirI need to check what's left and we should probably discuss that in person.
Comment #12
miro_dietikergetName() is still in use quite a bit. I kept the new doc fix. Followup to clean this up.
SensorConfigInterface - fine, followup.
All changed as requested, plus some more similar thingies.
Switched from deprecated DrupalUnitTestBase to KernelTestBase
Open for next review. ;-P
Comment #14
berdirRight, getName() is a bit weird but correct, was confused.
What confused me was $this->sensor_id, we should rename that as well then, to $this->plugin or $this->plugin_id.
Comment #15
miro_dietikerRetrying, without accidental service renaming.
Comment #16
miro_dietikerComment #17
miro_dietikerCreated issue followup
#2389041: Rename sensor_id to plugin_id
#2389043: Add interface for Config entity
Comment #18
berdirMore follow-ups:
- Remove getName(), use id() instead
- Update documentation in README about overrides
- Refactor thresholds stuff, kill interface and base class, move settings form to SensorForm, out of settings. Replace checks for interface (to decide if form should be shown or not for example) with isNumeric() check? form in UI should use #states based on value type. (Not related to this issue, but I keep seeing it)
Rename $sensor to $plugin?
There are other instances too, search for "$sensor ". Some of them are sensor configs, those are less a problem I think, but we shouldn't have any $sensor plugin variables left here..
Comment #19
miro_dietikerOK, additional renames of $sensor => $plugin wherever $sensor is the plugin.
Will commit when it passes.
Comment #21
Anushka-mp commentedTwo follow ups created:
#2389111: Remove getName( ) use id( ) instead
#2389121: Update documentation in README about overrides
Comment #22
miro_dietikerYay, fixed.