diff --git a/src/KafkaFlow.Admin/Extensions/ClusterConfigurationBuilderExtensions.cs b/src/KafkaFlow.Admin/Extensions/ClusterConfigurationBuilderExtensions.cs index 2d63ebb88..523b4d3c8 100644 --- a/src/KafkaFlow.Admin/Extensions/ClusterConfigurationBuilderExtensions.cs +++ b/src/KafkaFlow.Admin/Extensions/ClusterConfigurationBuilderExtensions.cs @@ -80,19 +80,23 @@ public static IClusterConfigurationBuilder EnableAdminMessages( /// The cluster configuration builder /// The topic to be used by the metric commands /// The consumer group prefix + /// How often run storage cleanup. Every 10 minutes by default + /// Cleanup will remove metrics older than specified interval. 6 hours by default /// public static IClusterConfigurationBuilder EnableTelemetry( this IClusterConfigurationBuilder cluster, string topicName, - string consumerGroup) + string consumerGroup, + TimeSpan? cleanRunInterval = null, + TimeSpan? expiryTime = null) { cluster.DependencyConfigurator .AddSingleton() .AddSingleton( resolver => new MemoryTelemetryStorage( - TimeSpan.FromMinutes(10), - TimeSpan.FromHours(6), + cleanRunInterval ?? TimeSpan.FromMinutes(10), + expiryTime ?? TimeSpan.FromHours(6), resolver.Resolve())); var groupId = $"{consumerGroup}-{Environment.MachineName}-{Convert.ToBase64String(Guid.NewGuid().ToByteArray())}";