Comments

  • miro_dietiker committed 1448a1d on 8.x-1.x
    Issue #2402519: New sensor: Past DB; add test dependency.
    
miro_dietiker’s picture

Pushed the test dependency to make sure this can run.
Still needs past to move to d.o. from github.

miro_dietiker’s picture

Title: Create new sensors for past_db » New sensors: past_db per severity

Improving title, similar to other "New sensor" tasks.

Anushka-mp’s picture

Status: Active » Needs review
StatusFileSize
new5.32 KB

Uploading the config files created for monitor each severity for a review.

Status: Needs review » Needs work

The last submitted patch, 4: monitoring-2402519-new-sensors-monitor-past-severity-4.patch, failed testing.

berdir’s picture

Issue tags: +Needs tests

Hm, what about moving this to past like we did with simplenews?

The sensors are missing the right dependencies.

HEAD is broken, deleteTags() => invalidateTags().

We used to create this in code, just like dblog, not sure if we should still do that, but we should at least remove the hook now.

miro_dietiker’s picture

I do like to add this in monitoring for now as long as we are refactoring monitoring... Less fragmentation with updates.
We can move before release into contribs. :-)

And yes, in monitoring.sensors.inc there's outdated code to drop with this patch.

  1. +++ b/config/optional/past/monitoring.sensor_config.past_db_alert.yml
    @@ -0,0 +1,17 @@
    +id: past_db_alert
    ...
    +status: FALSE
    
    +++ b/config/optional/past/monitoring.sensor_config.past_db_emergency.yml
    @@ -0,0 +1,17 @@
    +id: past_db_emergency
    ...
    +status: FALSE
    

    Unsure about these two as they would be very critical and we should monitor them... but i guess core does not log on these levels ever.
    We might want to add this to the description of the sensor...

  2. +++ b/config/optional/past/monitoring.sensor_config.past_db_alert.yml
    @@ -0,0 +1,17 @@
    +label: 'Alerts occurred'
    

    I guess i would drop "occurred". I would prefer
    Severity Alert
    or Alert events.

  3. +++ b/config/optional/past/monitoring.sensor_config.past_db_alert.yml
    @@ -0,0 +1,17 @@
    +description: 'Past event alerts ocurred'
    

    Past event alerts occurred, unused severity by Drupal 8 core.

  4. +++ b/config/optional/past/monitoring.sensor_config.past_db_critical.yml
    @@ -0,0 +1,17 @@
    +description: 'Past event warnings ocurred'
    

    ocurred => occurred... and all others, too.

berdir’s picture

All past sensors were enabled by default in 7.x. We used value label "Events" there, label was just "Severity: @severity". Just like dblog.

We also had default thresholds for critical, which is what is used by default for fatal errors.

Anushka-mp’s picture

Made some changes as suggested.
module dependency added and alert sensor dropped along with outdated code in monitoring.sensors.inc

Anushka-mp’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 9: monitoring-2402519-new-sensors-monitor-past-severity-9.patch, failed testing.

Status: Needs work » Needs review
miro_dietiker’s picture

Status: Needs review » Needs work
+++ b/config/optional/past/monitoring.sensor_config.past_db_critical.yml
@@ -0,0 +1,20 @@
+id: past_db_critical
...
+id: past_db_error
...
+id: past_db_warning

Should we ship with a zero tolerance threshold for critical and errors?

Also, yes, i almost started to do the final fixing and commit... and then again realised that there are no tests yet.
Back to work, looking forward to the next update. ;-)

Anushka-mp’s picture

Anushka-mp’s picture

Status: Needs work » Needs review
berdir’s picture

Status: Needs review » Needs work
  1. +++ b/src/Tests/MonitoringPastTest.php
    @@ -0,0 +1,90 @@
    +  public static function getInfo() {
    +    return array(
    +      'name' => 'Monitoring Past',
    +      'description' => 'Monitoring Past sensors tests.',
    +      'group' => 'Monitoring',
    +    );
    +  }
    +
    

    No longer needed, use @group instead as with others.

  2. +++ b/src/Tests/MonitoringPastTest.php
    @@ -0,0 +1,90 @@
    +   */
    +  protected function setUp() {
    +    parent::setUp();
    +
    +    $this->installEntitySchema('past_event');
    +    $this->installSchema('past_db',array('past_event_argument', 'past_event_data'));
    +
    +    monitoring_modules_installed(array('past_db'));
    +  }
    

    Comment all this so that you will still understand it if you look at it in two months. Explain why we are calling those functions.

  3. +++ b/src/Tests/MonitoringPastTest.php
    @@ -0,0 +1,90 @@
    +  public function testPastSensors() {
    +
    +    $this->createEvents();
    

    missing docblock.

  4. +++ b/src/Tests/MonitoringPastTest.php
    @@ -0,0 +1,90 @@
    +    $result = $this->runSensor('past_db_warning');
    +    $this->assertEqual($result->getMessage(), '13 events in 1 day');
    +
    +
    +
    +  }
    +  protected function createEvents($count = 99) {
    

    too many newlines here, and missing docs.

Status: Needs work » Needs review

Status: Needs review » Needs work
berdir’s picture

Probably needs a commit and then a new dev build before the dependency will show up.

Another thing, needs a @requires module, like other integration tests.

Anushka-mp’s picture

Changes made according to Berdir's review.

Anushka-mp’s picture

@requires past_db added.

Status: Needs review » Needs work

Status: Needs work » Needs review
miro_dietiker’s picture

I fixed past fatal errors. Removed modules.
There is still work about broken HEAD:
#2404413: Fix tests / broken HEAD

Still retesting to see if it already can resolve and it passes.

Status: Needs review » Needs work
berdir’s picture

Probably needs a commit and then a new dev build before the dependency will show up.

;)

No commit, no dev snapshot rebuild.

miro_dietiker’s picture

Assigned: Unassigned » Anushka-mp
  1. +++ b/src/Tests/MonitoringPastTest.php
    @@ -0,0 +1,91 @@
    + * Tests for the past sensos in monitoring.
    

    sensors.

  2. +++ b/src/Tests/MonitoringPastTest.php
    @@ -0,0 +1,91 @@
    +  protected function createEvents($count = 99) {
    ...
    +    $severities_count = count($this->severities);
    ...
    +    for ($i = 0; $i <= $count; $i++) {
    

    Why not just do $severities_count amount logs? Creating 99 records eats up a lot (wasted) resources which is more waiting time for all future test runs.

And the tests are still failing. Past is now on d.o. so this should work.

Anushka-mp’s picture

strange, local tests are all green. I'll give it another try.

Status: Needs review » Needs work

berdir’s picture

Why does everyone ignore me :p

Anushka-mp’s picture

Okay, I have mistakenly uploaded the interdiff as a patch here :P
and also I see the 'real' patch passes the tests!

Anushka-mp’s picture

Status: Needs work » Needs review
miro_dietiker’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests
+++ b/src/Tests/MonitoringPastTest.php
@@ -0,0 +1,91 @@
+    $this->installSchema('past_db',array('past_event_argument', 'past_event_data'));

Again a final space to fix on commit. :-)

berdir’s picture

Status: Reviewed & tested by the community » Fixed

Committed with some test cleanup.

  • Berdir committed 739a545 on 8.x-1.x authored by Anushka-mp
    Issue #2402519 by Anushka-mp: Added past_db per severity again, with...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.