Phase 957: gossip outbox stats build extract (v0.8.924)
Add guild-mesh-gossip-outbox-stats-build with lane alert thresholds, outbox stats resolve, and replication diagnostics gossip slice. Gossip view and partition-heal mixins delegate without behavior change. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -178,6 +178,12 @@ Application facade: one `PearcordPlatform` class that wires identity, database,
|
|||||||
|
|
||||||
**Phase 881 (v0.8.848):** Split `gossip-rpc-pull.js` into peer/session/validators/orchestrators/view-snapshot modules; barrel export unchanged. Bundle: `npm run test:ci-phase881`.
|
**Phase 881 (v0.8.848):** Split `gossip-rpc-pull.js` into peer/session/validators/orchestrators/view-snapshot modules; barrel export unchanged. Bundle: `npm run test:ci-phase881`.
|
||||||
|
|
||||||
|
**Phase 957 (v0.8.924):** Guild mesh gossip outbox stats build extract + lane alert keys (non-breaking). Bundle: `npm run test:ci-phase957`.
|
||||||
|
|
||||||
|
| Module | Role |
|
||||||
|
|--------|------|
|
||||||
|
| `guild-mesh-gossip-outbox-stats-build.js` | Outbox stats resolve, lane alerts, replication diagnostics gossip slice |
|
||||||
|
|
||||||
**Phase 956 (v0.8.923):** Guild mesh stability stats build extract + production track index (non-breaking). Bundle: `npm run test:ci-phase956`.
|
**Phase 956 (v0.8.923):** Guild mesh stability stats build extract + production track index (non-breaking). Bundle: `npm run test:ci-phase956`.
|
||||||
|
|
||||||
| Module | Role |
|
| Module | Role |
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
'use strict'
|
||||||
|
|
||||||
|
const meshGossipLaneAlertThresholdKeys = ['message', 'presence', 'audit', 'default']
|
||||||
|
|
||||||
|
function listMeshGossipLaneAlertThresholdKeys () {
|
||||||
|
return meshGossipLaneAlertThresholdKeys.slice()
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildGossipLaneAlertThresholds () {
|
||||||
|
return {
|
||||||
|
message: Math.max(8, Number(process.env.PEARCORD_GOSSIP_LANE_ALERT_MESSAGE) || 48),
|
||||||
|
presence: Math.max(8, Number(process.env.PEARCORD_GOSSIP_LANE_ALERT_PRESENCE) || 32),
|
||||||
|
audit: Math.max(8, Number(process.env.PEARCORD_GOSSIP_LANE_ALERT_AUDIT) || 24),
|
||||||
|
default: Math.max(8, Number(process.env.PEARCORD_GOSSIP_LANE_ALERT_DEFAULT) || 16)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildGossipLaneAlertsFromCounts (laneCounts = {}, thresholds) {
|
||||||
|
const t = thresholds || buildGossipLaneAlertThresholds()
|
||||||
|
const alerts = []
|
||||||
|
for (const lane of meshGossipLaneAlertThresholdKeys) {
|
||||||
|
const count = Number(laneCounts[lane]) || 0
|
||||||
|
const threshold = t[lane] || 16
|
||||||
|
if (count < threshold) continue
|
||||||
|
alerts.push({
|
||||||
|
lane,
|
||||||
|
count,
|
||||||
|
threshold,
|
||||||
|
severity: count >= threshold * 2 ? 'high' : 'warn'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return alerts
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveGossipOutboxStats (outbox) {
|
||||||
|
return outbox.stats?.() || { size: outbox.size, dropCount: 0 }
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveGossipLaneCounts (outbox) {
|
||||||
|
return outbox.laneCounts?.() || null
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildGossipOutboxDiagnosticsSlice (outbox) {
|
||||||
|
return {
|
||||||
|
gossipOutbox: outbox.stats?.() || null,
|
||||||
|
gossipReplay: outbox.replayStats?.() || null,
|
||||||
|
gossipLaneCounts: outbox.laneCounts?.() || null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
meshGossipLaneAlertThresholdKeys,
|
||||||
|
listMeshGossipLaneAlertThresholdKeys,
|
||||||
|
buildGossipLaneAlertThresholds,
|
||||||
|
buildGossipLaneAlertsFromCounts,
|
||||||
|
resolveGossipOutboxStats,
|
||||||
|
resolveGossipLaneCounts,
|
||||||
|
buildGossipOutboxDiagnosticsSlice
|
||||||
|
}
|
||||||
@@ -1,38 +1,18 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const { getListingTtlMs } = require('pearcord-discovery')
|
const { getListingTtlMs } = require('pearcord-discovery')
|
||||||
|
const {
|
||||||
|
buildGossipLaneAlertThresholds,
|
||||||
|
buildGossipLaneAlertsFromCounts
|
||||||
|
} = require('../../../guild-mesh-gossip-outbox-stats-build')
|
||||||
|
|
||||||
const platformGuildSyncGossipViewMixin = {
|
const platformGuildSyncGossipViewMixin = {
|
||||||
_gossipLaneAlertThresholds () {
|
_gossipLaneAlertThresholds () {
|
||||||
return {
|
return buildGossipLaneAlertThresholds()
|
||||||
message: Math.max(
|
|
||||||
8,
|
|
||||||
Number(process.env.PEARCORD_GOSSIP_LANE_ALERT_MESSAGE) || 48
|
|
||||||
),
|
|
||||||
presence: Math.max(
|
|
||||||
8,
|
|
||||||
Number(process.env.PEARCORD_GOSSIP_LANE_ALERT_PRESENCE) || 32
|
|
||||||
),
|
|
||||||
audit: Math.max(8, Number(process.env.PEARCORD_GOSSIP_LANE_ALERT_AUDIT) || 24),
|
|
||||||
default: Math.max(8, Number(process.env.PEARCORD_GOSSIP_LANE_ALERT_DEFAULT) || 16)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_gossipLaneAlertsFromCounts (laneCounts = {}) {
|
_gossipLaneAlertsFromCounts (laneCounts = {}) {
|
||||||
const thresholds = this._gossipLaneAlertThresholds()
|
return buildGossipLaneAlertsFromCounts(laneCounts, this._gossipLaneAlertThresholds())
|
||||||
const alerts = []
|
|
||||||
for (const lane of ['message', 'presence', 'audit', 'default']) {
|
|
||||||
const count = Number(laneCounts[lane]) || 0
|
|
||||||
const threshold = thresholds[lane] || 16
|
|
||||||
if (count < threshold) continue
|
|
||||||
alerts.push({
|
|
||||||
lane,
|
|
||||||
count,
|
|
||||||
threshold,
|
|
||||||
severity: count >= threshold * 2 ? 'high' : 'warn'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return alerts
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_sparseAckSyncRowsForView (guildId) {
|
_sparseAckSyncRowsForView (guildId) {
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ const {
|
|||||||
id, now, guildTopic
|
id, now, guildTopic
|
||||||
} = require('../../../platform-class-imports')
|
} = require('../../../platform-class-imports')
|
||||||
const { buildMeshStabilityStatsSnapshot } = require('../../../guild-mesh-stability-stats-build')
|
const { buildMeshStabilityStatsSnapshot } = require('../../../guild-mesh-stability-stats-build')
|
||||||
|
const {
|
||||||
|
resolveGossipOutboxStats,
|
||||||
|
resolveGossipLaneCounts,
|
||||||
|
buildGossipOutboxDiagnosticsSlice
|
||||||
|
} = require('../../../guild-mesh-gossip-outbox-stats-build')
|
||||||
|
|
||||||
|
|
||||||
/** Phase 756 — partition heal orchestration */
|
/** Phase 756 — partition heal orchestration */
|
||||||
@@ -968,11 +973,8 @@ getMeshStabilityStats (guildId) {
|
|||||||
if (!id) return null
|
if (!id) return null
|
||||||
const health = this.getGuildSyncHealth(id)
|
const health = this.getGuildSyncHealth(id)
|
||||||
const bw = this._guildSyncBandwidthWindow
|
const bw = this._guildSyncBandwidthWindow
|
||||||
const gossipStats = this._guildGossipOutbox.stats?.() || {
|
const gossipStats = resolveGossipOutboxStats(this._guildGossipOutbox)
|
||||||
size: this._guildGossipOutbox.size,
|
const gossipLaneCounts = resolveGossipLaneCounts(this._guildGossipOutbox)
|
||||||
dropCount: 0
|
|
||||||
}
|
|
||||||
const gossipLaneCounts = this._guildGossipOutbox.laneCounts?.() || null
|
|
||||||
const gossipLaneAlerts = gossipLaneCounts
|
const gossipLaneAlerts = gossipLaneCounts
|
||||||
? this._gossipLaneAlertsFromCounts(gossipLaneCounts)
|
? this._gossipLaneAlertsFromCounts(gossipLaneCounts)
|
||||||
: []
|
: []
|
||||||
@@ -1031,9 +1033,7 @@ exportMeshReplicationDiagnostics (guildId) {
|
|||||||
sparseAckGuildIds: [...this._sparseAckCursorByGuild.keys()],
|
sparseAckGuildIds: [...this._sparseAckCursorByGuild.keys()],
|
||||||
channelReplication,
|
channelReplication,
|
||||||
maxReplicationLagMs: maxLagMs,
|
maxReplicationLagMs: maxLagMs,
|
||||||
gossipOutbox: this._guildGossipOutbox.stats?.() || null,
|
...buildGossipOutboxDiagnosticsSlice(this._guildGossipOutbox),
|
||||||
gossipReplay: this._guildGossipOutbox.replayStats?.() || null,
|
|
||||||
gossipLaneCounts: this._guildGossipOutbox.laneCounts?.() || null,
|
|
||||||
guildTopicPool: this._guildTopicPool?.snapshot?.() || null,
|
guildTopicPool: this._guildTopicPool?.snapshot?.() || null,
|
||||||
meshAutoHeal: {
|
meshAutoHeal: {
|
||||||
zeroPeerSince: this._meshZeroPeerSinceByGuild.get(id) || null,
|
zeroPeerSince: this._meshZeroPeerSinceByGuild.get(id) || null,
|
||||||
|
|||||||
Reference in New Issue
Block a user