MetricsConfig.fromJson constructor

MetricsConfig.fromJson(
  1. Map<String, dynamic> json
)

Creates a MetricsConfig from a JSON map.

Implementation

factory MetricsConfig.fromJson(Map<String, dynamic> json) {
  return MetricsConfig(
    enabled: json['enabled'] as bool? ?? true,
    collectionIntervalSeconds:
        json['collectionIntervalSeconds'] as int? ?? 60,
    collectSystemMetrics: json['collectSystemMetrics'] as bool? ?? true,
    collectNetworkMetrics: json['collectNetworkMetrics'] as bool? ?? true,
    collectStorageMetrics: json['collectStorageMetrics'] as bool? ?? true,
    enablePrometheusExport: json['enablePrometheusExport'] as bool? ?? false,
    prometheusEndpoint: json['prometheusEndpoint'] as String? ?? '/metrics',
  );
}