Cours NestJS · Module 6: Gestion des erreurs et monitoring
PROJET : Système complet de monitoring de la flotte
Dans cette leçon4
Amiral en chef de la technologie ! Le consul Caesar.js t'a confié le défi ultime - créer un système complet de monitoring pour toute la flotte romaine. Ce sera un véritable test de toutes les compétences acquises dans le module Error Handling & Monitoring !
Spécification du projet
Ton système doit être une solution complète pour surveiller une flotte composée de nombreux navires romains. Chaque fort est une instance distincte d'une application NestJS, et c'est toi qui construis le système central de monitoring.
Exigences fonctionnelles
1. Monitoring multi-légions
- Tableau de bord central - vue d'ensemble de tous les navires de la flotte
- Enregistrement des légions - enregistrement automatique des nouveaux navires
- Health Checks - surveillance de la santé de chaque fort
- Fleet Analytics - analyses à l'échelle de la flotte
2. Suivi des erreurs en temps réel
- Agrégation des erreurs - collecte des erreurs de tous les navires
- Classification des erreurs - catégorisation des erreurs par type et par gravité
- Corrélation des erreurs - mise en relation des erreurs similaires
- Système d'alerte - notifications intelligentes
3. Monitoring des performances
- Métriques système - CPU, mémoire, disque, réseau
- Métriques applicatives - temps de réponse, débit, taux d'erreur
- Métriques métier - métriques personnalisées propres à la flotte
- Monitoring des SLA - suivi des objectifs de performance
4. Alerting avancé
- Smart Alerts - alertes basées sur le machine learning
- Escalation Policies - règles d'escalade des alertes
- Notifications multicanales - Slack, e-mail, SMS, webhook
- Corrélation des alertes - regroupement des alertes liées
� Architecture du système
// Architecture Overview
/*
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Legion Alpha │ │ Legion Beta │ │ Legion Gamma │
│ (NestJS) │ │ (NestJS) │ │ (NestJS) │
│ │ │ │ │ │
│ - Error Agent │ │ - Error Agent │ │ - Error Agent │
│ - Metrics Agent │ │ - Metrics Agent │ │ - Metrics Agent │
│ - Health Check │ │ - Health Check │ │ - Health Check │
└─────────┬───────┘ └─────────┬───────┘ └─────────┬───────┘
│ │ │
└──────────────────────┼──────────────────────┘
│
┌─────────────┴─────────────┐
│ Fleet Monitor Center │
│ (Main NestJS App) │
│ │
│ - Data Aggregation │
│ - Alert Management │
│ - Dashboard API │
│ - Analytics Engine │
│ - Notification System │
└─────────────┬─────────────┘
│
┌─────────────┴─────────────┐
│ External Systems │
│ │
│ - Prometheus/Grafana │
│ - Elasticsearch/Kibana │
│ - Slack/Teams │
│ - PagerDuty │
└───────────────────────────┘
*/Implémentation du système
1. Agent de légion (pour chaque fort)
// agents/cohort-agent.service.ts
import { Injectable, Logger, OnModuleInit } from '@nestjs/common';
import { Cron } from '@nestjs/schedule';
import { HttpService } from '@nestjs/axios';
import { ConfigService } from '@nestjs/config';
export interface LegionMetrics {
cohortId: string;
cohortName: string;
centurion: string;
timestamp: Date;
system: {
cpu: number;
memory: number;
disk: number;
network: {
bytesIn: number;
bytesOut: number;
};
};
application: {
uptime: number;
activeConnections: number;
requestsPerSecond: number;
errorRate: number;
responseTime: {
avg: number;
p95: number;
p99: number;
};
};
business: {
tributesFound: number;
legionActivity: number;
missionsCompleted: number;
battlesWon: number;
};
health: {
overall: 'healthy' | 'warning' | 'critical';
services: Record<string, 'up' | 'down' | 'degraded'>;
};
}
@Injectable()
export class LegionAgentService implements OnModuleInit {
private readonly logger = new Logger(LegionAgentService.name);
private readonly cohortId: string;
private readonly fleetCenterUrl: string;
private isRegistered = false;
constructor(
private readonly httpService: HttpService,
private readonly configService: ConfigService,
) {
this.cohortId = this.configService.get('SHIP_ID') || this.generateLegionId();
this.fleetCenterUrl = this.configService.get('FLEET_CENTER_URL');
}
async onModuleInit() {
await this.registerWithFleet();
}
private async registerWithFleet() {
try {
const registrationData = {
cohortId: this.cohortId,
cohortName: this.configService.get('SHIP_NAME', 'Unknown Vessel'),
centurion: this.configService.get('CAPTAIN_NAME', 'Anonymous Centurion'),
version: process.env.npm_package_version || '1.0.0',
startTime: new Date(),
location: {
latitude: parseFloat(this.configService.get('SHIP_LAT', '0')),
longitude: parseFloat(this.configService.get('SHIP_LNG', '0')),
},
};
await this.httpService.post(
`${this.fleetCenterUrl}/fleet/cohorts/register`,
registrationData
).toPromise();
this.isRegistered = true;
this.logger.log(` Legion ${this.cohortId} registered with fleet center`);
} catch (error) {
this.logger.error('Failed to register with fleet center:', error.message);
}
}
@Cron('0 * * * * *') // Every minute
async sendMetricsToFleet() {
if (!this.isRegistered) {
await this.registerWithFleet();
return;
}
try {
const metrics = await this.collectLegionMetrics();
await this.httpService.post(
`${this.fleetCenterUrl}/fleet/metrics`,
metrics
).toPromise();
this.logger.debug(` Metrics sent to fleet center`);
} catch (error) {
this.logger.error('Failed to send metrics to fleet center:', error.message);
}
}
async collectLegionMetrics(): Promise<LegionMetrics> {
const memUsage = process.memoryUsage();
const uptime = process.uptime();
return {
cohortId: this.cohortId,
cohortName: this.configService.get('SHIP_NAME', 'Unknown Vessel'),
centurion: this.configService.get('CAPTAIN_NAME', 'Anonymous Centurion'),
timestamp: new Date(),
system: {
cpu: await this.getCpuUsage(),
memory: Math.round((memUsage.heapUsed / memUsage.heapTotal) * 100),
disk: await this.getDiskUsage(),
network: await this.getNetworkStats(),
},
application: {
uptime,
activeConnections: await this.getActiveConnections(),
requestsPerSecond: await this.getRequestsPerSecond(),
errorRate: await this.getErrorRate(),
responseTime: await this.getResponseTimeStats(),
},
business: {
tributesFound: await this.getTributesFound(),
legionActivity: await this.getLegionActivity(),
missionsCompleted: await this.getMissionsCompleted(),
battlesWon: await this.getBattlesWon(),
},
health: await this.getHealthStatus(),
};
}
private async getCpuUsage(): Promise<number> {
return new Promise((resolve) => {
const startUsage = process.cpuUsage();
setTimeout(() => {
const endUsage = process.cpuUsage(startUsage);
const totalUsage = endUsage.user + endUsage.system;
const percentage = (totalUsage / 1000000) * 100;
resolve(Math.min(100, percentage));
}, 100);
});
}
private async getDiskUsage(): Promise<number> {
// Simplified disk usage - in real implementation use fs.statvfs
return Math.random() * 100;
}
private async getNetworkStats() {
// Simplified network stats - in real implementation read from /proc/net/dev
return {
bytesIn: Math.floor(Math.random() * 1000000),
bytesOut: Math.floor(Math.random() * 1000000),
};
}
private async getActiveConnections(): Promise<number> {
// Implementation depends on your server setup
return Math.floor(Math.random() * 100);
}
private async getRequestsPerSecond(): Promise<number> {
// Implementation using metrics collected by interceptors
return Math.random() * 1000;
}
private async getErrorRate(): Promise<number> {
// Implementation using error tracking
return Math.random() * 10;
}
private async getResponseTimeStats() {
return {
avg: 50 + Math.random() * 200,
p95: 100 + Math.random() * 400,
p99: 200 + Math.random() * 800,
};
}
private async getTributesFound(): Promise<number> {
// Business metric - implement based on your tribute service
return Math.floor(Math.random() * 50);
}
private async getLegionActivity(): Promise<number> {
// Business metric - implement based on your legion service
return Math.floor(Math.random() * 100);
}
private async getMissionsCompleted(): Promise<number> {
// Business metric - implement based on your mission service
return Math.floor(Math.random() * 20);
}
private async getBattlesWon(): Promise<number> {
// Business metric - implement based on your battle service
return Math.floor(Math.random() * 10);
}
private async getHealthStatus() {
// Implement comprehensive health checks
const services = {
database: Math.random() > 0.1 ? 'up' : 'down',
redis: Math.random() > 0.05 ? 'up' : 'down',
api: Math.random() > 0.02 ? 'up' : 'degraded',
auth: Math.random() > 0.01 ? 'up' : 'down',
};
const downServices = Object.values(services).filter(s => s === 'down').length;
const degradedServices = Object.values(services).filter(s => s === 'degraded').length;
let overall: 'healthy' | 'warning' | 'critical' = 'healthy';
if (downServices > 0) {
overall = 'critical';
} else if (degradedServices > 0) {
overall = 'warning';
}
return { overall, services };
}
private generateLegionId(): string {
return `cohort-${Math.random().toString(36).substr(2, 9)}`;
}
async sendErrorToFleet(error: any, context?: any) {
if (!this.isRegistered) return;
try {
const errorData = {
cohortId: this.cohortId,
timestamp: new Date(),
error: {
message: error.message,
stack: error.stack,
type: error.constructor.name,
code: error.code,
},
context: {
url: context?.url,
method: context?.method,
user: context?.user?.id,
requestId: context?.requestId,
...context,
},
severity: this.classifyErrorSeverity(error),
};
await this.httpService.post(
`${this.fleetCenterUrl}/fleet/errors`,
errorData
).toPromise();
this.logger.debug(' Error sent to fleet center');
} catch (err) {
this.logger.error('Failed to send error to fleet center:', err.message);
}
}
private classifyErrorSeverity(error: any): 'low' | 'medium' | 'high' | 'critical' {
if (error.name?.includes('Database') || error.code === 'ECONNREFUSED') {
return 'critical';
}
if (error.status >= 500) {
return 'high';
}
if (error.status >= 400) {
return 'medium';
}
return 'low';
}
}2. Fleet Center - Hub central de monitoring
// fleet-center/fleet-monitor.service.ts
import { Injectable, Logger } from '@nestjs/common';
import { EventEmitter2 } from '@nestjs/event-emitter';
import { Cron } from '@nestjs/schedule';
export interface Fleet {
cohorts: Map<string, LegionInfo>;
totalLegions: number;
healthyLegions: number;
warningLegions: number;
criticalLegions: number;
lastUpdate: Date;
}
export interface LegionInfo {
cohortId: string;
cohortName: string;
centurion: string;
lastSeen: Date;
metrics: LegionMetrics;
status: 'healthy' | 'warning' | 'critical' | 'offline';
alerts: Alert[];
errors: ErrorEvent[];
}
@Injectable()
export class FleetMonitorService {
private readonly logger = new Logger(FleetMonitorService.name);
private fleet: Fleet = {
cohorts: new Map(),
totalLegions: 0,
healthyLegions: 0,
warningLegions: 0,
criticalLegions: 0,
lastUpdate: new Date(),
};
constructor(private readonly eventEmitter: EventEmitter2) {}
registerLegion(registrationData: any) {
const cohortInfo: LegionInfo = {
cohortId: registrationData.cohortId,
cohortName: registrationData.cohortName,
centurion: registrationData.centurion,
lastSeen: new Date(),
metrics: null,
status: 'healthy',
alerts: [],
errors: [],
};
this.fleet.cohorts.set(registrationData.cohortId, cohortInfo);
this.updateFleetStats();
this.logger.log(` Legion registered: ${cohortInfo.cohortName} (${cohortInfo.cohortId})`);
this.eventEmitter.emit('cohort.registered', cohortInfo);
}
updateLegionMetrics(cohortId: string, metrics: LegionMetrics) {
const cohort = this.fleet.cohorts.get(cohortId);
if (!cohort) {
this.logger.warn(`Received metrics from unregistered cohort: ${cohortId}`);
return;
}
cohort.metrics = metrics;
cohort.lastSeen = new Date();
cohort.status = this.determineLegionStatus(cohort);
this.updateFleetStats();
this.analyzeMetricsForAlerts(cohort);
this.eventEmitter.emit('cohort.metrics.updated', { cohortId, metrics });
}
recordLegionError(cohortId: string, errorData: any) {
const cohort = this.fleet.cohorts.get(cohortId);
if (!cohort) {
this.logger.warn(`Received error from unregistered cohort: ${cohortId}`);
return;
}
const errorEvent: ErrorEvent = {
id: `error-${Date.now()}-${Math.random()}`,
timestamp: new Date(),
cohortId,
...errorData,
};
cohort.errors.push(errorEvent);
// Keep only last 100 errors per cohort
if (cohort.errors.length > 100) {
cohort.errors = cohort.errors.slice(-100);
}
this.processError(errorEvent);
this.eventEmitter.emit('cohort.error', errorEvent);
}
private determineLegionStatus(cohort: LegionInfo): 'healthy' | 'warning' | 'critical' | 'offline' {
if (!cohort.metrics) return 'offline';
const timeSinceLastSeen = Date.now() - cohort.lastSeen.getTime();
if (timeSinceLastSeen > 300000) { // 5 minutes
return 'offline';
}
if (cohort.metrics.health.overall === 'critical') {
return 'critical';
}
const { cpu, memory } = cohort.metrics.system;
const { errorRate } = cohort.metrics.application;
if (cpu > 90 || memory > 90 || errorRate > 10) {
return 'critical';
}
if (cpu > 70 || memory > 70 || errorRate > 5 || cohort.metrics.health.overall === 'warning') {
return 'warning';
}
return 'healthy';
}
private updateFleetStats() {
this.fleet.totalLegions = this.fleet.cohorts.size;
this.fleet.healthyLegions = 0;
this.fleet.warningLegions = 0;
this.fleet.criticalLegions = 0;
for (const cohort of this.fleet.cohorts.values()) {
switch (cohort.status) {
case 'healthy':
this.fleet.healthyLegions++;
break;
case 'warning':
this.fleet.warningLegions++;
break;
case 'critical':
this.fleet.criticalLegions++;
break;
}
}
this.fleet.lastUpdate = new Date();
}
private analyzeMetricsForAlerts(cohort: LegionInfo) {
const alerts: Alert[] = [];
// CPU Alert
if (cohort.metrics.system.cpu > 90) {
alerts.push(this.createAlert(
'high-cpu',
'critical',
`High CPU usage on ${cohort.cohortName}`,
`CPU usage is ${cohort.metrics.system.cpu.toFixed(1)}%`,
cohort.cohortId
));
}
// Memory Alert
if (cohort.metrics.system.memory > 90) {
alerts.push(this.createAlert(
'high-memory',
'critical',
`High memory usage on ${cohort.cohortName}`,
`Memory usage is ${cohort.metrics.system.memory.toFixed(1)}%`,
cohort.cohortId
));
}
// Error Rate Alert
if (cohort.metrics.application.errorRate > 10) {
alerts.push(this.createAlert(
'high-error-rate',
'high',
`High error rate on ${cohort.cohortName}`,
`Error rate is ${cohort.metrics.application.errorRate.toFixed(2)}%`,
cohort.cohortId
));
}
// Response Time Alert
if (cohort.metrics.application.responseTime.p99 > 5000) {
alerts.push(this.createAlert(
'slow-response',
'medium',
`Slow response times on ${cohort.cohortName}`,
`P99 response time is ${cohort.metrics.application.responseTime.p99.toFixed(0)}ms`,
cohort.cohortId
));
}
// Business Metrics Alerts
if (cohort.metrics.business.tributesFound === 0) {
alerts.push(this.createAlert(
'no-tributes',
'low',
`No tributes found on ${cohort.cohortName}`,
'Legion legion might need motivation!',
cohort.cohortId
));
}
// Add new alerts and trigger them
for (const alert of alerts) {
if (!cohort.alerts.some(a => a.type === alert.type && a.severity === alert.severity)) {
cohort.alerts.push(alert);
this.eventEmitter.emit('alert.triggered', alert);
}
}
}
@Cron('0 */5 * * * *') // Every 5 minutes
checkFleetHealth() {
const offlineLegions = [];
const now = Date.now();
for (const [cohortId, cohort] of this.fleet.cohorts) {
const timeSinceLastSeen = now - cohort.lastSeen.getTime();
if (timeSinceLastSeen > 300000) { // 5 minutes offline
cohort.status = 'offline';
offlineLegions.push(cohort);
}
}
if (offlineLegions.length > 0) {
for (const cohort of offlineLegions) {
const alert = this.createAlert(
'cohort-offline',
'critical',
`Legion ${cohort.cohortName} is offline`,
`No communication for ${Math.round((now - cohort.lastSeen.getTime()) / 60000)} minutes`,
cohort.cohortId
);
this.eventEmitter.emit('alert.triggered', alert);
}
}
this.updateFleetStats();
}
getFleetOverview(): Fleet {
return this.fleet;
}
getLegionDetails(cohortId: string): LegionInfo | null {
return this.fleet.cohorts.get(cohortId) || null;
}
getFleetMetrics() {
const cohorts = Array.from(this.fleet.cohorts.values());
return {
fleet: this.fleet,
aggregatedMetrics: {
totalCpu: cohorts.reduce((sum, cohort) => sum + (cohort.metrics?.system.cpu || 0), 0),
totalMemory: cohorts.reduce((sum, cohort) => sum + (cohort.metrics?.system.memory || 0), 0),
totalErrors: cohorts.reduce((sum, cohort) => sum + cohort.errors.length, 0),
totalTributes: cohorts.reduce((sum, cohort) => sum + (cohort.metrics?.business.tributesFound || 0), 0),
averageResponseTime: cohorts.reduce((sum, cohort) => sum + (cohort.metrics?.application.responseTime.avg || 0), 0) / cohorts.length,
},
topPerformers: this.getTopPerformingLegions(),
worstPerformers: this.getWorstPerformingLegions(),
};
}
private getTopPerformingLegions(): LegionInfo[] {
return Array.from(this.fleet.cohorts.values())
.filter(cohort => cohort.metrics && cohort.status === 'healthy')
.sort((a, b) => b.metrics.business.tributesFound - a.metrics.business.tributesFound)
.slice(0, 5);
}
private getWorstPerformingLegions(): LegionInfo[] {
return Array.from(this.fleet.cohorts.values())
.filter(cohort => cohort.metrics && cohort.status !== 'healthy')
.sort((a, b) => b.metrics.application.errorRate - a.metrics.application.errorRate)
.slice(0, 5);
}
private createAlert(type: string, severity: string, title: string, description: string, cohortId: string): Alert {
return {
id: `alert-${Date.now()}-${Math.random()}`,
type,
severity,
title,
description,
cohortId,
timestamp: new Date(),
resolved: false,
};
}
private processError(errorEvent: ErrorEvent) {
// Implement error processing logic
// - Error correlation
// - Pattern detection
// - Automatic alert generation
this.logger.debug(`Processing error from ${errorEvent.cohortId}: ${errorEvent.error.message}`);
}
}Tâches à réaliser
Partie 1 : Système de base (4-6 heures)
- Implémentation de l'agent de légion
- Implémenter LegionAgentService avec de vraies métriques
- Ajouter un intercepteur de suivi des erreurs
- Créer des endpoints de health check
- Ajouter l'enregistrement automatique auprès du fleet center
- Cœur du Fleet Center
- Implémenter FleetMonitorService
- Créer les endpoints d'API pour l'enregistrement et les métriques
- Ajouter un endpoint de tableau de bord de base
- Implémenter la communication WebSocket en temps réel
Partie 2 : Fonctionnalités avancées (6-8 heures)
- Alerting intelligent
- Machine learning pour la prédiction des problèmes
- Corrélation et déduplication des alertes
- Politiques d'escalade
- Notifications multicanales (Slack, e-mail, SMS)
- Moteur d'analytique
- Analyse de tendances et prévisions
- Détection d'anomalies
- Références de performance (baselines)
- Corrélation des métriques métier
Partie 3 : Fonctionnalités entreprise (8-10 heures)
- Monitoring avancé
- Framework de métriques personnalisées
- Traçage distribué
- Agrégation des logs
- Monitoring des SLA
- Intégration et déploiement
- Intégration Prometheus/Grafana
- Conteneurisation Docker
- Déploiement Kubernetes
- Pipeline CI/CD
Partie 4 : Tests et documentation (4-6 heures)
- Tests complets
- Tests unitaires pour tous les composants
- Tests d'intégration pour la communication de la flotte
- Tests de charge pour la scalabilité
- Tests E2E du workflow complet
- Documentation et guide de déploiement
- Documentation de l'API (Swagger)
- Guide de déploiement
- Runbooks de monitoring
- Guide de dépannage
Critères d'évaluation
� Critères d'excellence (90-100 %)
Implémentation complète de toutes les fonctionnalités requises Performance - le système gère >100 navires simultanément Scalabilité - ajout facile de nouveaux types de métriques et d'alertes Fiabilité - le système fonctionne de façon stable pendant 24 h sans interruption Sécurité - authentification et autorisation correctes Qualité du code - code propre, patterns appropriés, tests complets Documentation - documentation complète et guides de déploiement
Fonctionnalités avancées (points bonus)
Machine Learning - alerting prédictif et détection d'anomalies Auto-scaling - ajustement automatique des ressources en fonction des métriques Multi-région - prise en charge de flottes géographiquement distribuées Application mobile - application React Native pour le monitoring de la flotte Alertes vocales - intégration avec Amazon Alexa pour des notifications vocales
Bonne chance, amiral ! Ta flotte compte sur toi - crée un système de monitoring qui deviendra une légende des mers de la technologie !
Code de cette leçon : src/monitoring/fleet-monitoring-project.ts
// PROJET : Système complet de surveillance de la flotte
// Combinaison d'Exception Filters, Logging, Health Checks et Alertes
import { Injectable, Logger } from '@nestjs/common';
import { Controller, Get } from '@nestjs/common';
// ===========================================
// 1. Système central de monitoring
// ===========================================
@Injectable()
export class FleetMonitoringService {
private logger = new Logger('FleetMonitor');
// Registre des navires de la flotte
private ships = new Map<string, {
name: string;
status: 'operational' | 'warning' | 'critical' | 'offline';
lastHealthCheck: Date;
metrics: { cpu: number; memory: number; errors: number };
}>();
// Enregistrement d'un navire
registerShip(id: string, name: string) {
this.ships.set(id, {
name,
status: 'operational',
lastHealthCheck: new Date(),
metrics: { cpu: 0, memory: 0, errors: 0 },
});
this.logger.log('Navire enregistré : ' + name);
}
// Mise à jour des métriques
updateMetrics(id: string, metrics: { cpu: number; memory: number; errors: number }) {
const ship = this.ships.get(id);
if (!ship) return;
ship.metrics = metrics;
ship.lastHealthCheck = new Date();
// Changement automatique du statut en fonction des métriques
if (metrics.errors > 10 || metrics.cpu > 95) {
ship.status = 'critical';
this.logger.error('CRITICAL: ' + ship.name);
} else if (metrics.errors > 5 || metrics.cpu > 80) {
ship.status = 'warning';
this.logger.warn('WARNING: ' + ship.name);
} else {
ship.status = 'operational';
}
}
// Tableau de bord de toute la flotte
getFleetDashboard() {
const ships = Array.from(this.ships.entries()).map(([id, data]) => ({
id, ...data,
}));
const operational = ships.filter(s => s.status === 'operational').length;
const warnings = ships.filter(s => s.status === 'warning').length;
const critical = ships.filter(s => s.status === 'critical').length;
return {
totalShips: ships.length,
operational,
warnings,
critical,
fleetHealth: critical > 0 ? 'ALERT' : warnings > 0 ? 'CAUTION' : 'OK',
ships,
generatedAt: new Date().toISOString(),
};
}
}
// ===========================================
// 2. Dashboard Controller
// ===========================================
@Controller('fleet-monitor')
export class FleetMonitorController {
constructor(private monitorService: FleetMonitoringService) {}
@Get('dashboard')
getDashboard() {
return this.monitorService.getFleetDashboard();
}
}
// ===========================================
// 3. Simulation
// ===========================================
const monitor = new FleetMonitoringService();
monitor.registerShip('S1', 'Imperator');
monitor.registerShip('S2', 'Aquila');
monitor.registerShip('S3', 'Victoria');
monitor.updateMetrics('S1', { cpu: 45, memory: 60, errors: 0 });
monitor.updateMetrics('S2', { cpu: 85, memory: 70, errors: 7 });
monitor.updateMetrics('S3', { cpu: 20, memory: 30, errors: 0 });
const dashboard = monitor.getFleetDashboard();
console.log('=== Fleet Dashboard ===');
console.log('Navires :', dashboard.totalShips);
console.log('Operational:', dashboard.operational);
console.log('Warnings:', dashboard.warnings);
console.log('Critical:', dashboard.critical);
console.log('État de la flotte :', dashboard.fleetHealth);
Entrées de la documentation utilisées dans cette leçon
Tu as repéré une erreur dans cette leçon ?