@serve.zone/dcrouter 12.8.1 → 12.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -311,6 +311,8 @@ export class StatsHandler {
311
311
  requestsPerSecond: stats.requestsPerSecond || 0,
312
312
  requestsTotal: stats.requestsTotal || 0,
313
313
  backends: stats.backends || [],
314
+ frontendProtocols: stats.frontendProtocols || null,
315
+ backendProtocols: stats.backendProtocols || null,
314
316
  };
315
317
  })()
316
318
  );
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@serve.zone/dcrouter',
6
- version: '12.8.1',
6
+ version: '12.9.0',
7
7
  description: 'A multifaceted routing service handling mail and SMS delivery functions.'
8
8
  }
@@ -56,6 +56,8 @@ export interface INetworkState {
56
56
  requestsPerSecond: number;
57
57
  requestsTotal: number;
58
58
  backends: interfaces.data.IBackendInfo[];
59
+ frontendProtocols: interfaces.data.IProtocolDistribution | null;
60
+ backendProtocols: interfaces.data.IProtocolDistribution | null;
59
61
  lastUpdated: number;
60
62
  isLoading: boolean;
61
63
  error: string | null;
@@ -154,6 +156,8 @@ export const networkStatePart = await appState.getStatePart<INetworkState>(
154
156
  requestsPerSecond: 0,
155
157
  requestsTotal: 0,
156
158
  backends: [],
159
+ frontendProtocols: null,
160
+ backendProtocols: null,
157
161
  lastUpdated: 0,
158
162
  isLoading: false,
159
163
  error: null,
@@ -523,6 +527,8 @@ export const fetchNetworkStatsAction = networkStatePart.createAction(async (stat
523
527
  requestsPerSecond: networkStatsResponse.requestsPerSecond || 0,
524
528
  requestsTotal: networkStatsResponse.requestsTotal || 0,
525
529
  backends: networkStatsResponse.backends || [],
530
+ frontendProtocols: networkStatsResponse.frontendProtocols || null,
531
+ backendProtocols: networkStatsResponse.backendProtocols || null,
526
532
  lastUpdated: Date.now(),
527
533
  isLoading: false,
528
534
  error: null,
@@ -1845,6 +1851,8 @@ async function dispatchCombinedRefreshActionInner() {
1845
1851
  requestsPerSecond: network.requestsPerSecond || 0,
1846
1852
  requestsTotal: network.requestsTotal || 0,
1847
1853
  backends: network.backends || [],
1854
+ frontendProtocols: network.frontendProtocols || null,
1855
+ backendProtocols: network.backendProtocols || null,
1848
1856
  lastUpdated: Date.now(),
1849
1857
  isLoading: false,
1850
1858
  error: null,
@@ -1866,6 +1874,8 @@ async function dispatchCombinedRefreshActionInner() {
1866
1874
  requestsPerSecond: network.requestsPerSecond || 0,
1867
1875
  requestsTotal: network.requestsTotal || 0,
1868
1876
  backends: network.backends || [],
1877
+ frontendProtocols: network.frontendProtocols || null,
1878
+ backendProtocols: network.backendProtocols || null,
1869
1879
  lastUpdated: Date.now(),
1870
1880
  isLoading: false,
1871
1881
  error: null,
@@ -274,6 +274,12 @@ export class OpsViewNetwork extends DeesElement {
274
274
  background: ${cssManager.bdTheme('#fff3e0', '#3a2a1a')};
275
275
  color: ${cssManager.bdTheme('#f57c00', '#ff9933')};
276
276
  }
277
+
278
+ .protocolChartGrid {
279
+ display: grid;
280
+ grid-template-columns: repeat(2, 1fr);
281
+ gap: 16px;
282
+ }
277
283
  `,
278
284
  ];
279
285
 
@@ -305,6 +311,9 @@ export class OpsViewNetwork extends DeesElement {
305
311
  .yAxisFormatter=${(val: number) => `${val} Mbit/s`}
306
312
  ></dees-chart-area>
307
313
 
314
+ <!-- Protocol Distribution Charts -->
315
+ ${this.renderProtocolCharts()}
316
+
308
317
  <!-- Top IPs Section -->
309
318
  ${this.renderTopIPs()}
310
319
 
@@ -527,7 +536,54 @@ export class OpsViewNetwork extends DeesElement {
527
536
  `;
528
537
  }
529
538
 
530
-
539
+ private renderProtocolCharts(): TemplateResult {
540
+ const fp = this.networkState.frontendProtocols;
541
+ const bp = this.networkState.backendProtocols;
542
+
543
+ const protoColors: Record<string, string> = {
544
+ 'HTTP/1.1': '#1976d2',
545
+ 'HTTP/2': '#388e3c',
546
+ 'HTTP/3': '#7b1fa2',
547
+ 'WebSocket': '#f57c00',
548
+ 'Other': '#757575',
549
+ };
550
+
551
+ const buildDonutData = (dist: interfaces.data.IProtocolDistribution | null) => {
552
+ if (!dist) return [];
553
+ const items: Array<{ name: string; value: number; color: string }> = [];
554
+ if (dist.h1Active > 0) items.push({ name: 'HTTP/1.1', value: dist.h1Active, color: protoColors['HTTP/1.1'] });
555
+ if (dist.h2Active > 0) items.push({ name: 'HTTP/2', value: dist.h2Active, color: protoColors['HTTP/2'] });
556
+ if (dist.h3Active > 0) items.push({ name: 'HTTP/3', value: dist.h3Active, color: protoColors['HTTP/3'] });
557
+ if (dist.wsActive > 0) items.push({ name: 'WebSocket', value: dist.wsActive, color: protoColors['WebSocket'] });
558
+ if (dist.otherActive > 0) items.push({ name: 'Other', value: dist.otherActive, color: protoColors['Other'] });
559
+ return items;
560
+ };
561
+
562
+ const frontendData = buildDonutData(fp);
563
+ const backendData = buildDonutData(bp);
564
+
565
+ return html`
566
+ <div class="protocolChartGrid">
567
+ <dees-chart-donut
568
+ .label=${'Frontend Protocols'}
569
+ .data=${frontendData.length > 0 ? frontendData : [{ name: 'No Traffic', value: 1, color: '#757575' }]}
570
+ .showLegend=${true}
571
+ .showLabels=${true}
572
+ .innerRadiusPercent=${'55%'}
573
+ .valueFormatter=${(val: number) => `${val} active`}
574
+ ></dees-chart-donut>
575
+ <dees-chart-donut
576
+ .label=${'Backend Protocols'}
577
+ .data=${backendData.length > 0 ? backendData : [{ name: 'No Traffic', value: 1, color: '#757575' }]}
578
+ .showLegend=${true}
579
+ .showLabels=${true}
580
+ .innerRadiusPercent=${'55%'}
581
+ .valueFormatter=${(val: number) => `${val} active`}
582
+ ></dees-chart-donut>
583
+ </div>
584
+ `;
585
+ }
586
+
531
587
  private renderTopIPs(): TemplateResult {
532
588
  if (this.networkState.topIPs.length === 0) {
533
589
  return html``;