+
+ Last sample
+
+ {total.toFixed(total < 10 ? 1 : 0)}{' '}
+ ops/s
+
+
+
+ {samples.map(([label, v, color]) => {
+ const pct = total > 0 ? (v / total) * 100 : 0
+ if (pct === 0) return null
+ return (
+
+ )
+ })}
+
+
+ {samples.map(([label, v, color]) => {
+ const pct = total > 0 ? (v / total) * 100 : 0
+ return (
+ -
+
+ {label}
+ {v.toFixed(v < 10 ? 1 : 0)}
+
+ {pct.toFixed(0)}%
+
+
+ )
+ })}
+
+
+ )
+}
+
function Performance({ stats, series }: { stats: ServerStats; series: Series }) {
return (
@@ -287,6 +509,117 @@ function Health({ stats, series }: { stats: ServerStats; series: Series }) {
}>
+
}>
+
+
+
}>
+
+
+
+ )
+}
+
+function DatabaseBreakdownBlock({ stats }: { stats: ServerStats }) {
+ const sorted = [...stats.databases].sort((a, b) => b.sizeOnDisk - a.sizeOnDisk)
+ const total = stats.totalSizeOnDisk
+ const nonEmpty = stats.databases.filter((d) => !d.empty).length
+ const avgSize = nonEmpty > 0 ? total / nonEmpty : 0
+ return (
+
- {tiles.map(([label, s, color]) => (
+
+ {tiles.map(([label, s, color, cumulative]) => (
/s
p.value)} color={color} height={24} fillOpacity={0.2} />
+
+ {formatCompact(cumulative)} total
+
))}
@@ -684,7 +1022,8 @@ function AssertsBlock({ stats, totalAsserts }: { stats: ServerStats; totalAssert
['regular', stats.asserts.regular],
['warning', stats.asserts.warning],
['user', stats.asserts.user],
- ['msg', stats.asserts.msg]
+ ['msg', stats.asserts.msg],
+ ['rollovers', stats.asserts.rollovers]
].map(([label, value]) => (
{label}
@@ -926,6 +1265,14 @@ function formatNumber(n: number): string {
return n.toLocaleString()
}
+function formatCompact(n: number): string {
+ if (!Number.isFinite(n)) return '—'
+ if (Math.abs(n) < 1000) return n.toFixed(0)
+ if (Math.abs(n) < 1_000_000) return `${(n / 1000).toFixed(1)}k`
+ if (Math.abs(n) < 1_000_000_000) return `${(n / 1_000_000).toFixed(2)}M`
+ return `${(n / 1_000_000_000).toFixed(2)}B`
+}
+
function formatUptime(seconds: number): string {
if (!Number.isFinite(seconds) || seconds < 0) return '—'
const days = Math.floor(seconds / 86400)
@@ -973,7 +1320,14 @@ const EMPTY_HISTORY: StatsSample[] = []
function derive(history: StatsSample[]): Series {
const empty: Series = {
opsPerSec: [],
- opsPerSecByKind: { query: [], insert: [], update: [], delete: [] },
+ opsPerSecByKind: {
+ query: [],
+ insert: [],
+ update: [],
+ delete: [],
+ getmore: [],
+ command: []
+ },
connections: [],
cacheFillPct: [],
residentMb: [],
@@ -1030,6 +1384,14 @@ function derive(history: StatsSample[]): Series {
ts: cur.ts,
value: Math.max(0, (cur.data.opcounters.delete - prev.data.opcounters.delete) / dt)
})
+ empty.opsPerSecByKind.getmore.push({
+ ts: cur.ts,
+ value: Math.max(0, (cur.data.opcounters.getmore - prev.data.opcounters.getmore) / dt)
+ })
+ empty.opsPerSecByKind.command.push({
+ ts: cur.ts,
+ value: Math.max(0, (cur.data.opcounters.command - prev.data.opcounters.command) / dt)
+ })
const bytesDelta =
cur.data.network.bytesIn -