Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outbox: record logs #1197

Open
wants to merge 49 commits into
base: add/outbox-collection
Choose a base branch
from
Open

Conversation

mattwiebe
Copy link
Contributor

We don't explicitly have to merge this, since we're already two levels deep on a feature branch, but this is the idea.

We can build on this with CLI and in the Outbox post listing, including retry functionality, and "copy to clipboard" so users can submit that with bug reports.

@mattwiebe mattwiebe added the Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. label Jan 22, 2025
@obenland
Copy link
Member

@mattwiebe @pfefferle What do we want to do with the data we log? Is it meant for site owners or us?

Maybe we could start with error_log()?
I wonder if it would make sense to integrate with Debug Bar. We could also expand on Stream_Connector.

@mattwiebe
Copy link
Contributor Author

What do we want to do with the data we log? Is it meant for site owners or us?

A few use-cases for site owners:

  1. Being able to verify that updates are being POSTed to followers. Most of the work our plugin does is invisible to the user, this can make it visible. That's why I'm storing successful logs, not just errors.
  2. Ability to manually retry failed POSTs (would need some UI)
  3. Monitoring: show a "networking health" dashboard, highlight servers with failed POSTs

But also for us, give the ability to, say, export a debug log of failed requests (sanitized of any PII) when getting support would give us a huge advantage over today.

I wonder if it would make sense to integrate with Debug Bar.

That seems like a great idea! I was initially thinking of integrating it into an Outbox post_type listing as a column.

@@ -104,8 +104,24 @@ private static function send_activity_to_followers( $activity, $actor_id, $outbo

$json = $activity->to_json();

// We will store the json as generated by the transformer, even though it 's also in plaintext in $outbox_item->post_content
// This will also allow us to keep the logs below leaner.
\add_post_meta( $outbox_item->ID, 'activitypub_sent_json', $json );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this information?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coming back to it, I was just thinking of all of the places I would want to possibly error_log while debugging this code. And this was one. But since we store it in the outbox content anyway, it's definitely superfluous and I'll remove it.

// This will also allow us to keep the logs below leaner.
\add_post_meta( $outbox_item->ID, 'activitypub_sent_json', $json );
// This will allow error checking later, that all inboxes have been sent.
\add_post_meta( $outbox_item->ID, 'activitypub_sent_inboxes', $inboxes, true );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we simply keep a list of inboxes that bounce? this is a lot of data we store per Outbox Activity!?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted a fully debuggable picture of what happens, given that the list of inboxes POSTed to for any given outbox activity will be somewhat dynamically generated. At the same time I was envisioning using it as a basis for rolling batching, which I did not get to.

But since we're not doing batching yet either, and all of the inboxes are stored in the logs below, we don't need it right now.

Base automatically changed from update/dispatcher to add/outbox-collection January 23, 2025 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Collections Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants