mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-06 16:06:08 +02:00
feat: show ap send error analytics in ACP
This commit is contained in:
@@ -32,18 +32,25 @@ get:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
received:
|
||||
type: array
|
||||
items:
|
||||
type: number
|
||||
receivedErr:
|
||||
type: array
|
||||
items:
|
||||
type: number
|
||||
sent:
|
||||
type: array
|
||||
items:
|
||||
type: number
|
||||
data:
|
||||
type: object
|
||||
properties:
|
||||
received:
|
||||
type: array
|
||||
items:
|
||||
type: number
|
||||
receivedErr:
|
||||
type: array
|
||||
items:
|
||||
type: number
|
||||
sent:
|
||||
type: array
|
||||
items:
|
||||
type: number
|
||||
sentErr:
|
||||
type: array
|
||||
items:
|
||||
type: number
|
||||
hideSave:
|
||||
type: number
|
||||
description: A flag to instruct the template engine to hide the save button
|
||||
|
||||
@@ -55,7 +55,8 @@ async function updateCharts() {
|
||||
['received', 'sent'].forEach((name) => {
|
||||
const chart = charts.get(name);
|
||||
chart.data.labels = labels.get(termEl.value || 'hourly');
|
||||
chart.data.datasets[0].data = data[name];
|
||||
chart.data.datasets[0].data = data.data[name];
|
||||
chart.data.datasets[1].data = data.data[`${name}Err`];
|
||||
chart.update();
|
||||
});
|
||||
}
|
||||
@@ -87,7 +88,7 @@ async function initializeCharts() {
|
||||
borderColor: 'rgba(161,181,108,1)',
|
||||
pointBackgroundColor: 'rgba(161,181,108,1)',
|
||||
pointHoverBorderColor: 'rgba(161,181,108,1)',
|
||||
data: ajaxify.data.received,
|
||||
data: ajaxify.data.data.received,
|
||||
},
|
||||
{
|
||||
...commonDataSetOpts,
|
||||
@@ -96,7 +97,7 @@ async function initializeCharts() {
|
||||
borderColor: 'rgba(171,70,66,1)',
|
||||
pointBackgroundColor: 'rgba(171,70,66,1)',
|
||||
pointHoverBorderColor: 'rgba(171,70,66,1)',
|
||||
data: ajaxify.data.receivedErr,
|
||||
data: ajaxify.data.data.receivedErr,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -106,11 +107,20 @@ async function initializeCharts() {
|
||||
{
|
||||
...commonDataSetOpts,
|
||||
label: await translate('[[admin/settings/activitypub:analytics.sent]]'),
|
||||
backgroundColor: 'rgba(151,187,205,0.2)',
|
||||
borderColor: 'rgba(151,187,205,1)',
|
||||
pointBackgroundColor: 'rgba(151,187,205,1)',
|
||||
pointHoverBorderColor: 'rgba(151,187,205,1)',
|
||||
data: ajaxify.data.sent,
|
||||
backgroundColor: 'rgba(161,181,108,0.2)',
|
||||
borderColor: 'rgba(161,181,108,1)',
|
||||
pointBackgroundColor: 'rgba(161,181,108,1)',
|
||||
pointHoverBorderColor: 'rgba(161,181,108,1)',
|
||||
data: ajaxify.data.data.sent,
|
||||
},
|
||||
{
|
||||
...commonDataSetOpts,
|
||||
label: await translate('[[admin/settings/activitypub:analytics.errors]]'),
|
||||
backgroundColor: 'rgba(171,70,66,0.2)',
|
||||
borderColor: 'rgba(171,70,66,1)',
|
||||
pointBackgroundColor: 'rgba(171,70,66,1)',
|
||||
pointHoverBorderColor: 'rgba(171,70,66,1)',
|
||||
data: ajaxify.data.data.sentErr,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -74,16 +74,21 @@ federationController.analytics = async function (req, res) {
|
||||
const receivedSet = host ? `activities:byHost:${host}` : 'activities';
|
||||
const receivedErrSet = host ? `ap.inErr:byHost:${host}` : 'ap.inErr';
|
||||
const sentSet = host ? `ap.out:byHost:${host}` : 'ap.out';
|
||||
const sentErrSet = host ? `ap.outErr:byHost:${host}` : 'ap.outErr';
|
||||
const received = await analytics[method](receivedSet, Date.now(), count);
|
||||
const receivedErr = await analytics[method](receivedErrSet, Date.now(), count);
|
||||
const sent = await analytics[method](sentSet, Date.now(), count);
|
||||
const sentErr = await analytics[method](sentErrSet, Date.now(), count);
|
||||
|
||||
res.render('admin/federation/analytics', {
|
||||
title: '[[admin/menu:federation/analytics]]',
|
||||
instances,
|
||||
received,
|
||||
receivedErr,
|
||||
sent,
|
||||
data: {
|
||||
received,
|
||||
receivedErr,
|
||||
sent,
|
||||
sentErr,
|
||||
},
|
||||
hideSave: 1,
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user