mirror of
https://github.com/friendica/friendica
synced 2025-04-22 22:30:11 +00:00
Count inbound and outbound packets
This commit is contained in:
parent
ca5f93a4d5
commit
e011b5956a
13 changed files with 63 additions and 0 deletions
|
@ -22,9 +22,11 @@
|
|||
namespace Friendica\Module\ActivityPub;
|
||||
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\BaseApi;
|
||||
use Friendica\Module\Special\HTTPException;
|
||||
|
@ -103,6 +105,7 @@ class Inbox extends BaseApi
|
|||
$uid = 0;
|
||||
}
|
||||
|
||||
Item::incrementInbound(Protocol::ACTIVITYPUB);
|
||||
ActivityPub\Receiver::processInbox($postdata, $_SERVER, $uid);
|
||||
|
||||
throw new \Friendica\Network\HTTPException\AcceptedException();
|
||||
|
|
|
@ -22,8 +22,10 @@
|
|||
namespace Friendica\Module\DFRN;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Conversation;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
@ -45,6 +47,8 @@ class Notify extends BaseModule
|
|||
throw new HTTPException\BadRequestException();
|
||||
}
|
||||
|
||||
Item::incrementInbound(Protocol::DFRN);
|
||||
|
||||
$data = json_decode($postdata);
|
||||
if (is_object($data) && !empty($this->parameters['nickname'])) {
|
||||
$user = User::getByNickname($this->parameters['nickname']);
|
||||
|
|
|
@ -25,6 +25,8 @@ use Friendica\App;
|
|||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
@ -57,6 +59,8 @@ class Receive extends BaseModule
|
|||
throw new HTTPException\ForbiddenException($this->t('Access denied.'));
|
||||
}
|
||||
|
||||
Item::incrementInbound(Protocol::DIASPORA);
|
||||
|
||||
if ($this->parameters['type'] === 'public') {
|
||||
$this->receivePublic();
|
||||
} else if ($this->parameters['type'] === 'users') {
|
||||
|
|
|
@ -28,6 +28,7 @@ use Friendica\Core\System;
|
|||
use Friendica\Database\Database;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GServer;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
@ -101,6 +102,7 @@ class PubSub extends \Friendica\BaseModule
|
|||
|
||||
$this->logger->info('Import item from Contact.', ['nickname' => $nickname, 'contact-nickname' => $contact['nick'], 'contact-id' => $contact['id']]);
|
||||
$feedhub = '';
|
||||
Item::incrementOutbound(Protocol::OSTATUS);
|
||||
OStatus::import($xml, $importer, $contact, $feedhub);
|
||||
|
||||
throw new HTTPException\OKException();
|
||||
|
|
|
@ -26,6 +26,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Model\GServer;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Protocol\ActivityNamespace;
|
||||
|
@ -210,6 +211,7 @@ class Salmon extends \Friendica\BaseModule
|
|||
|
||||
$contact = $contact ?: [];
|
||||
|
||||
Item::incrementOutbound(Protocol::OSTATUS);
|
||||
OStatus::import($data, $importer, $contact, $hub);
|
||||
|
||||
throw new HTTPException\OKException();
|
||||
|
|
|
@ -26,6 +26,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Core\KeyValueStorage\Capability\IManageKeyValuePairs;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Model\Register;
|
||||
|
@ -116,6 +117,20 @@ class Stats extends BaseModule
|
|||
'comments' => intval($this->keyValue->get('nodeinfo_local_comments')),
|
||||
],
|
||||
],
|
||||
'packets' => [
|
||||
'inbound' => [
|
||||
Protocol::ACTIVITYPUB => intval($this->keyValue->get('stats_packets_inbound_' . Protocol::ACTIVITYPUB) ?? 0),
|
||||
Protocol::DFRN => intval($this->keyValue->get('stats_packets_inbound_' . Protocol::DFRN) ?? 0),
|
||||
Protocol::DIASPORA => intval($this->keyValue->get('stats_packets_inbound_' . Protocol::DIASPORA) ?? 0),
|
||||
Protocol::OSTATUS => intval($this->keyValue->get('stats_packets_inbound_' . Protocol::OSTATUS) ?? 0),
|
||||
],
|
||||
'outbound' => [
|
||||
Protocol::ACTIVITYPUB => intval($this->keyValue->get('stats_packets_outbound_' . Protocol::ACTIVITYPUB) ?? 0),
|
||||
Protocol::DFRN => intval($this->keyValue->get('stats_packets_outbound_' . Protocol::DFRN) ?? 0),
|
||||
Protocol::DIASPORA => intval($this->keyValue->get('stats_packets_outbound_' . Protocol::DIASPORA) ?? 0),
|
||||
Protocol::OSTATUS => intval($this->keyValue->get('stats_packets_outbound_' . Protocol::OSTATUS) ?? 0),
|
||||
]
|
||||
],
|
||||
'reports' => [
|
||||
'newest' => [
|
||||
'datetime' => $report_datetime,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue