From 28f3997546b0019c700cb7f2d28904f725f482b0 Mon Sep 17 00:00:00 2001 From: Vitaliy Roshchupkin Date: Fri, 5 Apr 2024 11:28:55 +0500 Subject: [PATCH] feat(SystemMetricsSender): pass settings to speed up linux process metrics collecting --- .../Components/SystemMetrics/SystemMetricsBuilder.cs | 3 ++- .../Components/SystemMetrics/SystemMetricsSettings.cs | 3 +++ Vostok.Hosting/PublicAPI/net6.0/PublicAPI.Unshipped.txt | 2 ++ .../PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt | 2 ++ module.yaml | 2 +- 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Vostok.Hosting/Components/SystemMetrics/SystemMetricsBuilder.cs b/Vostok.Hosting/Components/SystemMetrics/SystemMetricsBuilder.cs index 1540d6b7..faa3da41 100644 --- a/Vostok.Hosting/Components/SystemMetrics/SystemMetricsBuilder.cs +++ b/Vostok.Hosting/Components/SystemMetrics/SystemMetricsBuilder.cs @@ -78,7 +78,8 @@ private void RegisterProcessMonitor(SystemMetricsSettings settings, BuildContext var collectorSettings = new CurrentProcessMetricsSettings { CpuCoresLimitProvider = () => context.ApplicationLimits.CpuUnits, - MemoryBytesLimitProvider = () => context.ApplicationLimits.MemoryBytes + MemoryBytesLimitProvider = () => context.ApplicationLimits.MemoryBytes, + LinuxSettings = settings.LinuxProcessMetricsSettings }; var collector = new CurrentProcessMetricsCollector(collectorSettings); diff --git a/Vostok.Hosting/Components/SystemMetrics/SystemMetricsSettings.cs b/Vostok.Hosting/Components/SystemMetrics/SystemMetricsSettings.cs index 1b86b49e..50364c79 100644 --- a/Vostok.Hosting/Components/SystemMetrics/SystemMetricsSettings.cs +++ b/Vostok.Hosting/Components/SystemMetrics/SystemMetricsSettings.cs @@ -2,6 +2,7 @@ using JetBrains.Annotations; using Vostok.Commons.Time; using Vostok.Metrics.System.Host; +using Vostok.Metrics.System.Process; namespace Vostok.Hosting.Components.SystemMetrics { @@ -24,6 +25,8 @@ public class SystemMetricsSettings public HostMetricsSettings HostMetricsSettings { get; set; } = new HostMetricsSettings(); + public LinuxProcessMetricsSettings LinuxProcessMetricsSettings { get; set; } = new LinuxProcessMetricsSettings(); + public TimeSpan GcMinimumDurationForLogging { get; set; } = 500.Milliseconds(); public TimeSpan ProcessMetricsLoggingPeriod { get; set; } = 10.Seconds(); diff --git a/Vostok.Hosting/PublicAPI/net6.0/PublicAPI.Unshipped.txt b/Vostok.Hosting/PublicAPI/net6.0/PublicAPI.Unshipped.txt index e69de29b..bc51f341 100644 --- a/Vostok.Hosting/PublicAPI/net6.0/PublicAPI.Unshipped.txt +++ b/Vostok.Hosting/PublicAPI/net6.0/PublicAPI.Unshipped.txt @@ -0,0 +1,2 @@ +Vostok.Hosting.Components.SystemMetrics.SystemMetricsSettings.LinuxProcessMetricsSettings.get -> Vostok.Metrics.System.Process.LinuxProcessMetricsSettings +Vostok.Hosting.Components.SystemMetrics.SystemMetricsSettings.LinuxProcessMetricsSettings.set -> void \ No newline at end of file diff --git a/Vostok.Hosting/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt b/Vostok.Hosting/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt index e69de29b..bc51f341 100644 --- a/Vostok.Hosting/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt +++ b/Vostok.Hosting/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt @@ -0,0 +1,2 @@ +Vostok.Hosting.Components.SystemMetrics.SystemMetricsSettings.LinuxProcessMetricsSettings.get -> Vostok.Metrics.System.Process.LinuxProcessMetricsSettings +Vostok.Hosting.Components.SystemMetrics.SystemMetricsSettings.LinuxProcessMetricsSettings.set -> void \ No newline at end of file diff --git a/module.yaml b/module.yaml index 85474a9d..f94cf051 100644 --- a/module.yaml +++ b/module.yaml @@ -62,7 +62,7 @@ notests *default: - vostok.logging.tracing - vostok.metrics - vostok.metrics.hercules - - vostok.metrics.system + - vostok.metrics.system@linux_slow_metrics - vostok.servicediscovery - vostok.servicediscovery.abstractions - vostok.tracing