Wpcomsh fatal-error: route signature records to /logstash under atomic_extension_conflict#48399
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Wpcomsh plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 1 file.
Coverage check overridden by
I don't care about code coverage for this PR
|
…c_extension_conflict Follow-up to #48369. Adds a sibling `WPCOMSH_Log::unsafe_direct_log_logstash( $feature, $message, $options = [] )` that POSTs to /rest/v1.1/logstash with caller-supplied `properties` (indexed under `properties.*` in Kibana for filter/sort/aggregate), `severity`, and `extra` (unstructured context). Switches the fatal-error signature emitter to it under feature `atomic_extension_conflict` (severity `critical`), so these records get their own Kibana bucket — and the decoded parts (`signature`, `kind`, `slug`, `extension_version`, `wp_version`, `php_version`) land under `properties.*` rather than the noisier nested `extra.*` path used by the parent PR's /automated-transfers/log envelope. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0e390b1 to
8904aeb
Compare
…sh siteurl Follow-up to #48399. The wpcom `/logstash` receiver doesn't consume a top-level `siteurl` field, so stamping it on every payload from `WPCOMSH_Log::send_to_api()` was dead weight — drop it. The fatal-error signature caller now passes `site_url` (via `get_site_url()`) inside `$properties`, so it lands under `properties.site_url` in Kibana alongside `properties.signature` / `properties.kind` / etc., where dashboards can filter on it directly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…sh siteurl Follow-up to #48399. The wpcom `/logstash` receiver doesn't consume a top-level `siteurl` field, so stamping it on every payload from `WPCOMSH_Log::send_to_api()` was dead weight — drop it. The fatal-error signature caller now passes `site_url` (via `get_site_url()`) inside `$properties`, so it lands under `properties.site_url` in Kibana alongside `properties.signature` / `properties.kind` / etc., where dashboards can filter on it directly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…c_extension_conflict (Automattic#48399) Co-authored-by: dognose24 <6869813+dognose24@users.noreply.github.com>
Fixes #
Proposed changes
WPCOMSH_Log::unsafe_direct_log_logstash( $feature, $message, $options = [] )— a sibling tounsafe_direct_log()that POSTs tohttps://public-api.wordpress.com/rest/v1.1/logstashinstead of/automated-transfers/log, so records can land under their own Kibanafeature:bucket rather than the defaultfeature:automated_transferstream.$optionsaccepts:properties— structured key-value data, surfaced underproperties.*in Kibana for filter / sort / aggregate (the slot dashboards key off).severity— severity tag (critical/error/warning/info).extra— unstructured context, useful to read on a single record but not meant to drive dashboards.$logstash_queue; both queues share the singleton instance and the existing shutdown drain (send_to_api()now also iterates the logstash queue and stampssiteurlonto each entry).ensure_shutdown_hook()helper so bothlog()andlog_to_logstash()share it.wpcomsh_fatal_log_signature()fromunsafe_direct_log()tounsafe_direct_log_logstash( 'atomic_extension_conflict', 'wpcomsh_fatal_signature', [ 'severity' => 'critical', 'properties' => $properties ] ). The signature + decoded parts (signature,kind,slug,extension_version,wp_version,php_version) now live under top-levelproperties.*so Kibana can filter/sort/aggregate on them directly, instead of being nested underextra.messages[0].extra.*as they were behind the/automated-transfers/logenvelope in the parent PR.unsafe_direct_log()(woa.php, marketplace, atomic-storage, safeguard) and thewpcomsh_logaction are untouched — no signature changes, same payload, same endpoint.Related product discussion/links
properties.*vs nestedextra.*) change.Does this pull request change what data or activity we track or use?
No new data, but the destination bucket and field layout change. The fatal-error signature record introduced in #48369 —
signature,kind,slug,extension_version,wp_version,php_version, plus the standard top-levelsiteurl— now lands in Kibana underfeature:atomic_extension_conflict(severitycritical) instead of being awpcomsh_fatal_signaturemessage inside thefeature:automated_transferstream, and those fields live atproperties.*rather than nested underextra.messages[0].extra.*. Same fields, same upstream sha256-based 5-min dedup, same caller — only the index bucket / dashboard surface differs.unsafe_direct_log_logstash()is also available for any future caller that needs its own feature bucket; it bypassesat_options_logging_onlikeunsafe_direct_log()does, so callers must keep emit rates low.Testing instructions
wp-content/mu-plugins/boom/boom.phpcontainingtrigger_error( 'boom', E_USER_ERROR )oninit).log2logstashindex), confirm the record now lands underfeature:atomic_extension_conflictwithseverity:critical— not underfeature:automated_transfer. Confirm the structured fields are indexed at top-levelproperties.*(properties.signature,properties.kind,properties.slug,properties.extension_version,properties.wp_version,properties.php_version), filterable / sortable / term-aggregatable directly without anextra.prefix.wpcomsh_fatal_sig:cache gate is unchanged).WPCOMSH_Log::unsafe_direct_log()caller (e.g. an Atomic Storage error event, a marketplace install error, a WoA setup log line). Confirm those records still arrive infeature:automated_transferas before — same payload, same/automated-transfers/logendpoint.wpcomsh_fatal_signaturerecord is emitted (pre-existing behavior; the upstreamwpcomsh_fatal_identify_plugin()returns null and the caller skips the log).