Problem/Motivation

Add a Simple Sitemap plugin for Monitoring.

I'd appreciate to be able to see when Simple Sitemaps were generated via a Monitoring plugin, so Monitoring can report success/failure depending on thresholds. E.g if it has been a long time since a sitemap was last generated. This would help diagnosing if sitemap is failing silently.

Proposed resolution

A number plugin representing seconds since last run for each sitemap (currentTime - lastRun).

Thresholds are built into monitoring, so users can configure how many second is good/warning/error.

Sitemap last-creation dates can be found in {simple_sitemap} table.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dpi created an issue. See original summary.

gbyte’s picture

I am willing to review patches, but first we need to focus on #3172662: Display the status for XML sitemaps on the Status report page and then we should be able to reuse that code here.

dpi’s picture

Hmm. Unless the code in the patch is abstracted, e.g into a service, I'm not seeing how useful it will be.

gbyte’s picture

That's exactly my point, see comment #6.

dpi’s picture

Title: Add a Simple Sitemap plugin for Monitoring » 3215975-simple-sitemap-monitoring-sensor
dpi’s picture

Title: 3215975-simple-sitemap-monitoring-sensor » Add a Simple Sitemap plugin for Monitoring

What on earth..

dpi’s picture

  • Introduces Monitoring sensors, you roughly see this in the Monitoring dashboard depending on status.
  • Sensors are a part of the main module since its plugin based. The module won't break if Monitoring isnt enabled/present.
  • Critical parts of changes from #3172662: Display the status for XML sitemaps on the Status report page added as the first commit to this MR. You could commit either issue first.
  • Monitoring is added as a suggest/dev dependency only.
  • Fixed up typehinting of Time to TimeInterface so it can be mocked properly for tests.
  • Time mocking class.
  • First kernel test for the module. I'd recommend using parts of the code to expand coverage. Uses Entity Test entity instead of Node.
  • Test coverage covers plugin definition discovery and sensor results itself.

Dashboard display: OK

screenshot

Dashboard display: BAD (Critical)

screenshot

Monitoring Sensor Configuration Example

screenshot

dpi’s picture

Status: Active » Needs review
gbyte’s picture

Version: 8.x-3.x-dev » 4.x-dev
Status: Needs review » Needs work

All new features go to 4.x.

dpi’s picture

Status: Needs work » Needs review

@gbyte I've reworked the 3.x MR to work with 4.x,
Notes:

  • Added a new convenience method on the new Sitemap config entity. Ported date usage to new method.
  • Removed the sitemap metadata services from the v3 version, now that Sitemaps are config.
  • Functionality irt Monitoring remains the same as documented above.
  • Contains the same test coverage, reworked for 4.x compat
dpi’s picture

4.2.2 merged in.

gbyte’s picture

Assigned: Unassigned » gbyte
gbyte’s picture

Assigned: gbyte » walkingdexter
Status: Needs review » Needs work

@WalkingDexter @dpi please check out the gitlab review. Let's not merge this before discussing if this should instead go into a 3rd party simple_sitemap_monitoring module which I feel should be the way to go ATM.

walkingdexter’s picture

Assigned: walkingdexter » Unassigned

@WalkingDexter @dpi please check out the gitlab review. Let's not merge this before discussing if this should instead go into a 3rd party simple_sitemap_monitoring module which I feel should be the way to go ATM.

I think this functionality can be added directly to the Monitoring module. It already contains plugins for other contrib modules.

gbyte’s picture

@dpi Let us know if you think this issue should be reassigned to the monitoring module and the code moved into it or if this should go into a 3rd party module. Also please check out the points in the gitlab review.

walkingdexter’s picture

Status: Needs work » Closed (won't fix)

Created an issue in the Monitoring module and adapted the proposed code. See #3510954: New sensor: Simple XML Sitemap for further work.