From 9f3e9d2726a821d6d2144eac7747bfabe2f237f4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 2 May 2022 22:26:26 -0700 Subject: [PATCH 01/71] [main] Add ability to filter log messages based on log level (#1833) --- .../Environment/EnvironmentHelper.cpp | 18 ++++++ .../Environment/EnvironmentHelper.h | 8 +++ .../Logging/AggregateLogger.cpp | 26 +++++++- src/MonitorProfiler/Logging/AggregateLogger.h | 5 ++ src/MonitorProfiler/Logging/DebugLogger.cpp | 23 +++++++ src/MonitorProfiler/Logging/DebugLogger.h | 10 +++ src/MonitorProfiler/Logging/LogLevelHelper.h | 63 +++++++++++++++++++ src/MonitorProfiler/Logging/Logger.h | 34 +++++++--- .../MainProfiler/MainProfiler.cpp | 4 +- 9 files changed, 179 insertions(+), 12 deletions(-) diff --git a/src/MonitorProfiler/Environment/EnvironmentHelper.cpp b/src/MonitorProfiler/Environment/EnvironmentHelper.cpp index 2e3b91e3f9e..c4bfaf6ae4e 100644 --- a/src/MonitorProfiler/Environment/EnvironmentHelper.cpp +++ b/src/MonitorProfiler/Environment/EnvironmentHelper.cpp @@ -3,12 +3,30 @@ // See the LICENSE file in the project root for more information. #include "EnvironmentHelper.h" +#include "../Logging/LogLevelHelper.h" #include "productversion.h" using namespace std; #define IfFailLogRet(EXPR) IfFailLogRet_(pLogger, EXPR) +HRESULT EnvironmentHelper::GetDebugLoggerLevel( + const std::shared_ptr& pEnvironment, + LogLevel& level) +{ + HRESULT hr = S_OK; + + tstring tstrLevel; + IfFailRet(pEnvironment->GetEnvironmentVariable( + s_wszDebugLoggerLevelEnvVar, + tstrLevel + )); + + IfFailRet(LogLevelHelper::ToLogLevel(tstrLevel, level)); + + return S_OK; +} + HRESULT EnvironmentHelper::SetProductVersion( const shared_ptr& pEnvironment, const shared_ptr& pLogger) diff --git a/src/MonitorProfiler/Environment/EnvironmentHelper.h b/src/MonitorProfiler/Environment/EnvironmentHelper.h index 820de521fc7..12942ea7e26 100644 --- a/src/MonitorProfiler/Environment/EnvironmentHelper.h +++ b/src/MonitorProfiler/Environment/EnvironmentHelper.h @@ -14,9 +14,17 @@ class EnvironmentHelper final { private: + static constexpr LPCWSTR s_wszDebugLoggerLevelEnvVar = _T("DotnetMonitorProfiler_DebugLogger_Level"); static constexpr LPCWSTR s_wszProfilerVersionEnvVar = _T("DotnetMonitorProfiler_ProductVersion"); public: + /// + /// Gets the log level for the debug logger from the environment. + /// + static HRESULT GetDebugLoggerLevel( + const std::shared_ptr& pEnvironment, + LogLevel& level); + /// /// Sets the product version environment variable in the specified environment. /// diff --git a/src/MonitorProfiler/Logging/AggregateLogger.cpp b/src/MonitorProfiler/Logging/AggregateLogger.cpp index 1229674e9e6..7740653cde0 100644 --- a/src/MonitorProfiler/Logging/AggregateLogger.cpp +++ b/src/MonitorProfiler/Logging/AggregateLogger.cpp @@ -13,13 +13,37 @@ STDMETHODIMP AggregateLogger::Add(const shared_ptr pLogger) return S_OK; } +STDMETHODIMP_(bool) AggregateLogger::IsEnabled(LogLevel level) +{ + // Check if any logger accepts the specified level + // CONSIDER: Further optimization could be made to classify the loggers + // into different lists for each level such that the aggregate logger would + // not need to check if the level is enabled for each IsEnabled call. + for (shared_ptr& pLogger : m_loggers) + { + if (pLogger->IsEnabled(level)) + { + return true; + } + } + + return false; +} + STDMETHODIMP AggregateLogger::Log(LogLevel level, const tstring format, va_list args) { HRESULT hr = S_OK; for (shared_ptr& pLogger : m_loggers) { - IfFailRet(pLogger->Log(level, format, args)); + // Only pass to logger if it accepts the level + // CONSIDER: Further optimization could be made to classify the loggers + // into different lists for each level such that the aggregate logger would + // not need to check if the level is enabled for each Log call. + if (pLogger->IsEnabled(level)) + { + IfFailRet(pLogger->Log(level, format, args)); + } } return S_OK; diff --git a/src/MonitorProfiler/Logging/AggregateLogger.h b/src/MonitorProfiler/Logging/AggregateLogger.h index 11dc7d46bef..26b26588d1c 100644 --- a/src/MonitorProfiler/Logging/AggregateLogger.h +++ b/src/MonitorProfiler/Logging/AggregateLogger.h @@ -27,6 +27,11 @@ class AggregateLogger final : public: // ILogger Members + /// + /// Determines if any of the registered ILogger implementations have the specified LogLevel enabled. + /// + STDMETHOD_(bool, IsEnabled)(LogLevel level) override; + /// /// Invokes the Log method on each registered ILogger implementation. /// diff --git a/src/MonitorProfiler/Logging/DebugLogger.cpp b/src/MonitorProfiler/Logging/DebugLogger.cpp index 79b1f4d0905..2477a7dc849 100644 --- a/src/MonitorProfiler/Logging/DebugLogger.cpp +++ b/src/MonitorProfiler/Logging/DebugLogger.cpp @@ -4,9 +4,32 @@ #include "DebugLogger.h" #include "LogLevelHelper.h" +#include "../Environment/EnvironmentHelper.h" + +using namespace std; + +DebugLogger::DebugLogger(const shared_ptr& pEnvironment) +{ + // Try to get log level from environment + if (FAILED(EnvironmentHelper::GetDebugLoggerLevel(pEnvironment, m_level))) + { + // Fallback to default level + m_level = s_DefaultLevel; + } +} + +STDMETHODIMP_(bool) DebugLogger::IsEnabled(LogLevel level) +{ + return LogLevelHelper::IsEnabled(level, m_level); +} STDMETHODIMP DebugLogger::Log(LogLevel level, const tstring format, va_list args) { + if (!IsEnabled(level)) + { + return S_FALSE; + } + HRESULT hr = S_OK; WCHAR wszMessage[s_nMaxEntrySize]; diff --git a/src/MonitorProfiler/Logging/DebugLogger.h b/src/MonitorProfiler/Logging/DebugLogger.h index 73978c6ad4b..e35a3ede094 100644 --- a/src/MonitorProfiler/Logging/DebugLogger.h +++ b/src/MonitorProfiler/Logging/DebugLogger.h @@ -7,6 +7,7 @@ #include #include #include "Logger.h" +#include "../Environment/Environment.h" /// /// Logs messages to the debug output window when running under a debugger. @@ -15,11 +16,20 @@ class DebugLogger final : public ILogger { private: + const static LogLevel s_DefaultLevel = LogLevel::Information; const static int s_nMaxEntrySize = 1000; + LogLevel m_level = s_DefaultLevel; + +public: + DebugLogger(const std::shared_ptr& pEnvironment); + public: // ILogger Members + /// + STDMETHOD_(bool, IsEnabled)(LogLevel level) override; + /// STDMETHOD(Log)(LogLevel level, const tstring format, va_list args) override; }; diff --git a/src/MonitorProfiler/Logging/LogLevelHelper.h b/src/MonitorProfiler/Logging/LogLevelHelper.h index be388df59d8..36540f2c4e9 100644 --- a/src/MonitorProfiler/Logging/LogLevelHelper.h +++ b/src/MonitorProfiler/Logging/LogLevelHelper.h @@ -47,4 +47,67 @@ class LogLevelHelper final return E_FAIL; } } + + /// + /// Checks if level is valid and meets the specified threshold level. + /// + static bool IsEnabled(LogLevel level, LogLevel thresholdLevel) + { + if (LogLevel::None == level || LogLevel::None == thresholdLevel) + { + return false; + } + + return LogLevelHelper::IsValid(level) && level >= thresholdLevel; + } + + /// + /// Checks if level is valid. + /// + static bool IsValid(LogLevel level) + { + return LogLevel::Trace <= level && level <= LogLevel::None; + } + + /// + /// Converts a string to its corresponding LogLevel + /// + static HRESULT ToLogLevel(const tstring& tstrLevel, LogLevel& level) + { + if (0 == tstrLevel.compare(_T("Critical"))) + { + level = LogLevel::Critical; + } + else if (0 == tstrLevel.compare(_T("Debug"))) + { + level = LogLevel::Debug; + } + else if (0 == tstrLevel.compare(_T("Error"))) + { + level = LogLevel::Error; + } + else if (0 == tstrLevel.compare(_T("Information"))) + { + level = LogLevel::Information; + } + else if (0 == tstrLevel.compare(_T("None"))) + { + level = LogLevel::None; + } + else if (0 == tstrLevel.compare(_T("Trace"))) + { + level = LogLevel::Trace; + } + else if (0 == tstrLevel.compare(_T("Warning"))) + { + level = LogLevel::Warning; + } + else + { + level = LogLevel::None; + return E_FAIL; + } + + return S_OK; + } }; diff --git a/src/MonitorProfiler/Logging/Logger.h b/src/MonitorProfiler/Logging/Logger.h index bdd86add78a..5459c512322 100644 --- a/src/MonitorProfiler/Logging/Logger.h +++ b/src/MonitorProfiler/Logging/Logger.h @@ -27,6 +27,11 @@ enum class LogLevel /// DECLARE_INTERFACE(ILogger) { + /// + /// Determines if the logger accepts a message at the given LogLevel. + /// + STDMETHOD_(bool, IsEnabled)(LogLevel level) PURE; + /// /// Writes a log message. /// @@ -49,11 +54,14 @@ DECLARE_INTERFACE(ILogger) hr = (EXPR); \ if(FAILED(hr)) { \ if (nullptr != pLogger) { \ - pLogger->Log( \ - LogLevel::Error, \ - _T("IfFailLogRet(" #EXPR ") failed in function %s: 0x%08x"), \ - to_tstring(__func__).c_str(), \ - hr); \ + if (pLogger->IsEnabled(LogLevel::Error)) \ + { \ + pLogger->Log(\ + LogLevel::Error, \ + _T("IfFailLogRet(" #EXPR ") failed in function %s: 0x%08x"), \ + to_tstring(__func__).c_str(), \ + hr); \ + } \ } \ return (hr); \ } \ @@ -65,10 +73,13 @@ DECLARE_INTERFACE(ILogger) do { \ if(nullptr == (EXPR)) { \ if (nullptr != pLogger) { \ - pLogger->Log( \ - LogLevel::Error, \ - _T("IfNullLogRetPtr(" #EXPR ") failed in function %s"), \ - to_tstring(__func__).c_str()); \ + if (pLogger->IsEnabled(LogLevel::Error)) \ + { \ + pLogger->Log( \ + LogLevel::Error, \ + _T("IfNullLogRetPtr(" #EXPR ") failed in function %s"), \ + to_tstring(__func__).c_str()); \ + } \ } \ return E_POINTER; \ } \ @@ -77,7 +88,10 @@ DECLARE_INTERFACE(ILogger) // Logs a message with arguments at the specified level // Checks if logging failed, returns the HRESULT if failed #define LogV_(pLogger, level, format, ...) \ - IfFailRet(pLogger->Log(level, format, __VA_ARGS__)) + if (pLogger->IsEnabled(level)) \ + { \ + IfFailRet(pLogger->Log(level, format, __VA_ARGS__)); \ + } // Logs a message at the Trace level #define LogTraceV_(pLogger, format, ...) \ diff --git a/src/MonitorProfiler/MainProfiler/MainProfiler.cpp b/src/MonitorProfiler/MainProfiler/MainProfiler.cpp index 1f5b3857b4e..8954c25bdbc 100644 --- a/src/MonitorProfiler/MainProfiler/MainProfiler.cpp +++ b/src/MonitorProfiler/MainProfiler/MainProfiler.cpp @@ -74,6 +74,8 @@ HRESULT MainProfiler::InitializeEnvironment() HRESULT MainProfiler::InitializeLogging() { + HRESULT hr = S_OK; + // Create an aggregate logger to allow for multiple logging implementations unique_ptr pAggregateLogger(new (nothrow) AggregateLogger()); IfNullRet(pAggregateLogger); @@ -81,7 +83,7 @@ HRESULT MainProfiler::InitializeLogging() #ifdef _DEBUG #ifdef TARGET_WINDOWS // Add the debug output logger for when debugging on Windows - shared_ptr pDebugLogger = make_shared(); + shared_ptr pDebugLogger = make_shared(m_pEnvironment); IfNullRet(pDebugLogger); pAggregateLogger->Add(pDebugLogger); #endif From ebab84558bc7d000e30de39dbd8d2b1af08ba317 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 3 May 2022 12:52:39 +0000 Subject: [PATCH 02/71] Update dependencies from https://github.com/dotnet/diagnostics build 20220502.1 (#1835) [main] Update dependencies from dotnet/diagnostics --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0fe5287e992..6eb96f4cceb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,13 +4,13 @@ https://github.com/dotnet/command-line-api 166610c56ff732093f0145a2911d4f6c40b786da - + https://github.com/dotnet/diagnostics - 0bcc6110ea09bdd83d6ad637a175b0f86f0191d0 + 0f48d0f01591b39ab2aaa2c7c36d69d7a87d5a01 - + https://github.com/dotnet/diagnostics - 0bcc6110ea09bdd83d6ad637a175b0f86f0191d0 + 0f48d0f01591b39ab2aaa2c7c36d69d7a87d5a01 diff --git a/eng/Versions.props b/eng/Versions.props index 0be35d2d4b1..f9dc07d3f13 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -48,8 +48,8 @@ 7.0.0-preview.5.22252.1 7.0.0-preview.5.22252.1 - 5.0.0-preview.22229.1 - 5.0.0-preview.22229.1 + 5.0.0-preview.22252.1 + 5.0.0-preview.22252.1 7.0.0-preview.5.22226.6 7.0.0-preview.5.22226.6 From c8a600996b6e53ad2c8e947436ae289541d2d4ae Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 3 May 2022 16:08:42 +0000 Subject: [PATCH 03/71] Update dependencies from https://github.com/dotnet/aspnetcore build 20220502.7 (#1837) [main] Update dependencies from dotnet/aspnetcore --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6eb96f4cceb..47cd508f8a0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,9 +14,9 @@ - + https://github.com/dotnet/aspnetcore - d9327eb223cf35d0e7fe6e9431ded3dac95f2e69 + 8ba6e945c6023543a150b482e5d8387e4f6804a6 https://github.com/dotnet/arcade @@ -34,9 +34,9 @@ https://github.com/dotnet/runtime c10154087e734fa58f08f2797e5d99404e9cd96b - + https://github.com/dotnet/aspnetcore - d9327eb223cf35d0e7fe6e9431ded3dac95f2e69 + 8ba6e945c6023543a150b482e5d8387e4f6804a6 https://github.com/dotnet/runtime diff --git a/eng/Versions.props b/eng/Versions.props index f9dc07d3f13..457637ac042 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -45,8 +45,8 @@ 7.0.0-beta.22225.6 - 7.0.0-preview.5.22252.1 - 7.0.0-preview.5.22252.1 + 7.0.0-preview.5.22252.7 + 7.0.0-preview.5.22252.7 5.0.0-preview.22252.1 5.0.0-preview.22252.1 From 3dcec1f330f938796a4cc91dd7e366e36fa3726f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 3 May 2022 16:11:19 +0000 Subject: [PATCH 04/71] Update dependencies from https://github.com/dotnet/symstore build 20220502.1 (#1836) [main] Update dependencies from dotnet/symstore --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 47cd508f8a0..0fa825fff21 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -26,9 +26,9 @@ https://github.com/dotnet/arcade 5145e86df0c491e082b589aa31d69eea300adc02 - + https://github.com/dotnet/symstore - 411f4c8bb161205bdc3d9891dd38eb75fb209a68 + 571c835ff07914a240d290367fb11b179ddbd7ea https://github.com/dotnet/runtime diff --git a/eng/Versions.props b/eng/Versions.props index 457637ac042..11e5e9b5706 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -54,7 +54,7 @@ 7.0.0-preview.5.22226.6 7.0.0-preview.5.22226.6 - 1.0.321801 + 1.0.325201 3.1.22 From f965acee8f2438f7c6254df0878f7d331b7766d7 Mon Sep 17 00:00:00 2001 From: Justin Anderson Date: Tue, 3 May 2022 14:58:10 -0700 Subject: [PATCH 05/71] Refactor blob group and package version file writing (#1834) --- eng/Publishing.props | 133 +++++++++++++----- src/Directory.Build.targets | 107 +------------- .../dotnet-monitor/dotnet-monitor.csproj | 1 - 3 files changed, 105 insertions(+), 136 deletions(-) diff --git a/eng/Publishing.props b/eng/Publishing.props index 5b5094d90ae..39a963cb2e7 100644 --- a/eng/Publishing.props +++ b/eng/Publishing.props @@ -16,10 +16,72 @@ - + + + + <_PreReleaseSeperatorIndex>$(Version.IndexOf('-')) + + + <_BlobGroupVersion Condition="'$(_PreReleaseSeperatorIndex)' != '-1'">$(Version.Substring(0, $(_PreReleaseSeperatorIndex))) + + + <_BlobGroupVersion Condition="'$(_PreReleaseSeperatorIndex)' == '-1'">$(Version) + + + + <_BlobGroupBuildQualityName Include="daily" ReleaseName="daily" /> + <_BlobGroupBuildQualityName Include="release" ReleaseName="release" /> + + + + <_SelectedBlobGroupQualityName Include="@(_BlobGroupBuildQualityName)" Condition="'%(Identity)' == '$(BlobGroupBuildQuality)'" /> + + + + <_BlobGroupVersionMajor>$(_BlobGroupVersion.Split('.')[0]) + <_BlobGroupVersionMinor>$(_BlobGroupVersion.Split('.')[1]) + + <_BlobGroupReleaseName>@(_SelectedBlobGroupQualityName->'%(ReleaseName)') + + + + + + + + + <_BlobGroupName>$(_BlobGroupVersionMajor).$(_BlobGroupVersionMinor)/$(_BlobGroupReleaseName) + + <_BuildVersion>$(_OriginalVersionPrefix)-$(_PreReleaseLabel)$(_BuildNumberLabels) + + + + - + + + + + + + %(FullPath).sha512 @@ -27,51 +89,52 @@ - + DependsOnTargets="CalculateBlobGroupAndBuildVersion;CalculatePackagesToPublish;GenerateChecksumsForPackages" + Inputs="@(PackageToPublish)" + Outputs="%(PackageToPublish.Identity).notexist"> - <_BlobGroupFilePath>%(PackageFile.FullPath).blobgroup - <_ChecksumFilePath>%(PackageFile.FullPath).sha512 - <_BuildVersionFileFilePath>%(PackageFile.FullPath).buildversionfile - <_PackageVersionFileFilePath>%(PackageFile.FullPath).versionfile + <_ChecksumFilePath>%(PackageToPublish.FullPath).sha512 + <_BuildVersionFilePath>%(PackageToPublish.FullPath).buildversion + <_PackageVersionFilePath>%(PackageToPublish.FullPath).version - - - - - - - - - - - - - + + + - - <_BuildVersionFilePath>%(PackageFile.RootDir)%(PackageFile.Directory)$(_BuildVersionFileName) - <_PackageVersionFilePath>%(PackageFile.RootDir)%(PackageFile.Directory)$(_PackageVersionFileName) - + + + + - - - - + + + + + - <_CommonArtifactData Include="NonShipping=true" Condition="'%(PackageFile.IsShipping)' != 'true'" /> + <_CommonArtifactData Include="NonShipping=true" Condition="'%(PackageToPublish.IsShipping)' != 'true'" /> <_PackageArtifactData Include="@(_CommonArtifactData)" /> @@ -96,7 +159,7 @@ - <_VersionContainerBlobItem Include="%(PackageFile.FullPath)" Condition="Exists('%(PackageFile.FullPath)')" > + <_VersionContainerBlobItem Include="%(PackageToPublish.FullPath)" Condition="Exists('%(PackageToPublish.FullPath)')" > @(_PackageArtifactData) diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index f975482d937..6f52c5bb80d 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -12,108 +12,15 @@ - - - - <_PreReleaseSeperatorIndex>$(PackageVersion.IndexOf('-')) - - - <_BlobGroupVersion Condition="'$(_PreReleaseSeperatorIndex)' != '-1'">$(PackageVersion.Substring(0, $(_PreReleaseSeperatorIndex))) - - - <_BlobGroupVersion Condition="'$(_PreReleaseSeperatorIndex)' == '-1'">$(PackageVersion) - - - - <_BlobGroupBuildQualityName Include="daily" ReleaseName="daily" /> - <_BlobGroupBuildQualityName Include="release" ReleaseName="release" /> - - - - <_SelectedBlobGroupQualityName Include="@(_BlobGroupBuildQualityName)" Condition="'%(Identity)' == '$(BlobGroupBuildQuality)'" /> - - - - <_BlobGroupVersionMajor>$(_BlobGroupVersion.Split('.')[0]) - <_BlobGroupVersionMinor>$(_BlobGroupVersion.Split('.')[1]) - - <_BlobGroupReleaseName>@(_SelectedBlobGroupQualityName->'%(ReleaseName)') - - - - - - - - - <_BlobGroupName>$(_BlobGroupVersionMajor).$(_BlobGroupVersionMinor)/$(_BlobGroupReleaseName) - - <_BuildVersion>$(_OriginalVersionPrefix)-$(_PreReleaseLabel)$(_BuildNumberLabels) - - <_PackageFileName>$(PackageId).$(PackageVersion).nupkg - <_PackageWithBuildVersionFileName>$(PackageId).$(_BuildVersion).nupkg - - - - - - - - - - - - - - - + + + diff --git a/src/Tools/dotnet-monitor/dotnet-monitor.csproj b/src/Tools/dotnet-monitor/dotnet-monitor.csproj index 1763bfcc698..159ad81273a 100644 --- a/src/Tools/dotnet-monitor/dotnet-monitor.csproj +++ b/src/Tools/dotnet-monitor/dotnet-monitor.csproj @@ -10,7 +10,6 @@ Diagnostic $(Description) Major - true From f897e58ac7b8009d4a27202127826a86e4f06ce9 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 3 May 2022 18:15:26 -0400 Subject: [PATCH 06/71] Add warning when collection rules are configured but not running in Listen mode (#1830) --- .../CollectionRules/CollectionRuleService.cs | 19 ++++++++++++++++++- src/Tools/dotnet-monitor/LoggingEventIds.cs | 3 ++- src/Tools/dotnet-monitor/LoggingExtensions.cs | 11 +++++++++++ src/Tools/dotnet-monitor/Strings.Designer.cs | 9 +++++++++ src/Tools/dotnet-monitor/Strings.resx | 3 +++ 5 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleService.cs b/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleService.cs index 96d0750712a..3c56e7cc04b 100644 --- a/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleService.cs +++ b/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleService.cs @@ -7,6 +7,7 @@ using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Configuration; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; using System; using System.Collections.Generic; using System.Linq; @@ -27,6 +28,7 @@ internal class CollectionRuleService : BackgroundService, IAsyncDisposable private readonly ChannelWriter _containersToRemoveWriter; private readonly ILogger _logger; private readonly CollectionRulesConfigurationProvider _provider; + private readonly DiagnosticPortOptions _portOptions; private readonly IServiceProvider _serviceProvider; private long _disposalState; @@ -34,12 +36,14 @@ internal class CollectionRuleService : BackgroundService, IAsyncDisposable public CollectionRuleService( IServiceProvider serviceProvider, ILogger logger, - CollectionRulesConfigurationProvider provider + CollectionRulesConfigurationProvider provider, + IOptions portOptions ) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _provider = provider ?? throw new ArgumentNullException(nameof(provider)); _serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); + _portOptions = portOptions.Value ?? throw new ArgumentNullException(nameof(portOptions)); BoundedChannelOptions containersToRemoveChannelOptions = new(PendingRemovalChannelCapacity) { @@ -51,6 +55,8 @@ CollectionRulesConfigurationProvider provider Channel.CreateBounded(containersToRemoveChannelOptions); _containersToRemoveReader = containersToRemoveChannel.Reader; _containersToRemoveWriter = containersToRemoveChannel.Writer; + + CheckForListenDiagnosticMode(); } public async ValueTask DisposeAsync() @@ -155,6 +161,8 @@ private async Task MonitorRuleChangesAsync(CancellationToken token) _logger.CollectionRuleConfigurationChanged(); + CheckForListenDiagnosticMode(); + // Get a copy of the container list to avoid having to // lock the entire list during stop and restart of all containers. CollectionRuleContainer[] containers; @@ -221,6 +229,15 @@ private async Task MonitorRuleChangesAsync(CancellationToken token) } } + private void CheckForListenDiagnosticMode() + { + if (DiagnosticPortOptionsExtensions.GetConnectionMode(_portOptions) != DiagnosticPortConnectionMode.Listen + && _provider.GetCollectionRuleNames().Any()) + { + _logger.DiagnosticPortNotInListenModeForCollectionRules(); + } + } + private async Task StopAndDisposeContainerAsync(CancellationToken token) { while (!token.IsCancellationRequested) diff --git a/src/Tools/dotnet-monitor/LoggingEventIds.cs b/src/Tools/dotnet-monitor/LoggingEventIds.cs index d5d9399d2e6..6cc193069e8 100644 --- a/src/Tools/dotnet-monitor/LoggingEventIds.cs +++ b/src/Tools/dotnet-monitor/LoggingEventIds.cs @@ -70,7 +70,8 @@ internal enum LoggingEventIds QueueDoesNotExist = 57, QueueOptionsPartiallySet = 58, WritingMessageToQueueFailed = 59, - ExperienceSurvey = 60 + ExperienceSurvey = 60, + DiagnosticPortNotInListenModeForCollectionRules = 61 } internal static class LoggingEventIdsExtensions diff --git a/src/Tools/dotnet-monitor/LoggingExtensions.cs b/src/Tools/dotnet-monitor/LoggingExtensions.cs index daf543b8dc2..c5beefe7926 100644 --- a/src/Tools/dotnet-monitor/LoggingExtensions.cs +++ b/src/Tools/dotnet-monitor/LoggingExtensions.cs @@ -333,6 +333,12 @@ internal static class LoggingExtensions logLevel: LogLevel.Information, formatString: Strings.LogFormatString_ExperienceSurvey); + private static readonly Action _diagnosticPortNotInListenModeForCollectionRules = + LoggerMessage.Define( + eventId: LoggingEventIds.DiagnosticPortNotInListenModeForCollectionRules.EventId(), + logLevel: LogLevel.Warning, + formatString: Strings.LogFormatString_DiagnosticPortNotInListenModeForCollectionRules); + public static void EgressProviderInvalidOptions(this ILogger logger, string providerName) { _egressProviderInvalidOptions(logger, providerName, null); @@ -612,5 +618,10 @@ public static void ExperienceSurvey(this ILogger logger) { _experienceSurvey(logger, Monitor.ExperienceSurvey.ExperienceSurveyLink, null); } + + public static void DiagnosticPortNotInListenModeForCollectionRules(this ILogger logger) + { + _diagnosticPortNotInListenModeForCollectionRules(logger, null); + } } } diff --git a/src/Tools/dotnet-monitor/Strings.Designer.cs b/src/Tools/dotnet-monitor/Strings.Designer.cs index b0691b83971..7f706b318f7 100644 --- a/src/Tools/dotnet-monitor/Strings.Designer.cs +++ b/src/Tools/dotnet-monitor/Strings.Designer.cs @@ -753,6 +753,15 @@ internal static string LogFormatString_CollectionRuleUnmatchedFilters { } } + /// + /// Looks up a localized string similar to When using collection rules, the diagnostic port must be in 'Listen' mode. Please correct the configuration and restart dotnet monitor.. + /// + internal static string LogFormatString_DiagnosticPortNotInListenModeForCollectionRules { + get { + return ResourceManager.GetString("LogFormatString_DiagnosticPortNotInListenModeForCollectionRules", resourceCulture); + } + } + /// /// Looks up a localized string similar to Cancelled waiting for diagnostic response from runtime in process {processId}.. /// diff --git a/src/Tools/dotnet-monitor/Strings.resx b/src/Tools/dotnet-monitor/Strings.resx index 2ffa787f8a1..1c2e1cd3456 100644 --- a/src/Tools/dotnet-monitor/Strings.resx +++ b/src/Tools/dotnet-monitor/Strings.resx @@ -468,6 +468,9 @@ Collection rule '{ruleName}' filters do not match the process. + + When using collection rules, the diagnostic port must be in 'Listen' mode. Please correct the configuration and restart dotnet monitor. + Cancelled waiting for diagnostic response from runtime in process {processId}. From 3cdc935f2d7ab7982690e7847cb640430cdcc56d Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 3 May 2022 19:08:09 -0400 Subject: [PATCH 07/71] Do not warn about unconfigured auth when --no-auth is used (#1838) --- .../Auth/MonitorApiKeyConfigurationObserver.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Tools/dotnet-monitor/Auth/MonitorApiKeyConfigurationObserver.cs b/src/Tools/dotnet-monitor/Auth/MonitorApiKeyConfigurationObserver.cs index 6723ee2054b..a06b033cba3 100644 --- a/src/Tools/dotnet-monitor/Auth/MonitorApiKeyConfigurationObserver.cs +++ b/src/Tools/dotnet-monitor/Auth/MonitorApiKeyConfigurationObserver.cs @@ -17,24 +17,29 @@ internal class MonitorApiKeyConfigurationObserver : { private readonly ILogger _logger; private readonly IOptionsMonitor _options; + private readonly IAuthConfiguration _authConfigurationOptions; private IDisposable _changeRegistration; public MonitorApiKeyConfigurationObserver( ILogger logger, - IOptionsMonitor options - ) + IOptionsMonitor options, + IAuthConfiguration authConfigurationOptions) { _logger = logger; _options = options; + _authConfigurationOptions = authConfigurationOptions; } public void Initialize() { - _changeRegistration = _options.OnChange(OnMonitorApiKeyOptionsChanged); + if (_authConfigurationOptions.KeyAuthenticationMode != KeyAuthenticationMode.NoAuth) + { + _changeRegistration = _options.OnChange(OnMonitorApiKeyOptionsChanged); - // Write out current validation state of options when starting the tool. - CheckMonitorApiKeyOptions(_options.CurrentValue); + // Write out current validation state of options when starting the tool. + CheckMonitorApiKeyOptions(_options.CurrentValue); + } } public void Dispose() From 539640682eeec90e6ccb5aa49aff0114e852ee64 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 4 May 2022 12:47:56 +0000 Subject: [PATCH 08/71] Update dependencies from https://github.com/dotnet/diagnostics build 20220503.1 (#1846) [main] Update dependencies from dotnet/diagnostics --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0fa825fff21..bfe629f937a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,13 +4,13 @@ https://github.com/dotnet/command-line-api 166610c56ff732093f0145a2911d4f6c40b786da - + https://github.com/dotnet/diagnostics - 0f48d0f01591b39ab2aaa2c7c36d69d7a87d5a01 + b9d03de0774a2f6b3e92657d90caca7c57f53164 - + https://github.com/dotnet/diagnostics - 0f48d0f01591b39ab2aaa2c7c36d69d7a87d5a01 + b9d03de0774a2f6b3e92657d90caca7c57f53164 diff --git a/eng/Versions.props b/eng/Versions.props index 11e5e9b5706..a8b93b7c41a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -48,8 +48,8 @@ 7.0.0-preview.5.22252.7 7.0.0-preview.5.22252.7 - 5.0.0-preview.22252.1 - 5.0.0-preview.22252.1 + 5.0.0-preview.22253.1 + 5.0.0-preview.22253.1 7.0.0-preview.5.22226.6 7.0.0-preview.5.22226.6 From 92a5ce13142534cf1ef744c2da8893b770938d04 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 4 May 2022 13:20:28 +0000 Subject: [PATCH 09/71] Update dependencies from https://github.com/dotnet/aspnetcore build 20220503.2 (#1848) [main] Update dependencies from dotnet/aspnetcore - Coherency Updates: - Microsoft.NETCore.App.Runtime.win-x64: from 7.0.0-preview.5.22226.6 to 7.0.0-preview.5.22252.7 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - VS.Redist.Common.NetCore.SharedFramework.x64.7.0: from 7.0.0-preview.5.22226.6 to 7.0.0-preview.5.22252.7 (parent: VS.Redist.Common.AspNetCore.SharedFramework.x64.7.0) --- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index bfe629f937a..301d9aca73f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,9 +14,9 @@ - + https://github.com/dotnet/aspnetcore - 8ba6e945c6023543a150b482e5d8387e4f6804a6 + 441ba76966f52fca5a895dbf06cda8fa137fa194 https://github.com/dotnet/arcade @@ -30,17 +30,17 @@ https://github.com/dotnet/symstore 571c835ff07914a240d290367fb11b179ddbd7ea - + https://github.com/dotnet/runtime - c10154087e734fa58f08f2797e5d99404e9cd96b + 6d0bcc4cc7cf98e661c91d4f2abace2c5bd282a5 - + https://github.com/dotnet/aspnetcore - 8ba6e945c6023543a150b482e5d8387e4f6804a6 + 441ba76966f52fca5a895dbf06cda8fa137fa194 - + https://github.com/dotnet/runtime - c10154087e734fa58f08f2797e5d99404e9cd96b + 6d0bcc4cc7cf98e661c91d4f2abace2c5bd282a5 diff --git a/eng/Versions.props b/eng/Versions.props index a8b93b7c41a..798f87aa1eb 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -45,14 +45,14 @@ 7.0.0-beta.22225.6 - 7.0.0-preview.5.22252.7 - 7.0.0-preview.5.22252.7 + 7.0.0-preview.5.22253.2 + 7.0.0-preview.5.22253.2 5.0.0-preview.22253.1 5.0.0-preview.22253.1 - 7.0.0-preview.5.22226.6 - 7.0.0-preview.5.22226.6 + 7.0.0-preview.5.22252.7 + 7.0.0-preview.5.22252.7 1.0.325201 From 59e77bc7e55850025090c6c040bcbeba59e2423b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 5 May 2022 12:54:50 +0000 Subject: [PATCH 10/71] Update dependencies from https://github.com/dotnet/arcade build 20220504.2 (#1855) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 301d9aca73f..a363236f6fa 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -18,13 +18,13 @@ https://github.com/dotnet/aspnetcore 441ba76966f52fca5a895dbf06cda8fa137fa194 - + https://github.com/dotnet/arcade - 5145e86df0c491e082b589aa31d69eea300adc02 + 9c9de91045b8691364e40426177da2e5c535d3ab - + https://github.com/dotnet/arcade - 5145e86df0c491e082b589aa31d69eea300adc02 + 9c9de91045b8691364e40426177da2e5c535d3ab https://github.com/dotnet/symstore diff --git a/eng/Versions.props b/eng/Versions.props index 798f87aa1eb..c2c73680571 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -43,7 +43,7 @@ --> - 7.0.0-beta.22225.6 + 7.0.0-beta.22254.2 7.0.0-preview.5.22253.2 7.0.0-preview.5.22253.2 diff --git a/global.json b/global.json index e53c1a14af5..999cd6c9c74 100644 --- a/global.json +++ b/global.json @@ -18,6 +18,6 @@ }, "msbuild-sdks": { "Microsoft.Build.NoTargets": "2.0.1", - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22225.6" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22254.2" } } From 52a7d530db0d85960b447a87bf1e6edb8847843a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 5 May 2022 12:56:20 +0000 Subject: [PATCH 11/71] Update dependencies from https://github.com/dotnet/diagnostics build 20220504.1 (#1854) [main] Update dependencies from dotnet/diagnostics --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a363236f6fa..c0d3593b616 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,13 +4,13 @@ https://github.com/dotnet/command-line-api 166610c56ff732093f0145a2911d4f6c40b786da - + https://github.com/dotnet/diagnostics - b9d03de0774a2f6b3e92657d90caca7c57f53164 + eeb8da1d0b398552b248607d6948f8dccded8538 - + https://github.com/dotnet/diagnostics - b9d03de0774a2f6b3e92657d90caca7c57f53164 + eeb8da1d0b398552b248607d6948f8dccded8538 diff --git a/eng/Versions.props b/eng/Versions.props index c2c73680571..9013595850c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -48,8 +48,8 @@ 7.0.0-preview.5.22253.2 7.0.0-preview.5.22253.2 - 5.0.0-preview.22253.1 - 5.0.0-preview.22253.1 + 5.0.0-preview.22254.1 + 5.0.0-preview.22254.1 7.0.0-preview.5.22252.7 7.0.0-preview.5.22252.7 From bfd84f88d5361e09d4de6406c0a4d5ce073b7fc9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 5 May 2022 13:36:44 +0000 Subject: [PATCH 12/71] Update dependencies from https://github.com/dotnet/aspnetcore build 20220504.27 (#1856) [main] Update dependencies from dotnet/aspnetcore - Coherency Updates: - Microsoft.NETCore.App.Runtime.win-x64: from 7.0.0-preview.5.22252.7 to 7.0.0-preview.5.22254.1 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - VS.Redist.Common.NetCore.SharedFramework.x64.7.0: from 7.0.0-preview.5.22252.7 to 7.0.0-preview.5.22254.1 (parent: VS.Redist.Common.AspNetCore.SharedFramework.x64.7.0) --- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c0d3593b616..45bd40dca50 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,9 +14,9 @@ - + https://github.com/dotnet/aspnetcore - 441ba76966f52fca5a895dbf06cda8fa137fa194 + d5f487900782d7d66fb106578577467ef9666e21 https://github.com/dotnet/arcade @@ -30,17 +30,17 @@ https://github.com/dotnet/symstore 571c835ff07914a240d290367fb11b179ddbd7ea - + https://github.com/dotnet/runtime - 6d0bcc4cc7cf98e661c91d4f2abace2c5bd282a5 + 39a7960c632b4c11bbb09f0430b3b3c2dcc03085 - + https://github.com/dotnet/aspnetcore - 441ba76966f52fca5a895dbf06cda8fa137fa194 + d5f487900782d7d66fb106578577467ef9666e21 - + https://github.com/dotnet/runtime - 6d0bcc4cc7cf98e661c91d4f2abace2c5bd282a5 + 39a7960c632b4c11bbb09f0430b3b3c2dcc03085 diff --git a/eng/Versions.props b/eng/Versions.props index 9013595850c..3bcfa58afaa 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -45,14 +45,14 @@ 7.0.0-beta.22254.2 - 7.0.0-preview.5.22253.2 - 7.0.0-preview.5.22253.2 + 7.0.0-preview.5.22254.27 + 7.0.0-preview.5.22254.27 5.0.0-preview.22254.1 5.0.0-preview.22254.1 - 7.0.0-preview.5.22252.7 - 7.0.0-preview.5.22252.7 + 7.0.0-preview.5.22254.1 + 7.0.0-preview.5.22254.1 1.0.325201 From c727322e6f080ea5d72357860ac681f4e7c54c84 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 6 May 2022 12:49:19 +0000 Subject: [PATCH 13/71] Update dependencies from https://github.com/dotnet/diagnostics build 20220505.1 (#1861) [main] Update dependencies from dotnet/diagnostics --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 45bd40dca50..4a24e249f9e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,13 +4,13 @@ https://github.com/dotnet/command-line-api 166610c56ff732093f0145a2911d4f6c40b786da - + https://github.com/dotnet/diagnostics - eeb8da1d0b398552b248607d6948f8dccded8538 + da34f02872745e00a19cf8f4578d0a1511497a55 - + https://github.com/dotnet/diagnostics - eeb8da1d0b398552b248607d6948f8dccded8538 + da34f02872745e00a19cf8f4578d0a1511497a55 diff --git a/eng/Versions.props b/eng/Versions.props index 3bcfa58afaa..bd68723ac82 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -48,8 +48,8 @@ 7.0.0-preview.5.22254.27 7.0.0-preview.5.22254.27 - 5.0.0-preview.22254.1 - 5.0.0-preview.22254.1 + 5.0.0-preview.22255.1 + 5.0.0-preview.22255.1 7.0.0-preview.5.22254.1 7.0.0-preview.5.22254.1 From 89f9ed8f565c84a294662d1b5fb648efef1c0df5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 6 May 2022 13:31:00 +0000 Subject: [PATCH 14/71] Update dependencies from https://github.com/dotnet/aspnetcore build 20220505.32 (#1862) [main] Update dependencies from dotnet/aspnetcore - Coherency Updates: - Microsoft.NETCore.App.Runtime.win-x64: from 7.0.0-preview.5.22254.1 to 7.0.0-preview.5.22254.12 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - VS.Redist.Common.NetCore.SharedFramework.x64.7.0: from 7.0.0-preview.5.22254.1 to 7.0.0-preview.5.22254.12 (parent: VS.Redist.Common.AspNetCore.SharedFramework.x64.7.0) --- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4a24e249f9e..65501b88b7b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,9 +14,9 @@ - + https://github.com/dotnet/aspnetcore - d5f487900782d7d66fb106578577467ef9666e21 + f126780310bc28eee72aa9f9d362a4cb371b1bf2 https://github.com/dotnet/arcade @@ -30,17 +30,17 @@ https://github.com/dotnet/symstore 571c835ff07914a240d290367fb11b179ddbd7ea - + https://github.com/dotnet/runtime - 39a7960c632b4c11bbb09f0430b3b3c2dcc03085 + 874c6a937565eb286a60800aaeb0679dfaa8b01a - + https://github.com/dotnet/aspnetcore - d5f487900782d7d66fb106578577467ef9666e21 + f126780310bc28eee72aa9f9d362a4cb371b1bf2 - + https://github.com/dotnet/runtime - 39a7960c632b4c11bbb09f0430b3b3c2dcc03085 + 874c6a937565eb286a60800aaeb0679dfaa8b01a diff --git a/eng/Versions.props b/eng/Versions.props index bd68723ac82..5656fb9e5e5 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -45,14 +45,14 @@ 7.0.0-beta.22254.2 - 7.0.0-preview.5.22254.27 - 7.0.0-preview.5.22254.27 + 7.0.0-preview.5.22255.32 + 7.0.0-preview.5.22255.32 5.0.0-preview.22255.1 5.0.0-preview.22255.1 - 7.0.0-preview.5.22254.1 - 7.0.0-preview.5.22254.1 + 7.0.0-preview.5.22254.12 + 7.0.0-preview.5.22254.12 1.0.325201 From 742da53e330e673679a0eb2204d35e2fce38a24d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 7 May 2022 12:51:31 +0000 Subject: [PATCH 15/71] Update dependencies from https://github.com/dotnet/diagnostics build 20220506.1 (#1863) [main] Update dependencies from dotnet/diagnostics --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 65501b88b7b..e186678fb8a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,13 +4,13 @@ https://github.com/dotnet/command-line-api 166610c56ff732093f0145a2911d4f6c40b786da - + https://github.com/dotnet/diagnostics - da34f02872745e00a19cf8f4578d0a1511497a55 + 519a60ce4af4db33cb965718f9a5290559a6da6d - + https://github.com/dotnet/diagnostics - da34f02872745e00a19cf8f4578d0a1511497a55 + 519a60ce4af4db33cb965718f9a5290559a6da6d diff --git a/eng/Versions.props b/eng/Versions.props index 5656fb9e5e5..60d2853a304 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -48,8 +48,8 @@ 7.0.0-preview.5.22255.32 7.0.0-preview.5.22255.32 - 5.0.0-preview.22255.1 - 5.0.0-preview.22255.1 + 5.0.0-preview.22256.1 + 5.0.0-preview.22256.1 7.0.0-preview.5.22254.12 7.0.0-preview.5.22254.12 From 306b329c1ffd26a62f2fab2d71097ee75c8ef6f7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 7 May 2022 13:31:07 +0000 Subject: [PATCH 16/71] Update dependencies from https://github.com/dotnet/aspnetcore build 20220506.14 (#1865) [main] Update dependencies from dotnet/aspnetcore - Coherency Updates: - Microsoft.NETCore.App.Runtime.win-x64: from 7.0.0-preview.5.22254.12 to 7.0.0-preview.5.22255.15 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - VS.Redist.Common.NetCore.SharedFramework.x64.7.0: from 7.0.0-preview.5.22254.12 to 7.0.0-preview.5.22255.15 (parent: VS.Redist.Common.AspNetCore.SharedFramework.x64.7.0) --- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e186678fb8a..93adc80cf58 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,9 +14,9 @@ - + https://github.com/dotnet/aspnetcore - f126780310bc28eee72aa9f9d362a4cb371b1bf2 + 9e333292515610a718c7a05529c9a3835eec2012 https://github.com/dotnet/arcade @@ -30,17 +30,17 @@ https://github.com/dotnet/symstore 571c835ff07914a240d290367fb11b179ddbd7ea - + https://github.com/dotnet/runtime - 874c6a937565eb286a60800aaeb0679dfaa8b01a + dd74d3e529bad0da272a473eee48eb127accc15b - + https://github.com/dotnet/aspnetcore - f126780310bc28eee72aa9f9d362a4cb371b1bf2 + 9e333292515610a718c7a05529c9a3835eec2012 - + https://github.com/dotnet/runtime - 874c6a937565eb286a60800aaeb0679dfaa8b01a + dd74d3e529bad0da272a473eee48eb127accc15b diff --git a/eng/Versions.props b/eng/Versions.props index 60d2853a304..be7aea08d5b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -45,14 +45,14 @@ 7.0.0-beta.22254.2 - 7.0.0-preview.5.22255.32 - 7.0.0-preview.5.22255.32 + 7.0.0-preview.5.22256.14 + 7.0.0-preview.5.22256.14 5.0.0-preview.22256.1 5.0.0-preview.22256.1 - 7.0.0-preview.5.22254.12 - 7.0.0-preview.5.22254.12 + 7.0.0-preview.5.22255.15 + 7.0.0-preview.5.22255.15 1.0.325201 From bc0b0f8649e6ee813dbd5e823c74740a42e4d4db Mon Sep 17 00:00:00 2001 From: Justin Anderson Date: Sun, 8 May 2022 10:27:21 -0700 Subject: [PATCH 17/71] Fix shipping metadata for blob files (#1858) --- eng/Publishing.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Publishing.props b/eng/Publishing.props index 39a963cb2e7..d688bf150e8 100644 --- a/eng/Publishing.props +++ b/eng/Publishing.props @@ -74,7 +74,7 @@ - From 61fe4c39107600784349b1c7f44eb6a20f6f2352 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 8 May 2022 18:12:40 +0000 Subject: [PATCH 18/71] Update dependencies from https://github.com/dotnet/arcade build 20220505.2 (#1864) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 93adc80cf58..abc7abf8ac2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -18,13 +18,13 @@ https://github.com/dotnet/aspnetcore 9e333292515610a718c7a05529c9a3835eec2012 - + https://github.com/dotnet/arcade - 9c9de91045b8691364e40426177da2e5c535d3ab + ba1c3aff4be864c493031d989259ef92aaa23fc3 - + https://github.com/dotnet/arcade - 9c9de91045b8691364e40426177da2e5c535d3ab + ba1c3aff4be864c493031d989259ef92aaa23fc3 https://github.com/dotnet/symstore diff --git a/eng/Versions.props b/eng/Versions.props index be7aea08d5b..08b071bb34f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -43,7 +43,7 @@ --> - 7.0.0-beta.22254.2 + 7.0.0-beta.22255.2 7.0.0-preview.5.22256.14 7.0.0-preview.5.22256.14 diff --git a/global.json b/global.json index 999cd6c9c74..d91586ceea0 100644 --- a/global.json +++ b/global.json @@ -18,6 +18,6 @@ }, "msbuild-sdks": { "Microsoft.Build.NoTargets": "2.0.1", - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22254.2" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22255.2" } } From 6c0ec22af4e53e6f51912d82cbcbe67a1f17f2a9 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 9 May 2022 12:53:33 -0400 Subject: [PATCH 19/71] Updating release notes (#1869) --- .../releaseNotes/releaseNotes.v7.0.0-preview.4.22227.4.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 documentation/releaseNotes/releaseNotes.v7.0.0-preview.4.22227.4.md diff --git a/documentation/releaseNotes/releaseNotes.v7.0.0-preview.4.22227.4.md b/documentation/releaseNotes/releaseNotes.v7.0.0-preview.4.22227.4.md new file mode 100644 index 00000000000..ccbdf508cbc --- /dev/null +++ b/documentation/releaseNotes/releaseNotes.v7.0.0-preview.4.22227.4.md @@ -0,0 +1,3 @@ +Today we are releasing the next official preview of the `dotnet monitor` tool. This release includes: + +- Added Collection Rule Defaults (#1595) From edb7c375d1e7e11e4ef1a3bcaf15ed39ccae57e8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 10 May 2022 13:12:23 +0000 Subject: [PATCH 20/71] Update dependencies from https://github.com/dotnet/diagnostics build 20220509.1 (#1872) [main] Update dependencies from dotnet/diagnostics --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index abc7abf8ac2..c97875f60f8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,13 +4,13 @@ https://github.com/dotnet/command-line-api 166610c56ff732093f0145a2911d4f6c40b786da - + https://github.com/dotnet/diagnostics - 519a60ce4af4db33cb965718f9a5290559a6da6d + cec3bd540fa724f9f0b0527606709853975510e7 - + https://github.com/dotnet/diagnostics - 519a60ce4af4db33cb965718f9a5290559a6da6d + cec3bd540fa724f9f0b0527606709853975510e7 diff --git a/eng/Versions.props b/eng/Versions.props index 08b071bb34f..a6d22ba14c5 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -48,8 +48,8 @@ 7.0.0-preview.5.22256.14 7.0.0-preview.5.22256.14 - 5.0.0-preview.22256.1 - 5.0.0-preview.22256.1 + 5.0.0-preview.22259.1 + 5.0.0-preview.22259.1 7.0.0-preview.5.22255.15 7.0.0-preview.5.22255.15 From 4893299e6b5047377c57418d13b614870242b6ac Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 10 May 2022 14:01:00 +0000 Subject: [PATCH 21/71] Update dependencies from https://github.com/dotnet/symstore build 20220509.1 (#1874) [main] Update dependencies from dotnet/symstore --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c97875f60f8..668a12e91b5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -26,9 +26,9 @@ https://github.com/dotnet/arcade ba1c3aff4be864c493031d989259ef92aaa23fc3 - + https://github.com/dotnet/symstore - 571c835ff07914a240d290367fb11b179ddbd7ea + d13eb2d07a26a80c83667cbe1e0625bb37704bff https://github.com/dotnet/runtime diff --git a/eng/Versions.props b/eng/Versions.props index a6d22ba14c5..9cf7cbb5b68 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -54,7 +54,7 @@ 7.0.0-preview.5.22255.15 7.0.0-preview.5.22255.15 - 1.0.325201 + 1.0.325901 3.1.22 From 3fee4639f6e17d18ee78f26ac7a2924a744fbe48 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 10 May 2022 14:18:43 +0000 Subject: [PATCH 22/71] Update dependencies from https://github.com/dotnet/aspnetcore build 20220509.9 (#1875) [main] Update dependencies from dotnet/aspnetcore --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 668a12e91b5..9982f0cd29e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,9 +14,9 @@ - + https://github.com/dotnet/aspnetcore - 9e333292515610a718c7a05529c9a3835eec2012 + 52c11c30efe97e271530e92cfbe951ee73862c01 https://github.com/dotnet/arcade @@ -34,9 +34,9 @@ https://github.com/dotnet/runtime dd74d3e529bad0da272a473eee48eb127accc15b - + https://github.com/dotnet/aspnetcore - 9e333292515610a718c7a05529c9a3835eec2012 + 52c11c30efe97e271530e92cfbe951ee73862c01 https://github.com/dotnet/runtime diff --git a/eng/Versions.props b/eng/Versions.props index 9cf7cbb5b68..eb224e35cc6 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -45,8 +45,8 @@ 7.0.0-beta.22255.2 - 7.0.0-preview.5.22256.14 - 7.0.0-preview.5.22256.14 + 7.0.0-preview.5.22259.9 + 7.0.0-preview.5.22259.9 5.0.0-preview.22259.1 5.0.0-preview.22259.1 From 5e33009b5f4dacaee6ecf0c72352fa8db83d35c9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 10 May 2022 16:43:52 +0000 Subject: [PATCH 23/71] Update dependencies from https://github.com/dotnet/arcade build 20220509.5 (#1873) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9982f0cd29e..ab6b536873f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -18,13 +18,13 @@ https://github.com/dotnet/aspnetcore 52c11c30efe97e271530e92cfbe951ee73862c01 - + https://github.com/dotnet/arcade - ba1c3aff4be864c493031d989259ef92aaa23fc3 + 6e533ee7a479018586f2314295ad113f6ba1d5b1 - + https://github.com/dotnet/arcade - ba1c3aff4be864c493031d989259ef92aaa23fc3 + 6e533ee7a479018586f2314295ad113f6ba1d5b1 https://github.com/dotnet/symstore diff --git a/eng/Versions.props b/eng/Versions.props index eb224e35cc6..3793b6c6650 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -43,7 +43,7 @@ --> - 7.0.0-beta.22255.2 + 7.0.0-beta.22259.5 7.0.0-preview.5.22259.9 7.0.0-preview.5.22259.9 diff --git a/global.json b/global.json index d91586ceea0..5e71c7df415 100644 --- a/global.json +++ b/global.json @@ -18,6 +18,6 @@ }, "msbuild-sdks": { "Microsoft.Build.NoTargets": "2.0.1", - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22255.2" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22259.5" } } From ac602f6c2d489bff0245cf1b21cb3d3f244fda8c Mon Sep 17 00:00:00 2001 From: Justin Anderson Date: Tue, 10 May 2022 14:43:57 -0700 Subject: [PATCH 24/71] Use latest public SDK and runtimes (#1876) --- eng/Versions.props | 8 ++++---- global.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 3793b6c6650..7a48406a72e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -57,12 +57,12 @@ 1.0.325901 - 3.1.22 + 3.1.25 $(MicrosoftNETCoreApp31Version) - 5.0.13 + 5.0.17 $(MicrosoftNETCoreApp50Version) - 6.0.1 - 6.0.1 + 6.0.5 + 6.0.5 $(MicrosoftNETCoreAppRuntimewinx64Version) $(MicrosoftAspNetCoreAppRuntimewinx64Version) diff --git a/global.json b/global.json index 5e71c7df415..349208bdf2e 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "tools": { - "dotnet": "7.0.100-preview.3.22179.4", + "dotnet": "7.0.100-preview.4.22252.9", "runtimes": { "aspnetcore": [ "$(MicrosoftAspNetCoreApp31Version)", From 10cb8a0b2331bbf97bac5df50d86253f1660c240 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 11 May 2022 13:38:53 +0000 Subject: [PATCH 25/71] Update dependencies from https://github.com/dotnet/aspnetcore build 20220510.11 (#1882) [main] Update dependencies from dotnet/aspnetcore - Coherency Updates: - Microsoft.NETCore.App.Runtime.win-x64: from 7.0.0-preview.5.22255.15 to 7.0.0-preview.5.22259.7 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - VS.Redist.Common.NetCore.SharedFramework.x64.7.0: from 7.0.0-preview.5.22255.15 to 7.0.0-preview.5.22259.7 (parent: VS.Redist.Common.AspNetCore.SharedFramework.x64.7.0) --- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ab6b536873f..d12de867cd2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,9 +14,9 @@ - + https://github.com/dotnet/aspnetcore - 52c11c30efe97e271530e92cfbe951ee73862c01 + 8f8be8eb4d87e22e5e622832a69da3cb527a8210 https://github.com/dotnet/arcade @@ -30,17 +30,17 @@ https://github.com/dotnet/symstore d13eb2d07a26a80c83667cbe1e0625bb37704bff - + https://github.com/dotnet/runtime - dd74d3e529bad0da272a473eee48eb127accc15b + 21f1a2bb132b86d93de964d46dcc33401c875448 - + https://github.com/dotnet/aspnetcore - 52c11c30efe97e271530e92cfbe951ee73862c01 + 8f8be8eb4d87e22e5e622832a69da3cb527a8210 - + https://github.com/dotnet/runtime - dd74d3e529bad0da272a473eee48eb127accc15b + 21f1a2bb132b86d93de964d46dcc33401c875448 diff --git a/eng/Versions.props b/eng/Versions.props index 7a48406a72e..9ac7b6f4034 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -45,14 +45,14 @@ 7.0.0-beta.22259.5 - 7.0.0-preview.5.22259.9 - 7.0.0-preview.5.22259.9 + 7.0.0-preview.5.22260.11 + 7.0.0-preview.5.22260.11 5.0.0-preview.22259.1 5.0.0-preview.22259.1 - 7.0.0-preview.5.22255.15 - 7.0.0-preview.5.22255.15 + 7.0.0-preview.5.22259.7 + 7.0.0-preview.5.22259.7 1.0.325901 From bc9e3069855559dca5f76c657ba979b838987363 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 11 May 2022 16:09:40 +0000 Subject: [PATCH 26/71] Update dependencies from https://github.com/dotnet/diagnostics build 20220510.1 (#1880) [main] Update dependencies from dotnet/diagnostics --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d12de867cd2..23f44104701 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,13 +4,13 @@ https://github.com/dotnet/command-line-api 166610c56ff732093f0145a2911d4f6c40b786da - + https://github.com/dotnet/diagnostics - cec3bd540fa724f9f0b0527606709853975510e7 + fad5a01035ca199574dcad2e43d657336c93077e - + https://github.com/dotnet/diagnostics - cec3bd540fa724f9f0b0527606709853975510e7 + fad5a01035ca199574dcad2e43d657336c93077e diff --git a/eng/Versions.props b/eng/Versions.props index 9ac7b6f4034..fcc05b9a89c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -48,8 +48,8 @@ 7.0.0-preview.5.22260.11 7.0.0-preview.5.22260.11 - 5.0.0-preview.22259.1 - 5.0.0-preview.22259.1 + 5.0.0-preview.22260.1 + 5.0.0-preview.22260.1 7.0.0-preview.5.22259.7 7.0.0-preview.5.22259.7 From da7a52f0404e7700c8ce052c90fe1d9546a53abd Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 11 May 2022 16:18:23 +0000 Subject: [PATCH 27/71] Update dependencies from https://github.com/dotnet/arcade build 20220510.2 (#1881) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- eng/common/internal/Tools.csproj | 3 +++ global.json | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 23f44104701..8d0b4323c86 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -18,13 +18,13 @@ https://github.com/dotnet/aspnetcore 8f8be8eb4d87e22e5e622832a69da3cb527a8210 - + https://github.com/dotnet/arcade - 6e533ee7a479018586f2314295ad113f6ba1d5b1 + 6baad99219dda29b3c8efd7d627393cda4b38372 - + https://github.com/dotnet/arcade - 6e533ee7a479018586f2314295ad113f6ba1d5b1 + 6baad99219dda29b3c8efd7d627393cda4b38372 https://github.com/dotnet/symstore diff --git a/eng/Versions.props b/eng/Versions.props index fcc05b9a89c..e0d4915101c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -43,7 +43,7 @@ --> - 7.0.0-beta.22259.5 + 7.0.0-beta.22260.2 7.0.0-preview.5.22260.11 7.0.0-preview.5.22260.11 diff --git a/eng/common/internal/Tools.csproj b/eng/common/internal/Tools.csproj index beb9c4648ea..7f5ce6d6081 100644 --- a/eng/common/internal/Tools.csproj +++ b/eng/common/internal/Tools.csproj @@ -8,6 +8,9 @@ + + + diff --git a/global.json b/global.json index 349208bdf2e..62f74e16323 100644 --- a/global.json +++ b/global.json @@ -18,6 +18,6 @@ }, "msbuild-sdks": { "Microsoft.Build.NoTargets": "2.0.1", - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22259.5" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22260.2" } } From e934118d85afa89f373c74008dccc4c3bfa15b8a Mon Sep 17 00:00:00 2001 From: Justin Anderson Date: Wed, 11 May 2022 13:54:00 -0700 Subject: [PATCH 28/71] Consolidate dumps folder into diag folder in k8s sample (#1883) Rename diagnostic port socket to have .sock extension --- documentation/kubernetes.md | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/documentation/kubernetes.md b/documentation/kubernetes.md index 3ddfde0b437..e56d829b7ad 100644 --- a/documentation/kubernetes.md +++ b/documentation/kubernetes.md @@ -33,12 +33,10 @@ spec: - name: ASPNETCORE_URLS value: http://+:80 - name: DOTNET_DiagnosticPorts - value: /diag/port + value: /diag/port.sock volumeMounts: - mountPath: /diag name: diagvol - - mountPath: /dumps - name: dumpsvol resources: limits: cpu: 250m @@ -50,12 +48,10 @@ spec: - name: ASPNETCORE_URLS value: http://+:81 - name: DOTNET_DiagnosticPorts - value: /diag/port + value: /diag/port.sock volumeMounts: - mountPath: /diag name: diagvol - - mountPath: /dumps - name: dumpsvol resources: limits: cpu: 250m @@ -70,9 +66,9 @@ spec: - name: DOTNETMONITOR_DiagnosticPort__ConnectionMode value: Listen - name: DOTNETMONITOR_DiagnosticPort__EndpointName - value: /diag/port + value: /diag/port.sock - name: DOTNETMONITOR_Storage__DumpTempFolder - value: /dumps + value: /diag/dumps # ALWAYS use the HTTPS form of the URL for deployments in production; the removal of HTTPS is done for # demonstration purposes only in this example. Please continue reading after this example for further details. - name: DOTNETMONITOR_Urls @@ -80,8 +76,6 @@ spec: volumeMounts: - mountPath: /diag name: diagvol - - mountPath: /dumps - name: dumpsvol resources: requests: cpu: 50m @@ -92,8 +86,6 @@ spec: volumes: - name: diagvol emptyDir: {} - - name: dumpsvol - emptyDir: {} ``` ## Example Details From 544a67148ff8c3a3c4efd01f1f96a9543ab8782e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 12 May 2022 17:25:09 +0000 Subject: [PATCH 29/71] Update dependencies from https://github.com/dotnet/aspnetcore build 20220511.15 (#1888) [main] Update dependencies from dotnet/aspnetcore - Coherency Updates: - Microsoft.NETCore.App.Runtime.win-x64: from 7.0.0-preview.5.22259.7 to 7.0.0-preview.5.22261.1 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - VS.Redist.Common.NetCore.SharedFramework.x64.7.0: from 7.0.0-preview.5.22259.7 to 7.0.0-preview.5.22261.1 (parent: VS.Redist.Common.AspNetCore.SharedFramework.x64.7.0) --- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8d0b4323c86..f173fa9a975 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,9 +14,9 @@ - + https://github.com/dotnet/aspnetcore - 8f8be8eb4d87e22e5e622832a69da3cb527a8210 + db4c946395c6bef2e5d65ebd2d2de7d261bdc136 https://github.com/dotnet/arcade @@ -30,17 +30,17 @@ https://github.com/dotnet/symstore d13eb2d07a26a80c83667cbe1e0625bb37704bff - + https://github.com/dotnet/runtime - 21f1a2bb132b86d93de964d46dcc33401c875448 + 52fd1a576ef6640966046431edff2868e82b9e64 - + https://github.com/dotnet/aspnetcore - 8f8be8eb4d87e22e5e622832a69da3cb527a8210 + db4c946395c6bef2e5d65ebd2d2de7d261bdc136 - + https://github.com/dotnet/runtime - 21f1a2bb132b86d93de964d46dcc33401c875448 + 52fd1a576ef6640966046431edff2868e82b9e64 diff --git a/eng/Versions.props b/eng/Versions.props index e0d4915101c..774c52c6ac1 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -45,14 +45,14 @@ 7.0.0-beta.22260.2 - 7.0.0-preview.5.22260.11 - 7.0.0-preview.5.22260.11 + 7.0.0-preview.5.22261.15 + 7.0.0-preview.5.22261.15 5.0.0-preview.22260.1 5.0.0-preview.22260.1 - 7.0.0-preview.5.22259.7 - 7.0.0-preview.5.22259.7 + 7.0.0-preview.5.22261.1 + 7.0.0-preview.5.22261.1 1.0.325901 From 0991d2753a73bc8903e833f84d2c13291b323c8a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 12 May 2022 17:29:18 +0000 Subject: [PATCH 30/71] Update dependencies from https://github.com/dotnet/diagnostics build 20220511.1 (#1885) [main] Update dependencies from dotnet/diagnostics --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f173fa9a975..0810fd41de9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,13 +4,13 @@ https://github.com/dotnet/command-line-api 166610c56ff732093f0145a2911d4f6c40b786da - + https://github.com/dotnet/diagnostics - fad5a01035ca199574dcad2e43d657336c93077e + f0c0170c7abe1ae83a13e2b4fd7b4f43fd0e8a33 - + https://github.com/dotnet/diagnostics - fad5a01035ca199574dcad2e43d657336c93077e + f0c0170c7abe1ae83a13e2b4fd7b4f43fd0e8a33 diff --git a/eng/Versions.props b/eng/Versions.props index 774c52c6ac1..01c831f714b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -48,8 +48,8 @@ 7.0.0-preview.5.22261.15 7.0.0-preview.5.22261.15 - 5.0.0-preview.22260.1 - 5.0.0-preview.22260.1 + 5.0.0-preview.22261.1 + 5.0.0-preview.22261.1 7.0.0-preview.5.22261.1 7.0.0-preview.5.22261.1 From ef6865e341b7f6e152df48e0206b9a7a8aa920e7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 12 May 2022 19:44:51 +0000 Subject: [PATCH 31/71] Update dependencies from https://github.com/dotnet/arcade build 20220511.14 (#1886) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- eng/common/init-tools-native.ps1 | 11 ++++++----- global.json | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0810fd41de9..82c45c3442c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -18,13 +18,13 @@ https://github.com/dotnet/aspnetcore db4c946395c6bef2e5d65ebd2d2de7d261bdc136 - + https://github.com/dotnet/arcade - 6baad99219dda29b3c8efd7d627393cda4b38372 + 666b83fa183306e9adec817c903ec93da2a4703c - + https://github.com/dotnet/arcade - 6baad99219dda29b3c8efd7d627393cda4b38372 + 666b83fa183306e9adec817c903ec93da2a4703c https://github.com/dotnet/symstore diff --git a/eng/Versions.props b/eng/Versions.props index 01c831f714b..a9cecf26a5d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -43,7 +43,7 @@ --> - 7.0.0-beta.22260.2 + 7.0.0-beta.22261.14 7.0.0-preview.5.22261.15 7.0.0-preview.5.22261.15 diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1 index 413adea4365..24a5e65de1b 100644 --- a/eng/common/init-tools-native.ps1 +++ b/eng/common/init-tools-native.ps1 @@ -93,7 +93,7 @@ try { $ToolVersion = "" } $ArcadeToolsDirectory = "C:\arcade-tools" - if (Test-Path $ArcadeToolsDirectory -eq $False) { + if (-not (Test-Path $ArcadeToolsDirectory)) { Write-Error "Arcade tools directory '$ArcadeToolsDirectory' was not found; artifacts were not properly installed." exit 1 } @@ -103,13 +103,14 @@ try { exit 1 } $BinPathFile = "$($ToolDirectory.FullName)\binpath.txt" - if (Test-Path -Path "$BinPathFile" -eq $False) { + if (-not (Test-Path -Path "$BinPathFile")) { Write-Error "Unable to find binpath.txt in '$($ToolDirectory.FullName)' ($ToolName $ToolVersion); artifact is either installed incorrectly or is not a bootstrappable tool." exit 1 } $BinPath = Get-Content "$BinPathFile" - Write-Host "Adding $ToolName to the path ($(Convert-Path -Path $BinPath))..." - Write-Host "##vso[task.prependpath]$(Convert-Path -Path $BinPath)" + $ToolPath = Convert-Path -Path $BinPath + Write-Host "Adding $ToolName to the path ($ToolPath)..." + Write-Host "##vso[task.prependpath]$ToolPath" } } exit 0 @@ -188,7 +189,7 @@ try { Write-Host "##vso[task.prependpath]$(Convert-Path -Path $InstallBin)" return $InstallBin } - else { + elseif (-not ($PathPromotion)) { Write-PipelineTelemetryError -Category 'NativeToolsBootstrap' -Message 'Native tools install directory does not exist, installation failed' exit 1 } diff --git a/global.json b/global.json index 62f74e16323..543fb8d7945 100644 --- a/global.json +++ b/global.json @@ -18,6 +18,6 @@ }, "msbuild-sdks": { "Microsoft.Build.NoTargets": "2.0.1", - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22260.2" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22261.14" } } From 8bc0a862207fc265a4f4933c68531ae07f9b8f02 Mon Sep 17 00:00:00 2001 From: jooooel Date: Fri, 13 May 2022 05:49:25 +0200 Subject: [PATCH 32/71] Fix broken link for CollectionRules documentation (#1879) --- documentation/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/README.md b/documentation/README.md index 4c1a6a59833..6f93e952262 100644 --- a/documentation/README.md +++ b/documentation/README.md @@ -30,7 +30,7 @@ When running a dotnet application, differences in diverse local and production e - [API Key (Recommended)](./authentication.md#api-key-authentication) - [API Key Setup Guide](./api-key-setup.md) - [Windows](./authentication.md#windows-authentication) -- [Collection Rules](./collectionrules.md) +- [Collection Rules](./collectionrules/collectionrules.md) - [Egress Providers](./egress.md) - [Troubleshooting](./troubleshooting.md) - [Clone, build, and test the repo](./building.md) From 90d6ddf2b9e5240d056adca24cb912be98445125 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 13 May 2022 16:00:26 +0000 Subject: [PATCH 33/71] Update dependencies from https://github.com/dotnet/aspnetcore build 20220513.1 (#1892) [main] Update dependencies from dotnet/aspnetcore --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 82c45c3442c..9af79a1a30e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,9 +14,9 @@ - + https://github.com/dotnet/aspnetcore - db4c946395c6bef2e5d65ebd2d2de7d261bdc136 + 1230a1a9fcc2eddecdfed5e88c8d46da21194af6 https://github.com/dotnet/arcade @@ -34,9 +34,9 @@ https://github.com/dotnet/runtime 52fd1a576ef6640966046431edff2868e82b9e64 - + https://github.com/dotnet/aspnetcore - db4c946395c6bef2e5d65ebd2d2de7d261bdc136 + 1230a1a9fcc2eddecdfed5e88c8d46da21194af6 https://github.com/dotnet/runtime diff --git a/eng/Versions.props b/eng/Versions.props index a9cecf26a5d..90273cb34e5 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -45,8 +45,8 @@ 7.0.0-beta.22261.14 - 7.0.0-preview.5.22261.15 - 7.0.0-preview.5.22261.15 + 7.0.0-preview.5.22263.1 + 7.0.0-preview.5.22263.1 5.0.0-preview.22261.1 5.0.0-preview.22261.1 From e4992ad2c8ae24c945528c0c9f4b70e023489c82 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 13 May 2022 13:23:39 -0400 Subject: [PATCH 34/71] Update releases.md (#1893) --- documentation/releases.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/releases.md b/documentation/releases.md index c3a81f885ca..8e592eaae03 100644 --- a/documentation/releases.md +++ b/documentation/releases.md @@ -11,4 +11,4 @@ | Version | Latest Version | Release Date | Runtime Frameworks | |---|---|---|---| -| 7.0 | [7.0.0 Preview 3](https://github.com/dotnet/dotnet-monitor/blob/main/documentation/releaseNotes/releaseNotes.v7.0.0-preview.3.22204.3.md) | April 12, 2022 | .NET 6 (with major roll forward)
.NET 7 | +| 7.0 | [7.0.0 Preview 4](https://github.com/dotnet/dotnet-monitor/blob/main/documentation/releaseNotes/releaseNotes.v7.0.0-preview.4.22227.4.md) | May 10, 2022 | .NET 6 (with major roll forward)
.NET 7 | From e40a006d9ef656c846611504f07ea52dce701d53 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 13 May 2022 15:02:32 -0400 Subject: [PATCH 35/71] Update release-process.md (#1894) --- documentation/release-process.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/documentation/release-process.md b/documentation/release-process.md index a950e8e9c6b..40193b5092c 100644 --- a/documentation/release-process.md +++ b/documentation/release-process.md @@ -2,12 +2,12 @@ ## Merge to Release Branch -1. Merge from the `main` branch to the appropriate release branch (e.g. `release/5.0`). +1. Merge from the `main` branch to the appropriate release branch (e.g. `release/5.0`). Note that for patch releases, fixes should be made directly to the appropriate release branch and we do not merge from the `main` branch. 1. In `/eng/Versions.props`, update `dotnet/diagnostics` dependencies to versions from the corresponding release of the `dotnet/diagnostics` repo. 1. In `/eng/Version.props`, ensure that `` is set appropriately. See the documentation next to this setting for the appropriate values. In release branches, its value should be `release`. This setting, in combination with the version settings, determine for which 'channel' the aks.ms links are created. 1. Complete at least one successful [release build](#build-release-branch). 1. [Update dotnet-docker pipeline variables](#update-pipeline-variable-for-release) to pick up builds from the release branch. -1. Bump the version number in the `main` branch. [Example Pull Request](https://github.com/dotnet/dotnet-monitor/pull/1560). +1. Bump the version number in the `main` branch and reset release notes. [Example Pull Request](https://github.com/dotnet/dotnet-monitor/pull/1560). ## Additional steps when creating a new release branch @@ -77,17 +77,17 @@ The nightly image is `mcr.microsoft.com/dotnet/nightly/monitor`. The tag list is 1. Grab the file [/documentation/releaseNotes/releaseNotes.md](https://github.com/dotnet/dotnet-monitor/blob/release/6.0/documentation/releaseNotes/releaseNotes.md) from the release branch and check this file into [main](https://github.com/dotnet/dotnet-monitor/tree/main) as [/documentation/releaseNotes/releaseNotes.v{NugetVersionNumber}.md](https://github.com/dotnet/dotnet-monitor/blob/main/documentation/releaseNotes/releaseNotes.v6.0.0-preview.8.21503.3.md). >**Note:** this file comes from the **release** branch and is checked into the **main** branch. -2. Start [release pipeline](https://dev.azure.com/dnceng/internal/_release?_a=releases&view=mine&definitionId=105). During creation of the release you must select the dotnet-monitor build to release from the list of available builds. This must be a build with the tag `MonitorRelease` and the associated `MonitorRelease` artifact. -3. The release will start the stage "Pre-Release Verification" this will check that the above steps were done as expected. +2. Start [release pipeline](https://dev.azure.com/dnceng/internal/_release?_a=releases&view=mine&definitionId=105). Allow the stages to trigger automatically (do not check the boxes in the associated dropdown). During creation of the release you must select the dotnet-monitor build to release from the list of available builds. This must be a build with the tag `MonitorRelease` and the associated `MonitorRelease` artifact (set `dotnet-monitor_build` to the pipeline run of `dotnet monitor` that is being released; set `dotnet-monitor_source` to the latest commit from `main`). +3. The release will start the stage "Pre-Release Verification"; this will check that the above steps were done as expected. The name of the release will be updated automatically. 4. Approve the sign-off step the day before the release after 8:45 AM PDT, when ready to publish. ->**Note:** After sign-off of the "Pre-Release Verification" environment the NuGet and GitHub release steps will automatically wait 8:45 AM PDT the next day to correspond with the typical docker release time of 9:00 AM PDT. +>**Note:** After sign-off of the "Pre-Release Verification" environment the NuGet and GitHub release steps will automatically wait until 8:45 AM PDT the next day to correspond with the typical docker release time of 9:00 AM PDT. The remainder of the release will automatically push NuGet packages to nuget.org, [tag](https://github.com/dotnet/dotnet-monitor/tags) the commit from the build with the release version, and add a new [GitHub release](https://github.com/dotnet/dotnet-monitor/releases). ## Release to Storage Accounts -1. Approximately 3 days before Docker image release, execute a dry-run of the [dotnet-monitor-release](https://dev.azure.com/dnceng/internal/_build?definitionId=1103) pipeline (`IsDryRun` should be checked; uncheck `IsTestRun`; under `Resources`, select the `dotnet monitor` build from which assets will be published). This will validate that the nupkg files can be published to the `dotnetcli` storage account and checksums can be published to the `dotnetclichecksums` storage account. -1. The day before Docker image release, execute run of the [dotnet-monitor-release](https://dev.azure.com/dnceng/internal/_build?definitionId=1103) pipeline (uncheck `IsDryRun`; uncheck `IsTestRun`; under `Resources`, select the `dotnet monitor` build from which assets will be published). This will publish the nupkg files to the `dotnetcli` storage account and the checksums to the `dotnetclichecksums` storage account. +1. Approximately 3 days before Docker image release, execute a dry-run of the [dotnet-monitor-release](https://dev.azure.com/dnceng/internal/_build?definitionId=1103) pipeline (`Branch` should be set to `main`; `IsDryRun` should be checked; uncheck `IsTestRun`; under `Resources`, select the `dotnet monitor` build from which assets will be published). This will validate that the nupkg files can be published to the `dotnetcli` storage account and checksums can be published to the `dotnetclichecksums` storage account. +1. The day before Docker image release, execute run of the [dotnet-monitor-release](https://dev.azure.com/dnceng/internal/_build?definitionId=1103) pipeline (`Branch` should be set to `main`; uncheck `IsDryRun`; uncheck `IsTestRun`; under `Resources`, select the `dotnet monitor` build from which assets will be published). This will publish the nupkg files to the `dotnetcli` storage account and the checksums to the `dotnetclichecksums` storage account. ## Release Docker Images @@ -96,4 +96,10 @@ The remainder of the release will automatically push NuGet packages to nuget.org 1. The `dotnet-docker` team will merge from `nightly` branch to `main` branch and wait for `dotnet-monitor` team approval. Typically, these changes are completed the day before the release date. 1. The `dotnet-docker` team will start the build ahead of the release and wait for the all-clear from `dotnet-monitor` team before publishing the images. -The release image is `mcr.microsoft.com/dotnet/monitor`. The tag list is https://mcr.microsoft.com/v2/dotnet/monitor/tags/list. \ No newline at end of file +The release image is `mcr.microsoft.com/dotnet/monitor`. The tag list is https://mcr.microsoft.com/v2/dotnet/monitor/tags/list. + +## After the Release + +1. Update [releases.md](https://github.com/dotnet/dotnet-monitor/blob/main/documentation/releases.md) with the latest version. +1. When necessary, update [docker.md](https://github.com/dotnet/dotnet-monitor/blob/main/documentation/docker.md). +1. When necessary, update this document if its instructions were unclear or incorrect. From 17dc5ecb7a99278d5b159e9fe7993d7a3cd0d17c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 14 May 2022 12:50:01 +0000 Subject: [PATCH 36/71] Update dependencies from https://github.com/dotnet/diagnostics build 20220513.1 (#1895) [main] Update dependencies from dotnet/diagnostics --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9af79a1a30e..25e422d7b03 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,13 +4,13 @@ https://github.com/dotnet/command-line-api 166610c56ff732093f0145a2911d4f6c40b786da
- + https://github.com/dotnet/diagnostics - f0c0170c7abe1ae83a13e2b4fd7b4f43fd0e8a33 + 6b2b94c7b6e68d2bb231912c88416d0b20d0c817 - + https://github.com/dotnet/diagnostics - f0c0170c7abe1ae83a13e2b4fd7b4f43fd0e8a33 + 6b2b94c7b6e68d2bb231912c88416d0b20d0c817 diff --git a/eng/Versions.props b/eng/Versions.props index 90273cb34e5..62886480fab 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -48,8 +48,8 @@ 7.0.0-preview.5.22263.1 7.0.0-preview.5.22263.1 - 5.0.0-preview.22261.1 - 5.0.0-preview.22261.1 + 5.0.0-preview.22263.1 + 5.0.0-preview.22263.1 7.0.0-preview.5.22261.1 7.0.0-preview.5.22261.1 From 13e525f4bef0bd47d8830c7999a05430fa6ffc7e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 14 May 2022 12:53:45 +0000 Subject: [PATCH 37/71] Update dependencies from https://github.com/dotnet/arcade build 20220512.8 (#1896) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 25e422d7b03..81cc4ac61b7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -18,13 +18,13 @@ https://github.com/dotnet/aspnetcore 1230a1a9fcc2eddecdfed5e88c8d46da21194af6 - + https://github.com/dotnet/arcade - 666b83fa183306e9adec817c903ec93da2a4703c + b7796f653e48e001123963f17387c052891b48e6 - + https://github.com/dotnet/arcade - 666b83fa183306e9adec817c903ec93da2a4703c + b7796f653e48e001123963f17387c052891b48e6 https://github.com/dotnet/symstore diff --git a/eng/Versions.props b/eng/Versions.props index 62886480fab..3570caf290d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -43,7 +43,7 @@ --> - 7.0.0-beta.22261.14 + 7.0.0-beta.22262.8 7.0.0-preview.5.22263.1 7.0.0-preview.5.22263.1 diff --git a/global.json b/global.json index 543fb8d7945..4a909d8248c 100644 --- a/global.json +++ b/global.json @@ -18,6 +18,6 @@ }, "msbuild-sdks": { "Microsoft.Build.NoTargets": "2.0.1", - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22261.14" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22262.8" } } From 0d1cc0bff38b145ba987bb0f61bcf12bc677215a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 14 May 2022 13:21:44 +0000 Subject: [PATCH 38/71] Update dependencies from https://github.com/dotnet/aspnetcore build 20220513.14 (#1897) [main] Update dependencies from dotnet/aspnetcore --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 81cc4ac61b7..097825aacc7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,9 +14,9 @@ - + https://github.com/dotnet/aspnetcore - 1230a1a9fcc2eddecdfed5e88c8d46da21194af6 + 3888fda44771dd6d45f305a831b2f37427303ae4 https://github.com/dotnet/arcade @@ -34,9 +34,9 @@ https://github.com/dotnet/runtime 52fd1a576ef6640966046431edff2868e82b9e64 - + https://github.com/dotnet/aspnetcore - 1230a1a9fcc2eddecdfed5e88c8d46da21194af6 + 3888fda44771dd6d45f305a831b2f37427303ae4 https://github.com/dotnet/runtime diff --git a/eng/Versions.props b/eng/Versions.props index 3570caf290d..ed4c653949e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -45,8 +45,8 @@ 7.0.0-beta.22262.8 - 7.0.0-preview.5.22263.1 - 7.0.0-preview.5.22263.1 + 7.0.0-preview.5.22263.14 + 7.0.0-preview.5.22263.14 5.0.0-preview.22263.1 5.0.0-preview.22263.1 From 40b6e8a8831590e84d3d8f68b3e218afa85ee89f Mon Sep 17 00:00:00 2001 From: Mark Downie Date: Sat, 14 May 2022 18:43:46 -0400 Subject: [PATCH 39/71] Updating Readme to reference latest docs (#1891) Updated configuration doc to be consistent (assumes Linux and uses the correct diagnostics port) --- documentation/README.md | 2 ++ documentation/configuration.md | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/documentation/README.md b/documentation/README.md index 6f93e952262..859253d8bc5 100644 --- a/documentation/README.md +++ b/documentation/README.md @@ -31,6 +31,8 @@ When running a dotnet application, differences in diverse local and production e - [API Key Setup Guide](./api-key-setup.md) - [Windows](./authentication.md#windows-authentication) - [Collection Rules](./collectionrules/collectionrules.md) + - [Collection Rules examples](./collectionrules/collectionruleexamples.md) + - [Trigger shortcut](./collectionrules/triggershortcuts.md) - [Egress Providers](./egress.md) - [Troubleshooting](./troubleshooting.md) - [Clone, build, and test the repo](./building.md) diff --git a/documentation/configuration.md b/documentation/configuration.md index 1bb0b644915..f0dfe02de2c 100644 --- a/documentation/configuration.md +++ b/documentation/configuration.md @@ -266,12 +266,13 @@ Alternatively, `dotnet monitor` can be set to `Listen` mode using the expanded f ``` -When `dotnet monitor` is in `Listen` mode, you have to configure .NET processes to connect to `dotnet monitor`. You can do so by specifying the appropriate environment variable on your .NET process +When `dotnet monitor` is in `Listen` mode, you have to configure .NET processes to connect to `dotnet monitor`. You can do so by specifying the appropriate environment variable on your .NET process. -```powershell -$env:DOTNET_DiagnosticPorts="dotnet-monitor-pipe,suspend" +```bash +export DOTNET_DiagnosticPorts="/diag/port.sock,suspend" ``` + #### Maximum connection When operating in `Listen` mode, you can also specify the maximum number of incoming connections for `dotnet monitor` to accept via the following configuration: From 9caaca8851da5ad21026b43d8114a2a0768c1c0f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 17 May 2022 12:51:36 +0000 Subject: [PATCH 40/71] Update dependencies from https://github.com/dotnet/diagnostics build 20220516.1 (#1898) [main] Update dependencies from dotnet/diagnostics --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 097825aacc7..b5ad5ff391c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,13 +4,13 @@ https://github.com/dotnet/command-line-api 166610c56ff732093f0145a2911d4f6c40b786da - + https://github.com/dotnet/diagnostics - 6b2b94c7b6e68d2bb231912c88416d0b20d0c817 + 44f8eabe34fcfecb88fe2f4703206430366022a2 - + https://github.com/dotnet/diagnostics - 6b2b94c7b6e68d2bb231912c88416d0b20d0c817 + 44f8eabe34fcfecb88fe2f4703206430366022a2 diff --git a/eng/Versions.props b/eng/Versions.props index ed4c653949e..cc386aa849f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -48,8 +48,8 @@ 7.0.0-preview.5.22263.14 7.0.0-preview.5.22263.14 - 5.0.0-preview.22263.1 - 5.0.0-preview.22263.1 + 5.0.0-preview.22266.1 + 5.0.0-preview.22266.1 7.0.0-preview.5.22261.1 7.0.0-preview.5.22261.1 From 4bdc48c79414dc92aefc0f9b42f88870b084bb7a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 17 May 2022 12:55:25 +0000 Subject: [PATCH 41/71] Update dependencies from https://github.com/dotnet/arcade build 20220516.1 (#1899) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b5ad5ff391c..d8fbf5b34fa 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -18,13 +18,13 @@ https://github.com/dotnet/aspnetcore 3888fda44771dd6d45f305a831b2f37427303ae4 - + https://github.com/dotnet/arcade - b7796f653e48e001123963f17387c052891b48e6 + 70d269dfe645525adb6836d25d8a97d7960eda1a - + https://github.com/dotnet/arcade - b7796f653e48e001123963f17387c052891b48e6 + 70d269dfe645525adb6836d25d8a97d7960eda1a https://github.com/dotnet/symstore diff --git a/eng/Versions.props b/eng/Versions.props index cc386aa849f..581098eeec8 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -43,7 +43,7 @@ --> - 7.0.0-beta.22262.8 + 7.0.0-beta.22266.1 7.0.0-preview.5.22263.14 7.0.0-preview.5.22263.14 diff --git a/global.json b/global.json index 4a909d8248c..bf070531662 100644 --- a/global.json +++ b/global.json @@ -18,6 +18,6 @@ }, "msbuild-sdks": { "Microsoft.Build.NoTargets": "2.0.1", - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22262.8" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22266.1" } } From 32139ddd45713d97c22358e343699ebec8a662b5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 17 May 2022 13:26:58 +0000 Subject: [PATCH 42/71] Update dependencies from https://github.com/dotnet/symstore build 20220516.1 (#1900) [main] Update dependencies from dotnet/symstore --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d8fbf5b34fa..18e26bad118 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -26,9 +26,9 @@ https://github.com/dotnet/arcade 70d269dfe645525adb6836d25d8a97d7960eda1a - + https://github.com/dotnet/symstore - d13eb2d07a26a80c83667cbe1e0625bb37704bff + 073abc4f492cbc6795989e4a813b0d32017a8623 https://github.com/dotnet/runtime diff --git a/eng/Versions.props b/eng/Versions.props index 581098eeec8..1a411033700 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -54,7 +54,7 @@ 7.0.0-preview.5.22261.1 7.0.0-preview.5.22261.1 - 1.0.325901 + 1.0.326601 3.1.25 From dd243c5278e2f2d4c7fd708f94b7b9723ecaa188 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 17 May 2022 16:04:29 +0000 Subject: [PATCH 43/71] Update dependencies from https://github.com/dotnet/aspnetcore build 20220516.9 (#1901) [main] Update dependencies from dotnet/aspnetcore --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 18e26bad118..9b3f260daa3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,9 +14,9 @@ - + https://github.com/dotnet/aspnetcore - 3888fda44771dd6d45f305a831b2f37427303ae4 + 374896bd7017be626d334dd93b9cbea45e1830da https://github.com/dotnet/arcade @@ -34,9 +34,9 @@ https://github.com/dotnet/runtime 52fd1a576ef6640966046431edff2868e82b9e64 - + https://github.com/dotnet/aspnetcore - 3888fda44771dd6d45f305a831b2f37427303ae4 + 374896bd7017be626d334dd93b9cbea45e1830da https://github.com/dotnet/runtime diff --git a/eng/Versions.props b/eng/Versions.props index 1a411033700..8496eebb49d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -45,8 +45,8 @@ 7.0.0-beta.22266.1 - 7.0.0-preview.5.22263.14 - 7.0.0-preview.5.22263.14 + 7.0.0-preview.5.22266.9 + 7.0.0-preview.5.22266.9 5.0.0-preview.22266.1 5.0.0-preview.22266.1 From 6a49f5ab1e19655ecff8878b398721d8b807550e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 18 May 2022 12:50:25 +0000 Subject: [PATCH 44/71] Update dependencies from https://github.com/dotnet/diagnostics build 20220517.1 (#1902) [main] Update dependencies from dotnet/diagnostics --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9b3f260daa3..39eb72be801 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,13 +4,13 @@ https://github.com/dotnet/command-line-api 166610c56ff732093f0145a2911d4f6c40b786da - + https://github.com/dotnet/diagnostics - 44f8eabe34fcfecb88fe2f4703206430366022a2 + b02bc8470a1797fbff2acf137efe42e513ececba - + https://github.com/dotnet/diagnostics - 44f8eabe34fcfecb88fe2f4703206430366022a2 + b02bc8470a1797fbff2acf137efe42e513ececba diff --git a/eng/Versions.props b/eng/Versions.props index 8496eebb49d..f485dd33334 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -48,8 +48,8 @@ 7.0.0-preview.5.22266.9 7.0.0-preview.5.22266.9 - 5.0.0-preview.22266.1 - 5.0.0-preview.22266.1 + 5.0.0-preview.22267.1 + 5.0.0-preview.22267.1 7.0.0-preview.5.22261.1 7.0.0-preview.5.22261.1 From 98e5bcb5260925c58828e94f9c8b4b0038aafadc Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 18 May 2022 13:22:24 +0000 Subject: [PATCH 45/71] Update dependencies from https://github.com/dotnet/aspnetcore build 20220517.7 (#1904) [main] Update dependencies from dotnet/aspnetcore - Coherency Updates: - Microsoft.NETCore.App.Runtime.win-x64: from 7.0.0-preview.5.22261.1 to 7.0.0-preview.5.22266.11 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - VS.Redist.Common.NetCore.SharedFramework.x64.7.0: from 7.0.0-preview.5.22261.1 to 7.0.0-preview.5.22266.11 (parent: VS.Redist.Common.AspNetCore.SharedFramework.x64.7.0) --- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 39eb72be801..e1834f866ae 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,9 +14,9 @@ - + https://github.com/dotnet/aspnetcore - 374896bd7017be626d334dd93b9cbea45e1830da + 9ba59f928826c311301743cdc8234ab6c8715e11 https://github.com/dotnet/arcade @@ -30,17 +30,17 @@ https://github.com/dotnet/symstore 073abc4f492cbc6795989e4a813b0d32017a8623 - + https://github.com/dotnet/runtime - 52fd1a576ef6640966046431edff2868e82b9e64 + f4c60fd235fa8db19567ea7048cabec11ce9ce36 - + https://github.com/dotnet/aspnetcore - 374896bd7017be626d334dd93b9cbea45e1830da + 9ba59f928826c311301743cdc8234ab6c8715e11 - + https://github.com/dotnet/runtime - 52fd1a576ef6640966046431edff2868e82b9e64 + f4c60fd235fa8db19567ea7048cabec11ce9ce36 diff --git a/eng/Versions.props b/eng/Versions.props index f485dd33334..541df43005c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -45,14 +45,14 @@ 7.0.0-beta.22266.1 - 7.0.0-preview.5.22266.9 - 7.0.0-preview.5.22266.9 + 7.0.0-preview.5.22267.7 + 7.0.0-preview.5.22267.7 5.0.0-preview.22267.1 5.0.0-preview.22267.1 - 7.0.0-preview.5.22261.1 - 7.0.0-preview.5.22261.1 + 7.0.0-preview.5.22266.11 + 7.0.0-preview.5.22266.11 1.0.326601 From c351887ee193a6f63393c20c010345bdaae41b67 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 19 May 2022 12:49:31 +0000 Subject: [PATCH 46/71] Update dependencies from https://github.com/dotnet/diagnostics build 20220518.1 (#1907) [main] Update dependencies from dotnet/diagnostics --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e1834f866ae..48bf38bed47 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,13 +4,13 @@ https://github.com/dotnet/command-line-api 166610c56ff732093f0145a2911d4f6c40b786da - + https://github.com/dotnet/diagnostics - b02bc8470a1797fbff2acf137efe42e513ececba + 1e8e658f1bae02a0b5cb98336c09c7a18089bfa7 - + https://github.com/dotnet/diagnostics - b02bc8470a1797fbff2acf137efe42e513ececba + 1e8e658f1bae02a0b5cb98336c09c7a18089bfa7 diff --git a/eng/Versions.props b/eng/Versions.props index 541df43005c..9eaa86171e2 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -48,8 +48,8 @@ 7.0.0-preview.5.22267.7 7.0.0-preview.5.22267.7 - 5.0.0-preview.22267.1 - 5.0.0-preview.22267.1 + 5.0.0-preview.22268.1 + 5.0.0-preview.22268.1 7.0.0-preview.5.22266.11 7.0.0-preview.5.22266.11 From b64d6de4d6cce39a9feec31f8cbd47f819fb81be Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 19 May 2022 13:17:36 +0000 Subject: [PATCH 47/71] Update dependencies from https://github.com/dotnet/aspnetcore build 20220519.1 (#1908) [main] Update dependencies from dotnet/aspnetcore - Coherency Updates: - Microsoft.NETCore.App.Runtime.win-x64: from 7.0.0-preview.5.22266.11 to 7.0.0-preview.5.22267.11 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - VS.Redist.Common.NetCore.SharedFramework.x64.7.0: from 7.0.0-preview.5.22266.11 to 7.0.0-preview.5.22267.11 (parent: VS.Redist.Common.AspNetCore.SharedFramework.x64.7.0) --- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 48bf38bed47..beb36561a32 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,9 +14,9 @@ - + https://github.com/dotnet/aspnetcore - 9ba59f928826c311301743cdc8234ab6c8715e11 + bf50999cd8e60d4c683b772dffa9898794a8433a https://github.com/dotnet/arcade @@ -30,17 +30,17 @@ https://github.com/dotnet/symstore 073abc4f492cbc6795989e4a813b0d32017a8623 - + https://github.com/dotnet/runtime - f4c60fd235fa8db19567ea7048cabec11ce9ce36 + 5b1fd50332e02057634d156bc5d62a8e77d4202d - + https://github.com/dotnet/aspnetcore - 9ba59f928826c311301743cdc8234ab6c8715e11 + bf50999cd8e60d4c683b772dffa9898794a8433a - + https://github.com/dotnet/runtime - f4c60fd235fa8db19567ea7048cabec11ce9ce36 + 5b1fd50332e02057634d156bc5d62a8e77d4202d diff --git a/eng/Versions.props b/eng/Versions.props index 9eaa86171e2..011042d3ee1 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -45,14 +45,14 @@ 7.0.0-beta.22266.1 - 7.0.0-preview.5.22267.7 - 7.0.0-preview.5.22267.7 + 7.0.0-preview.5.22269.1 + 7.0.0-preview.5.22269.1 5.0.0-preview.22268.1 5.0.0-preview.22268.1 - 7.0.0-preview.5.22266.11 - 7.0.0-preview.5.22266.11 + 7.0.0-preview.5.22267.11 + 7.0.0-preview.5.22267.11 1.0.326601 From 70e17e077a04b20480943fa0829886054aaea1c4 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 19 May 2022 12:07:01 -0400 Subject: [PATCH 48/71] Update OSS Versions (#1877) --- NuGet.config | 1 + eng/Versions.props | 21 ++- .../Program.cs | 19 ++- .../Scenarios/AsyncWaitScenario.cs | 2 +- .../Scenarios/EnvironmentVariablesScenario.cs | 2 +- .../Scenarios/LoggerScenario.cs | 2 +- .../Scenarios/SpinWaitScenario.cs | 2 +- src/Tools/dotnet-monitor/Program.cs | 161 ++++++++++-------- 8 files changed, 119 insertions(+), 91 deletions(-) diff --git a/NuGet.config b/NuGet.config index 791beaa704d..ed2260090b4 100644 --- a/NuGet.config +++ b/NuGet.config @@ -13,6 +13,7 @@ + diff --git a/eng/Versions.props b/eng/Versions.props index 011042d3ee1..24af600f19b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -67,24 +67,23 @@ $(MicrosoftAspNetCoreAppRuntimewinx64Version) - 12.10.0 - 12.8.0 - 6.0.0 - 6.0.0 + 12.12.0 + 12.10.0 + 6.0.5 + 6.0.5 6.0.0 - 6.0.0 - 6.0.0 + 6.0.5 + 6.0.1 6.0.0 6.0.0 - 6.11.1 + 6.17.0 1.2.3 - 2.0.0-beta1.20468.1 - 6.11.1 + 2.0.0-beta3.22173.1 + 6.17.0 4.3.2 5.0.0 - 6.0.0 - 10.3.11 + 10.5.2 5.6.3 2.4.1 diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Program.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Program.cs index 09f21b87173..fbba6e71a3c 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Program.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Program.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using Microsoft.Diagnostics.Monitoring.UnitTestApp.Scenarios; +using System.CommandLine; using System.CommandLine.Builder; using System.CommandLine.Parsing; using System.Threading.Tasks; @@ -13,14 +14,16 @@ internal class Program { public static Task Main(string[] args) { - return new CommandLineBuilder() - .AddCommand(AsyncWaitScenario.Command()) - .AddCommand(LoggerScenario.Command()) - .AddCommand(SpinWaitScenario.Command()) - .AddCommand(EnvironmentVariablesScenario.Command()) - .UseDefaults() - .Build() - .InvokeAsync(args); + return new CommandLineBuilder(new RootCommand() + { + AsyncWaitScenario.Command(), + LoggerScenario.Command(), + SpinWaitScenario.Command(), + EnvironmentVariablesScenario.Command() + }) + .UseDefaults() + .Build() + .InvokeAsync(args); } } } diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/AsyncWaitScenario.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/AsyncWaitScenario.cs index 5cb60c12dcd..40fce64ff38 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/AsyncWaitScenario.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/AsyncWaitScenario.cs @@ -19,7 +19,7 @@ internal class AsyncWaitScenario public static Command Command() { Command command = new(TestAppScenarios.AsyncWait.Name); - command.Handler = CommandHandler.Create((Func>)ExecuteAsync); + command.SetHandler((Func>)ExecuteAsync); return command; } diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/EnvironmentVariablesScenario.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/EnvironmentVariablesScenario.cs index 1d986be605a..ce9e0c36d8b 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/EnvironmentVariablesScenario.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/EnvironmentVariablesScenario.cs @@ -20,7 +20,7 @@ internal class EnvironmentVariablesScenario public static Command Command() { Command command = new(TestAppScenarios.EnvironmentVariables.Name); - command.Handler = CommandHandler.Create((Func>)ExecuteAsync); + command.SetHandler((Func>)ExecuteAsync); return command; } diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/LoggerScenario.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/LoggerScenario.cs index e12e6be7651..b8f7e7a79a2 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/LoggerScenario.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/LoggerScenario.cs @@ -20,7 +20,7 @@ internal class LoggerScenario public static Command Command() { Command command = new(TestAppScenarios.Logger.Name); - command.Handler = CommandHandler.Create((Func>)ExecuteAsync); + command.SetHandler((Func>)ExecuteAsync); return command; } diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/SpinWaitScenario.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/SpinWaitScenario.cs index b53428832bf..bc754ac4ce6 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/SpinWaitScenario.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/SpinWaitScenario.cs @@ -20,7 +20,7 @@ internal class SpinWaitScenario public static Command Command() { Command command = new(TestAppScenarios.SpinWait.Name); - command.Handler = CommandHandler.Create((Func>)ExecuteAsync); + command.SetHandler((Func>)ExecuteAsync); return command; } diff --git a/src/Tools/dotnet-monitor/Program.cs b/src/Tools/dotnet-monitor/Program.cs index 3ce9e074f23..f6b4714f601 100644 --- a/src/Tools/dotnet-monitor/Program.cs +++ b/src/Tools/dotnet-monitor/Program.cs @@ -8,146 +8,171 @@ using System.Collections.Generic; using System.CommandLine; using System.CommandLine.Builder; -using System.CommandLine.Invocation; using System.CommandLine.Parsing; +using System.Threading; using System.Threading.Tasks; +using System.Linq; +using System.CommandLine.Binding; namespace Microsoft.Diagnostics.Tools.Monitor { class Program { - private static Command GenerateApiKeyCommand() => - new Command( + private static Command GenerateApiKeyCommand() + { + Command command = new Command( name: "generatekey", - description: Strings.HelpDescription_CommandGenerateKey) - { - CommandHandler.Create(GenerateApiKeyCommandHandler.Invoke), - Output() - }; + description: Strings.HelpDescription_CommandGenerateKey); + + command.Add(Output()); + + command.SetHandler(GenerateApiKeyCommandHandler.Invoke, command.Children.OfType().ToArray()); - private static Command CollectCommand() => - new Command( + return command; + } + + private static Command CollectCommand() + { + Command command = new Command( name: "collect", description: Strings.HelpDescription_CommandCollect) { - // Handler - CommandHandler.Create(CollectCommandHandler.Invoke), SharedOptions() }; - private static Command ConfigCommand() => - new Command( + command.SetHandler(CollectCommandHandler.Invoke, command.Children.OfType().ToArray()); + + return command; + } + + private static Command ConfigCommand() + { + Command showCommand = new Command( + name: "show", + description: Strings.HelpDescription_CommandShow) + { + SharedOptions(), + ConfigLevel(), + ShowSources() + }; + + showCommand.SetHandler(ConfigShowCommandHandler.Invoke, showCommand.Children.OfType().ToArray()); + + Command configCommand = new Command( name: "config", description: Strings.HelpDescription_CommandConfig) { - new Command( - name: "show", - description: Strings.HelpDescription_CommandShow) - { - // Handler - CommandHandler.Create(ConfigShowCommandHandler.Invoke), - SharedOptions(), - ConfigLevel(), - ShowSources() - } + showCommand }; + return configCommand; + } + private static IEnumerable - + https://github.com/dotnet/diagnostics 1e8e658f1bae02a0b5cb98336c09c7a18089bfa7 - + https://github.com/dotnet/diagnostics 1e8e658f1bae02a0b5cb98336c09c7a18089bfa7 diff --git a/eng/Versions.props b/eng/Versions.props index 24af600f19b..df399783150 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -48,8 +48,8 @@ 7.0.0-preview.5.22269.1 7.0.0-preview.5.22269.1 - 5.0.0-preview.22268.1 - 5.0.0-preview.22268.1 + 5.0.0-preview.22269.1 + 5.0.0-preview.22269.1 7.0.0-preview.5.22267.11 7.0.0-preview.5.22267.11 From a5aee301c6305bca6ebaf5f3f8ee470670445731 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 20 May 2022 20:42:07 +0000 Subject: [PATCH 50/71] Update dependencies from https://github.com/dotnet/aspnetcore build 20220519.12 (#1910) [main] Update dependencies from dotnet/aspnetcore --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8210a321c54..72d5c3766c9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,9 +14,9 @@ - + https://github.com/dotnet/aspnetcore - bf50999cd8e60d4c683b772dffa9898794a8433a + 0fd9575194b556332aeb9d9b1a37e88ccef7be01 https://github.com/dotnet/arcade @@ -34,9 +34,9 @@ https://github.com/dotnet/runtime 5b1fd50332e02057634d156bc5d62a8e77d4202d - + https://github.com/dotnet/aspnetcore - bf50999cd8e60d4c683b772dffa9898794a8433a + 0fd9575194b556332aeb9d9b1a37e88ccef7be01 https://github.com/dotnet/runtime diff --git a/eng/Versions.props b/eng/Versions.props index df399783150..f204a7610fe 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -45,8 +45,8 @@ 7.0.0-beta.22266.1 - 7.0.0-preview.5.22269.1 - 7.0.0-preview.5.22269.1 + 7.0.0-preview.5.22269.12 + 7.0.0-preview.5.22269.12 5.0.0-preview.22269.1 5.0.0-preview.22269.1 From 132ebdaf6a31e0242d5dea0f1b7c00782966834c Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 20 May 2022 17:53:07 -0400 Subject: [PATCH 51/71] Custom Shortcuts For Collection Rules (#1797) --- documentation/collectionrules/templates.md | 294 ++++++++++++++++++ documentation/schema.json | 57 ++++ ...tics.Monitoring.ConfigurationSchema.csproj | 1 + ...ics.Monitoring.Tool.FunctionalTests.csproj | 1 + .../ConfigurationTests.cs | 4 +- .../DiagnosticPortTests.cs | 23 +- .../CollectionRules.json | 11 + .../ExpectedConfigurations/Templates.json | 40 +++ .../CollectionRules.json | 11 + .../Templates.json | 40 +++ ...agnostics.Monitoring.Tool.UnitTests.csproj | 24 ++ .../SampleConfigurations/CollectionRules.json | 11 + .../SampleConfigurations/Templates.json | 42 +++ .../CollectionRuleDefaults.json | 17 + .../CollectionRules.json | 38 +++ .../DiagnosticPort.json | 6 + .../TemplatesConfigurations/Egress.json | 23 ++ .../TemplatesConfigurations/Templates.json | 42 +++ .../TemplatesTests.cs | 125 ++++++++ .../TestHostHelper.cs | 11 +- .../CollectionRuleBindingHelper.cs | 40 +++ .../CollectionRuleConfigureNamedOptions.cs | 53 +--- ...CollectionRulePostConfigureNamedOptions.cs | 147 +++++++++ .../TemplatesConfigureNamedOptions.cs | 59 ++++ .../Options/CollectionRuleOptions.Validate.cs | 8 + .../Options/CollectionRuleOptions.cs | 2 + .../Options/TemplateOptions.cs | 36 +++ .../Commands/CollectCommandHandler.cs | 2 + .../dotnet-monitor/ConfigurationJsonWriter.cs | 1 + src/Tools/dotnet-monitor/ConfigurationKeys.cs | 2 + src/Tools/dotnet-monitor/RootOptions.cs | 2 + .../ServiceCollectionExtensions.cs | 11 +- src/Tools/dotnet-monitor/Strings.Designer.cs | 9 + src/Tools/dotnet-monitor/Strings.resx | 6 + 34 files changed, 1134 insertions(+), 65 deletions(-) create mode 100644 documentation/collectionrules/templates.md create mode 100644 src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedConfigurations/Templates.json create mode 100644 src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedShowSourcesConfigurations/Templates.json create mode 100644 src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/SampleConfigurations/Templates.json create mode 100644 src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesConfigurations/CollectionRuleDefaults.json create mode 100644 src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesConfigurations/CollectionRules.json create mode 100644 src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesConfigurations/DiagnosticPort.json create mode 100644 src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesConfigurations/Egress.json create mode 100644 src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesConfigurations/Templates.json create mode 100644 src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesTests.cs create mode 100644 src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRuleBindingHelper.cs create mode 100644 src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRulePostConfigureNamedOptions.cs create mode 100644 src/Tools/dotnet-monitor/CollectionRules/Configuration/TemplatesConfigureNamedOptions.cs create mode 100644 src/Tools/dotnet-monitor/CollectionRules/Options/TemplateOptions.cs diff --git a/documentation/collectionrules/templates.md b/documentation/collectionrules/templates.md new file mode 100644 index 00000000000..1958130e03e --- /dev/null +++ b/documentation/collectionrules/templates.md @@ -0,0 +1,294 @@ +# Templates + +Templates allow users to design reusable collection rule components to decrease configuration verbosity, reduce duplication between rules, and speed up the process of writing complex scenarios. + +Templates associate a name with a single Filter, Trigger, Action, or Limit; this name can then be used throughout configuration to represent the use of that Filter/Trigger/Action/Limit. This is ideal for scenarios where multiple collection rules re-use the same functionality, allowing the author to write/edit the configuration in a single place. + +You can easily translate existing configuration to Templates using the format in the following sample; once defined, the Template is referenced by its name in the collection rule. + +
+ JSON + + ```json + { + "Templates": { + "CollectionRuleActions": { + "NameOfActionTemplate": { + "Type": "CollectTrace", + "Settings": { + "Egress": "artifacts", + "SlidingWindowDuration": "00:00:15", + "Profile": "Cpu" + } + } + }, + "CollectionRuleTriggers": { + "NameOfTriggerTemplate": { + "Type": "AspNetRequestCount", + "Settings": { + "RequestCount": 10, + "SlidingWindowDuration": "00:01:00" + } + } + } + }, + ... + "CollectionRules": { + "NameOfCollectionRule": { + "Trigger": "NameOfTriggerTemplate", + "Actions": [ + "NameOfActionTemplate" + ] + } + } + } + ``` +
+ +
+ Kubernetes ConfigMap + + ```yaml + Templates__CollectionRuleActions__NameOfActionTemplate__Type: "CollectTrace" + Templates__CollectionRuleActions__NameOfActionTemplate__Settings__Egress: "artifacts" + Templates__CollectionRuleActions__NameOfActionTemplate__Settings__SlidingWindowDuration: "00:00:15" + Templates__CollectionRuleActions__NameOfActionTemplate__Settings__Profile: "Cpu" + Templates__CollectionRuleTriggers__NameOfTriggerTemplate__Type: "AspNetRequestCount" + Templates__CollectionRuleTriggers__NameOfTriggerTemplate__Settings__RequestCount: "10" + Templates__CollectionRuleTriggers__NameOfTriggerTemplate__Settings__SlidingWindowDuration: "00:01:00" + CollectionRules__NameOfCollectionRule__Trigger: "NameOfTriggerTemplate" + CollectionRules__NameOfCollectionRule__Actions__0: "NameOfActionTemplate" + ``` +
+ +
+ Kubernetes Environment Variables + + ```yaml + - name: DotnetMonitor_Templates__CollectionRuleActions__NameOfActionTemplate__Type + value: "CollectTrace" + - name: DotnetMonitor_Templates__CollectionRuleActions__NameOfActionTemplate__Settings__Egress + value: "artifacts" + - name: DotnetMonitor_Templates__CollectionRuleActions__NameOfActionTemplate__Settings__SlidingWindowDuration + value: "00:00:15" + - name: DotnetMonitor_Templates__CollectionRuleActions__NameOfActionTemplate__Settings__Profile + value: "Cpu" + - name: DotnetMonitor_Templates__CollectionRuleTriggers__NameOfTriggerTemplate__Type + value: "AspNetRequestCount" + - name: DotnetMonitor_Templates__CollectionRuleTriggers__NameOfTriggerTemplate__Settings__RequestCount + value: "10" + - name: DotnetMonitor_Templates__CollectionRuleTriggers__NameOfTriggerTemplate__Settings__SlidingWindowDuration + value: "00:01:00" + - name: DotnetMonitor_CollectionRules__NameOfCollectionRule__Trigger + value: "NameOfTriggerTemplate" + - name: DotnetMonitor_CollectionRules__NameOfCollectionRule__Actions__0 + value: "NameOfActionTemplate" + ``` +
+ +## Example + +The following example creates a template trigger named "HighRequestCount", two template actions named "CpuTrace" and "ErrorLogs", a template filter named "AppName", and a template limit named "ShortDuration". These templates are integrated into collection rules alongside the existing configuration format to demonstrate that rules can contain a mix of templates and standard configuration. + +
+ JSON + + ```json + { + "Templates": { + "CollectionRuleActions": { + "CPUTrace": { + "Type": "CollectTrace", + "Settings": { + "Egress": "artifacts", + "SlidingWindowDuration": "00:00:15", + "Profile": "Cpu" + } + }, + "ErrorLogs": { + "Type": "CollectLogs", + "Settings": { + "Egress": "artifacts", + "DefaultLevel": "Error", + "UseAppFilters": false, + "Duration": "00:01:00" + } + } + }, + "CollectionRuleTriggers": { + "HighRequestCount": { + "Type": "AspNetRequestCount", + "Settings": { + "RequestCount": 10, + "SlidingWindowDuration": "00:01:00" + } + } + }, + "CollectionRuleFilters": { + "AppName": { + "Key": "ProcessName", + "Value": "MyProcessName", + "MatchType": "Exact" + } + }, + "CollectionRuleLimits": { + "ShortDuration": { + "RuleDuration": "00:05:00", + "ActionCount": "1", + "ActionCountSlidingWindowDuration": "00:00:30" + } + } + }, + ... + "CollectionRules": { + "LogAndDumpWhenHighRequestCount": { + "Trigger": "HighRequestCount", + "Actions": [ + "ErrorLogs", + { + "Type": "CollectDump", + "Settings": { + "Egress": "artifacts", + "Type": "Full" + } + } + ], + "Filters": [ + "AppName" + ], + "Limits": "ShortDuration" + } + }, + "TraceWhenHighCPU": { + "Trigger": { + "Type": "EventCounter", + "Settings": { + "ProviderName": "System.Runtime", + "CounterName": "cpu-usage", + "GreaterThan": 60, + "SlidingWindowDuration": "00:00:10" + } + }, + "Actions": [ + "CPUTrace" + ], + "Filters": [ + { + "ProcessId": "12345" + } + ] + } + } + ``` +
+ +
+ Kubernetes ConfigMap + + ```yaml + Templates__CollectionRuleActions__CPUTrace__Type: "CollectTrace" + Templates__CollectionRuleActions__CPUTrace__Settings__Egress: "artifacts" + Templates__CollectionRuleActions__CPUTrace__Settings__SlidingWindowDuration: "00:00:15" + Templates__CollectionRuleActions__CPUTrace__Settings__Profile: "Cpu" + Templates__CollectionRuleActions__ErrorLogs__Type: "CollectLogs" + Templates__CollectionRuleActions__ErrorLogs__Settings__Egress: "artifacts" + Templates__CollectionRuleActions__ErrorLogs__Settings__DefaultLevel: "Error" + Templates__CollectionRuleActions__ErrorLogs__Settings__UseAppFilters: "false" + Templates__CollectionRuleActions__ErrorLogs__Settings__Duration: "00:01:00" + Templates__CollectionRuleTriggers__HighRequestCount__Type: "AspNetRequestCount" + Templates__CollectionRuleTriggers__HighRequestCount__Settings__RequestCount: "10" + Templates__CollectionRuleTriggers__HighRequestCount__Settings__SlidingWindowDuration: "00:01:00" + Templates__CollectionRuleFilters__AppName__Key: "ProcessName" + Templates__CollectionRuleFilters__AppName__Value: "MyProcessName" + Templates__CollectionRuleFilters__AppName__MatchType: "Exact" + Templates__CollectionRuleLimits__ShortDuration__RuleDuration: "00:05:00" + Templates__CollectionRuleLimits__ShortDuration__ActionCount: "1" + Templates__CollectionRuleLimits__ShortDuration__ActionCountSlidingWindowDuration: "00:00:30" + + CollectionRules__LogAndDumpWhenHighRequestCount__Trigger: "HighRequestCount" + CollectionRules__LogAndDumpWhenHighRequestCount__Actions__0: "ErrorLogs" + CollectionRules__LogAndDumpWhenHighRequestCount__Actions__1__Type: "CollectDump" + CollectionRules__LogAndDumpWhenHighRequestCount__Actions__1__Settings__Egress: "artifacts" + CollectionRules__LogAndDumpWhenHighRequestCount__Actions__1__Settings__Type: "Full" + CollectionRules__LogAndDumpWhenHighRequestCount__Filters__0: "AppName" + CollectionRules__LogAndDumpWhenHighRequestCount__Limits: "ShortDuration" + CollectionRules__TraceWhenHighCPU__Trigger__Type: "EventCounter" + CollectionRules__TraceWhenHighCPU__Trigger__Settings__ProviderName: "System.Runtime" + CollectionRules__TraceWhenHighCPU__Trigger__Settings__CounterName: "cpu-usage" + CollectionRules__TraceWhenHighCPU__Trigger__Settings__GreaterThan: "60" + CollectionRules__TraceWhenHighCPU__Trigger__Settings__SlidingWindowDuration: "00:00:10" + CollectionRules__TraceWhenHighCPU__Actions__0: "CPUTrace" + CollectionRules__TraceWhenHighCPU__Filters__0__ProcessId: "12345" + ``` +
+ +
+ Kubernetes Environment Variables + + ```yaml + - name: DotnetMonitor_Templates__CollectionRuleActions__CPUTrace__Type + value: "CollectTrace" + - name: DotnetMonitor_Templates__CollectionRuleActions__CPUTrace__Settings__Egress + value: "artifacts" + - name: DotnetMonitor_Templates__CollectionRuleActions__CPUTrace__Settings__SlidingWindowDuration + value: "00:00:15" + - name: DotnetMonitor_Templates__CollectionRuleActions__CPUTrace__Settings__Profile + value: "Cpu" + - name: DotnetMonitor_Templates__CollectionRuleActions__ErrorLogs__Type + value: "CollectLogs" + - name: DotnetMonitor_Templates__CollectionRuleActions__ErrorLogs__Settings__Egress + value: "artifacts" + - name: DotnetMonitor_Templates__CollectionRuleActions__ErrorLogs__Settings__DefaultLevel + value: "Error" + - name: DotnetMonitor_Templates__CollectionRuleActions__ErrorLogs__Settings__UseAppFilters + value: "false" + - name: DotnetMonitor_Templates__CollectionRuleActions__ErrorLogs__Settings__Duration + value: "00:01:00" + - name: DotnetMonitor_Templates__CollectionRuleTriggers__HighRequestCount__Type + value: "AspNetRequestCount" + - name: DotnetMonitor_Templates__CollectionRuleTriggers__HighRequestCount__Settings__RequestCount + value: "10" + - name: DotnetMonitor_Templates__CollectionRuleTriggers__HighRequestCount__Settings__SlidingWindowDuration + value: "00:01:00" + - name: DotnetMonitor_Templates__CollectionRuleFilters__AppName__Key + value: "ProcessName" + - name: DotnetMonitor_Templates__CollectionRuleFilters__AppName__Value + value: "MyProcessName" + - name: DotnetMonitor_Templates__CollectionRuleFilters__AppName__MatchType + value: "Exact" + - name: DotnetMonitor_Templates__CollectionRuleLimits__ShortDuration__RuleDuration + value: "00:05:00" + - name: DotnetMonitor_Templates__CollectionRuleLimits__ShortDuration__ActionCount + value: "1" + - name: DotnetMonitor_Templates__CollectionRuleLimits__ShortDuration__ActionCountSlidingWindowDuration + value: "00:00:30" + - name: DotnetMonitor_CollectionRules__LogAndDumpWhenHighRequestCount__Trigger + value: "HighRequestCount" + - name: DotnetMonitor_CollectionRules__LogAndDumpWhenHighRequestCount__Actions__0 + value: "ErrorLogs" + - name: DotnetMonitor_CollectionRules__LogAndDumpWhenHighRequestCount__Actions__1__Type + value: "CollectDump" + - name: DotnetMonitor_CollectionRules__LogAndDumpWhenHighRequestCount__Actions__1__Settings__Egress + value: "artifacts" + - name: DotnetMonitor_CollectionRules__LogAndDumpWhenHighRequestCount__Actions__1__Settings__Type + value: "Full" + - name: DotnetMonitor_CollectionRules__LogAndDumpWhenHighRequestCount__Filters__0 + value: "AppName" + - name: DotnetMonitor_CollectionRules__LogAndDumpWhenHighRequestCount__Limits + value: "ShortDuration" + - name: DotnetMonitor_CollectionRules__TraceWhenHighCPU__Trigger__Type + value: "EventCounter" + - name: DotnetMonitor_CollectionRules__TraceWhenHighCPU__Trigger__Settings__ProviderName + value: "System.Runtime" + - name: DotnetMonitor_CollectionRules__TraceWhenHighCPU__Trigger__Settings__CounterName + value: "cpu-usage" + - name: DotnetMonitor_CollectionRules__TraceWhenHighCPU__Trigger__Settings__GreaterThan + value: "60" + - name: DotnetMonitor_CollectionRules__TraceWhenHighCPU__Trigger__Settings__SlidingWindowDuration + value: "00:00:10" + - name: DotnetMonitor_CollectionRules__TraceWhenHighCPU__Actions__0 + value: "CPUTrace" + - name: DotnetMonitor_CollectionRules__TraceWhenHighCPU__Filters__0__ProcessId + value: "12345" + ``` +
\ No newline at end of file diff --git a/documentation/schema.json b/documentation/schema.json index 6a1a076384b..dba3dc0bd82 100644 --- a/documentation/schema.json +++ b/documentation/schema.json @@ -127,6 +127,17 @@ "$ref": "#/definitions/CollectionRuleDefaultsOptions" } ] + }, + "Templates": { + "default": {}, + "oneOf": [ + { + "type": "null" + }, + { + "$ref": "#/definitions/TemplateOptions" + } + ] } }, "definitions": { @@ -1266,6 +1277,52 @@ } } }, + "TemplateOptions": { + "type": "object", + "additionalProperties": false, + "properties": { + "CollectionRuleFilters": { + "type": [ + "null", + "object" + ], + "description": "Process filters used to determine to which process(es) the collection rule is applied. All filters must match. If no filters are specified, the rule is applied to all discovered processes.", + "additionalProperties": { + "$ref": "#/definitions/ProcessFilterDescriptor" + } + }, + "CollectionRuleTriggers": { + "type": [ + "null", + "object" + ], + "description": "The trigger to use to monitor for a condition in the target process.", + "additionalProperties": { + "$ref": "#/definitions/CollectionRuleTriggerOptions" + } + }, + "CollectionRuleActions": { + "type": [ + "null", + "object" + ], + "description": "The list of actions to be executed when the trigger raises its notification.", + "additionalProperties": { + "$ref": "#/definitions/CollectionRuleActionOptions" + } + }, + "CollectionRuleLimits": { + "type": [ + "null", + "object" + ], + "description": "The set of limits to constrain the execution of the rule and its components.", + "additionalProperties": { + "$ref": "#/definitions/CollectionRuleLimitsOptions" + } + } + } + }, "CollectionRuleActionType": { "type": "string", "enum": [ diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj b/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj index 77ad93a3ad3..6d7d540f7d9 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj @@ -40,6 +40,7 @@ + diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.csproj b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.csproj index 075fe8744b9..6354b675bbe 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.csproj +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests.csproj @@ -42,6 +42,7 @@ + diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ConfigurationTests.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ConfigurationTests.cs index 5ef8b609980..de248cce4e4 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ConfigurationTests.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ConfigurationTests.cs @@ -59,6 +59,7 @@ public sealed class ConfigurationTests { "urls", "Kestrel", + "Templates", "CollectionRuleDefaults", "GlobalCounter", "CollectionRules", @@ -244,7 +245,7 @@ public void FullConfigurationWithSourcesTest(bool redact) settings.Urls = new[] { "https://localhost:44444" }; // This corresponds to the value in SampleConfigurations/URLs.json // This is the settings.json file in the user profile directory. - File.WriteAllText(Path.Combine(userConfigDir.FullName, "settings.json"), ConstructSettingsJson("Egress.json", "CollectionRules.json", "CollectionRuleDefaults.json")); + File.WriteAllText(Path.Combine(userConfigDir.FullName, "settings.json"), ConstructSettingsJson("Egress.json", "CollectionRules.json", "CollectionRuleDefaults.json", "Templates.json")); // This is the appsettings.json file that is normally next to the entrypoint assembly. // The location of the appsettings.json is determined by the content root in configuration. @@ -408,6 +409,7 @@ private Dictionary GetConfigurationFileNames(bool redact) { "DiagnosticPort", "DiagnosticPort.json" }, { "CollectionRules", "CollectionRules.json" }, { "CollectionRuleDefaults", "CollectionRuleDefaults.json" }, + { "Templates", "Templates.json" }, { "Authentication", redact ? "AuthenticationRedacted.json" : "AuthenticationFull.json" } }; } diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/DiagnosticPortTests.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/DiagnosticPortTests.cs index 9434fca3ae1..575db974b58 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/DiagnosticPortTests.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/DiagnosticPortTests.cs @@ -3,8 +3,11 @@ // See the LICENSE file in the project root for more information. using Microsoft.Diagnostics.Monitoring.WebApi; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Configuration.Memory; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; +using System.Collections.Generic; using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; @@ -30,7 +33,7 @@ await TestHostHelper.CreateCollectionRulesHost(_outputHelper, rootOptions => { } Assert.Equal(DiagnosticPortTestsConstants.SimplifiedDiagnosticPort, options.CurrentValue.EndpointName); Assert.Equal(DiagnosticPortConnectionMode.Listen, options.CurrentValue.ConnectionMode); - }, overrideSource: DiagnosticPortTestsConstants.SimplifiedListen_EnvironmentVariables); + }, overrideSource: GetConfigurationSources(DiagnosticPortTestsConstants.SimplifiedListen_EnvironmentVariables)); } [Fact] @@ -43,7 +46,7 @@ await TestHostHelper.CreateCollectionRulesHost(_outputHelper, rootOptions => { } Assert.Equal(DiagnosticPortTestsConstants.FullDiagnosticPort, options.CurrentValue.EndpointName); Assert.Equal(DiagnosticPortConnectionMode.Listen, options.CurrentValue.ConnectionMode); - }, overrideSource: DiagnosticPortTestsConstants.FullListen_EnvironmentVariables); + }, overrideSource: GetConfigurationSources(DiagnosticPortTestsConstants.FullListen_EnvironmentVariables)); } [Fact] @@ -55,7 +58,7 @@ await TestHostHelper.CreateCollectionRulesHost(_outputHelper, rootOptions => { } Assert.Equal(DiagnosticPortConnectionMode.Connect, options.CurrentValue.ConnectionMode); - }, overrideSource: DiagnosticPortTestsConstants.Connect_EnvironmentVariables); + }, overrideSource: GetConfigurationSources(DiagnosticPortTestsConstants.Connect_EnvironmentVariables)); } [Fact] @@ -68,7 +71,19 @@ await TestHostHelper.CreateCollectionRulesHost(_outputHelper, rootOptions => { } Assert.Equal(DiagnosticPortTestsConstants.SimplifiedDiagnosticPort, options.CurrentValue.EndpointName); Assert.Equal(DiagnosticPortConnectionMode.Listen, options.CurrentValue.ConnectionMode); - }, overrideSource: DiagnosticPortTestsConstants.AllListen_EnvironmentVariables); + }, overrideSource: GetConfigurationSources(DiagnosticPortTestsConstants.AllListen_EnvironmentVariables)); + } + + private List GetConfigurationSources(IDictionary initialData) + { + List sources = new(); + + MemoryConfigurationSource memoryConfigurationSource = new(); + memoryConfigurationSource.InitialData = initialData; + + sources.Add(memoryConfigurationSource); + + return sources; } } } diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedConfigurations/CollectionRules.json b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedConfigurations/CollectionRules.json index 9ade77f0a75..bcecfeb799e 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedConfigurations/CollectionRules.json +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedConfigurations/CollectionRules.json @@ -68,5 +68,16 @@ }, "Type": "AspNetRequestDuration" } + }, + "Rule4": { + "Actions": [ + "ActionTemplate1", + "ActionTemplate2" + ], + "Filters": [ + "FilterTemplate" + ], + "Limits": "LimitTemplate", + "Trigger": "TriggerTemplate" } } diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedConfigurations/Templates.json b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedConfigurations/Templates.json new file mode 100644 index 00000000000..752086749cd --- /dev/null +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedConfigurations/Templates.json @@ -0,0 +1,40 @@ +{ + "CollectionRuleActions": { + "ActionTemplate1": { + "Settings": { + "Egress": "artifacts" + }, + "Type": "CollectGCDump" + }, + "ActionTemplate2": { + "Settings": { + "Egress": "monitorBlob", + "Profile": "Cpu" + }, + "Type": "CollectTrace" + } + }, + "CollectionRuleFilters": { + "FilterTemplate": { + "Key": "ProcessName", + "MatchType": "Exact", + "Value": "FirstWebApp1" + } + }, + "CollectionRuleLimits": { + "LimitTemplate": { + "ActionCount": "1", + "ActionCountSlidingWindowDuration": "00:00:30", + "RuleDuration": "00:05:00" + } + }, + "CollectionRuleTriggers": { + "TriggerTemplate": { + "Settings": { + "RequestCount": "20", + "SlidingWindowDuration": "00:01:00" + }, + "Type": "AspNetRequestCount" + } + } +} diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedShowSourcesConfigurations/CollectionRules.json b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedShowSourcesConfigurations/CollectionRules.json index ead00645d72..e4f91ade1b1 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedShowSourcesConfigurations/CollectionRules.json +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedShowSourcesConfigurations/CollectionRules.json @@ -68,5 +68,16 @@ }, "Type": "AspNetRequestDuration" /*JsonConfigurationProvider for 'settings.json' (Optional)*/ } + }, + "Rule4": { + "Actions": [ + "ActionTemplate1" /*JsonConfigurationProvider for 'settings.json' (Optional)*/, + "ActionTemplate2" /*JsonConfigurationProvider for 'settings.json' (Optional)*/ + ], + "Filters": [ + "FilterTemplate" /*JsonConfigurationProvider for 'settings.json' (Optional)*/ + ], + "Limits": "LimitTemplate" /*JsonConfigurationProvider for 'settings.json' (Optional)*/, + "Trigger": "TriggerTemplate" /*JsonConfigurationProvider for 'settings.json' (Optional)*/ } } diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedShowSourcesConfigurations/Templates.json b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedShowSourcesConfigurations/Templates.json new file mode 100644 index 00000000000..0b008d98afa --- /dev/null +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedShowSourcesConfigurations/Templates.json @@ -0,0 +1,40 @@ +{ + "CollectionRuleActions": { + "ActionTemplate1": { + "Settings": { + "Egress": "artifacts" /*JsonConfigurationProvider for 'settings.json' (Optional)*/ + }, + "Type": "CollectGCDump" /*JsonConfigurationProvider for 'settings.json' (Optional)*/ + }, + "ActionTemplate2": { + "Settings": { + "Egress": "monitorBlob" /*JsonConfigurationProvider for 'settings.json' (Optional)*/, + "Profile": "Cpu" /*JsonConfigurationProvider for 'settings.json' (Optional)*/ + }, + "Type": "CollectTrace" /*JsonConfigurationProvider for 'settings.json' (Optional)*/ + } + }, + "CollectionRuleFilters": { + "FilterTemplate": { + "Key": "ProcessName" /*JsonConfigurationProvider for 'settings.json' (Optional)*/, + "MatchType": "Exact" /*JsonConfigurationProvider for 'settings.json' (Optional)*/, + "Value": "FirstWebApp1" /*JsonConfigurationProvider for 'settings.json' (Optional)*/ + } + }, + "CollectionRuleLimits": { + "LimitTemplate": { + "ActionCount": "1" /*JsonConfigurationProvider for 'settings.json' (Optional)*/, + "ActionCountSlidingWindowDuration": "00:00:30" /*JsonConfigurationProvider for 'settings.json' (Optional)*/, + "RuleDuration": "00:05:00" /*JsonConfigurationProvider for 'settings.json' (Optional)*/ + } + }, + "CollectionRuleTriggers": { + "TriggerTemplate": { + "Settings": { + "RequestCount": "20" /*JsonConfigurationProvider for 'settings.json' (Optional)*/, + "SlidingWindowDuration": "00:01:00" /*JsonConfigurationProvider for 'settings.json' (Optional)*/ + }, + "Type": "AspNetRequestCount" /*JsonConfigurationProvider for 'settings.json' (Optional)*/ + } + } +} diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests.csproj b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests.csproj index 31af02886fd..49e8cf8349e 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests.csproj +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests.csproj @@ -18,6 +18,9 @@ Always + + Always + Always @@ -27,6 +30,9 @@ Always + + Always + Always @@ -102,6 +108,24 @@ Always + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + Always diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/SampleConfigurations/CollectionRules.json b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/SampleConfigurations/CollectionRules.json index dd8925b520a..00a8cf644b8 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/SampleConfigurations/CollectionRules.json +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/SampleConfigurations/CollectionRules.json @@ -69,6 +69,17 @@ "Limits": { "ActionCountSlidingWindowDuration": "5:00:00" } + }, + "Rule4": { + "Trigger": "TriggerTemplate", + "Actions": [ + "ActionTemplate1", + "ActionTemplate2" + ], + "Limits": "LimitTemplate", + "Filters": [ + "FilterTemplate" + ] } } } diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/SampleConfigurations/Templates.json b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/SampleConfigurations/Templates.json new file mode 100644 index 00000000000..4aaa9ae9c67 --- /dev/null +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/SampleConfigurations/Templates.json @@ -0,0 +1,42 @@ +{ + "Templates": { + "CollectionRuleTriggers": { + "TriggerTemplate": { + "Type": "AspNetRequestCount", + "Settings": { + "RequestCount": "20", + "SlidingWindowDuration": "00:01:00" + } + } + }, + "CollectionRuleActions": { + "ActionTemplate1": { + "Type": "CollectGCDump", + "Settings": { + "Egress": "artifacts" + } + }, + "ActionTemplate2": { + "Type": "CollectTrace", + "Settings": { + "Egress": "monitorBlob", + "Profile": "Cpu" + } + } + }, + "CollectionRuleFilters": { + "FilterTemplate": { + "Key": "ProcessName", + "Value": "FirstWebApp1", + "MatchType": "Exact" + } + }, + "CollectionRuleLimits": { + "LimitTemplate": { + "RuleDuration": "00:05:00", + "ActionCount": "1", + "ActionCountSlidingWindowDuration": "00:00:30" + } + } + } +} diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesConfigurations/CollectionRuleDefaults.json b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesConfigurations/CollectionRuleDefaults.json new file mode 100644 index 00000000000..f26eeaa310a --- /dev/null +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesConfigurations/CollectionRuleDefaults.json @@ -0,0 +1,17 @@ +{ + "CollectionRuleDefaults": { + "Actions": { + "Egress": "artifacts2" + }, + "Triggers": { + "SlidingWindowDuration": "00:05:00", + "RequestCount": "10", + "ResponseCount": "1" + }, + "Limits": { + "ActionCount": "20", + "ActionCountSlidingWindowDuration": "00:00:01", + "RuleDuration": "11:11:11" + } + } +} diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesConfigurations/CollectionRules.json b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesConfigurations/CollectionRules.json new file mode 100644 index 00000000000..8d9683e0777 --- /dev/null +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesConfigurations/CollectionRules.json @@ -0,0 +1,38 @@ +{ + "CollectionRules": { + "ValidRule": { + "Trigger": "TriggerTemplate", + "Actions": [ + "ActionTemplate1", + { + "Type": "CollectGCDump" + }, + "ActionTemplate2", + { + "Type": "CollectDump", + "Settings": { + "Egress": "monitorBlob" + } + } + ], + "Filters": [ + { + "Key": "ProcessName", + "Value": "FirstWebApp" + }, + "FilterTemplate" + ], + "Limits": "LimitTemplate" + }, + "InvalidRule": { + "Trigger": "TriggerTemplateINVALID", + "Actions": [ + "ActionTemplate1", + "ActionTemplate2" + ], + "Filters": [ + "FilterTemplateINVALID" + ] + } + } +} diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesConfigurations/DiagnosticPort.json b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesConfigurations/DiagnosticPort.json new file mode 100644 index 00000000000..a40090ed29e --- /dev/null +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesConfigurations/DiagnosticPort.json @@ -0,0 +1,6 @@ +{ + "DiagnosticPort": { + "ConnectionMode": "Listen", + "EndpointName": "\\\\.\\pipe\\dotnet-monitor-pipe" + } +} diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesConfigurations/Egress.json b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesConfigurations/Egress.json new file mode 100644 index 00000000000..9c3d91f0eda --- /dev/null +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesConfigurations/Egress.json @@ -0,0 +1,23 @@ +{ + "Egress": { + "FileSystem": { + "artifacts": { + "directoryPath": "/artifacts" + }, + "artifacts2": { + "directoryPath": "/artifacts" + } + }, + "AzureBlobStorage": { + "monitorBlob": { + "accountUri": "https://exampleaccount.blob.core.windows.net", + "containerName": "dotnet-monitor", + "blobPrefix": "artifacts", + "accountKeyName": "MonitorBlobAccountKey" + } + }, + "Properties": { + "MonitorBlobAccountKey": "accountKey" + } + } +} diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesConfigurations/Templates.json b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesConfigurations/Templates.json new file mode 100644 index 00000000000..4aaa9ae9c67 --- /dev/null +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesConfigurations/Templates.json @@ -0,0 +1,42 @@ +{ + "Templates": { + "CollectionRuleTriggers": { + "TriggerTemplate": { + "Type": "AspNetRequestCount", + "Settings": { + "RequestCount": "20", + "SlidingWindowDuration": "00:01:00" + } + } + }, + "CollectionRuleActions": { + "ActionTemplate1": { + "Type": "CollectGCDump", + "Settings": { + "Egress": "artifacts" + } + }, + "ActionTemplate2": { + "Type": "CollectTrace", + "Settings": { + "Egress": "monitorBlob", + "Profile": "Cpu" + } + } + }, + "CollectionRuleFilters": { + "FilterTemplate": { + "Key": "ProcessName", + "Value": "FirstWebApp1", + "MatchType": "Exact" + } + }, + "CollectionRuleLimits": { + "LimitTemplate": { + "RuleDuration": "00:05:00", + "ActionCount": "1", + "ActionCountSlidingWindowDuration": "00:00:30" + } + } + } +} diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesTests.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesTests.cs new file mode 100644 index 00000000000..13d57adab47 --- /dev/null +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TemplatesTests.cs @@ -0,0 +1,125 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Diagnostics.Monitoring.TestCommon; +using Microsoft.Diagnostics.Tools.Monitor.CollectionRules; +using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options; +using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Actions; +using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options.Triggers; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Configuration.Json; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.Diagnostics.Monitoring.Tool.UnitTests +{ + public sealed class TemplatesTests + { + private readonly ITestOutputHelper _outputHelper; + + private const string SampleConfigurationsDirectory = "TemplatesConfigurations"; + + // This should be identical to the error message found in Strings.resx + private string TemplateNotFoundErrorMessage = "Could not find a template with the name: {0}"; + + public TemplatesTests(ITestOutputHelper outputHelper) + { + _outputHelper = outputHelper; + } + + /// + /// Tests that Templates are correctly translated from JSON to CollectionRuleOptions. + /// + [Fact] + public async void TemplatesTranslationSuccessTest() + { + using TemporaryDirectory userConfigDir = new(_outputHelper); + + await TestHostHelper.CreateCollectionRulesHost(_outputHelper, rootOptions => {}, host => + { + IOptionsMonitor optionsMonitor = host.Services.GetRequiredService>(); + + CollectionRuleOptions options = optionsMonitor.Get("ValidRule"); + + // Trigger Comparison + Assert.Equal(KnownCollectionRuleTriggers.AspNetRequestCount, options.Trigger.Type); + Assert.Equal(20, ((AspNetRequestCountOptions)options.Trigger.Settings).RequestCount); + Assert.Equal(TimeSpan.Parse("00:01:00"), ((AspNetRequestCountOptions)options.Trigger.Settings).SlidingWindowDuration); + + // Actions Comparison + Assert.Equal(4, options.Actions.Count); + Assert.Equal(KnownCollectionRuleActions.CollectGCDump, options.Actions[0].Type); + Assert.Equal("artifacts", ((CollectGCDumpOptions)options.Actions[0].Settings).Egress); + Assert.Equal(KnownCollectionRuleActions.CollectGCDump, options.Actions[1].Type); + Assert.Equal("artifacts2", ((CollectGCDumpOptions)options.Actions[1].Settings).Egress); + Assert.Equal(KnownCollectionRuleActions.CollectTrace, options.Actions[2].Type); + Assert.Equal("monitorBlob", ((CollectTraceOptions)options.Actions[2].Settings).Egress); + Assert.Equal(WebApi.Models.TraceProfile.Cpu, ((CollectTraceOptions)options.Actions[2].Settings).Profile); + Assert.Equal(KnownCollectionRuleActions.CollectDump, options.Actions[3].Type); + Assert.Equal("monitorBlob", ((CollectDumpOptions)options.Actions[3].Settings).Egress); + + // Filters Comparison + Assert.Equal(2, options.Filters.Count); + Assert.Equal(WebApi.ProcessFilterKey.ProcessName, options.Filters[0].Key); + Assert.Equal("FirstWebApp", options.Filters[0].Value); + Assert.Equal(WebApi.ProcessFilterKey.ProcessName, options.Filters[1].Key); + Assert.Equal("FirstWebApp1", options.Filters[1].Value); + Assert.Equal(WebApi.ProcessFilterType.Exact, options.Filters[1].MatchType); + + // Limits Comparison + Assert.Equal(1, options.Limits.ActionCount); + Assert.Equal(TimeSpan.Parse("00:00:30"), options.Limits.ActionCountSlidingWindowDuration); + Assert.Equal(TimeSpan.Parse("00:05:00"), options.Limits.RuleDuration); + + }, overrideSource: GetConfigurationSources()); + } + + /// + /// Tests that incorrectly referenced Templates error correctly. + /// + [Fact] + public async void TemplatesTranslationFailTest() + { + using TemporaryDirectory userConfigDir = new(_outputHelper); + + await TestHostHelper.CreateCollectionRulesHost(_outputHelper, rootOptions => { }, host => + { + IOptionsMonitor optionsMonitor = host.Services.GetRequiredService>(); + + OptionsValidationException ex = Assert.Throws(() => optionsMonitor.Get("InvalidRule")); + + string[] failures = ex.Failures.ToArray(); + Assert.Equal(2, failures.Length); + + Assert.Equal(string.Format(TemplateNotFoundErrorMessage, "TriggerTemplateINVALID"), failures[0]); + Assert.Equal(string.Format(TemplateNotFoundErrorMessage, "FilterTemplateINVALID"), failures[1]); + + }, overrideSource: GetConfigurationSources()); + } + + private List GetConfigurationSources() + { + string[] filePaths = Directory.GetFiles(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), SampleConfigurationsDirectory)); + + List sources = new(); + + foreach (string filePath in filePaths) + { + JsonConfigurationSource source = new JsonConfigurationSource(); + source.Path = filePath; + source.ResolveFileProvider(); + sources.Add(source); + } + + return sources; + } + } +} diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TestHostHelper.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TestHostHelper.cs index bf15ccaf299..003449decd5 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TestHostHelper.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/TestHostHelper.cs @@ -2,14 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.AspNetCore.Authentication; using Microsoft.Diagnostics.Monitoring.WebApi; using Microsoft.Diagnostics.Tools.Monitor; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -25,7 +23,7 @@ public static async Task CreateCollectionRulesHost( Func hostCallback, Action servicesCallback = null, Action loggingCallback = null, - IDictionary overrideSource = null) + List overrideSource = null) { IHost host = CreateHost(outputHelper, setup, servicesCallback, loggingCallback, overrideSource); @@ -45,7 +43,7 @@ public static async Task CreateCollectionRulesHost( Action hostCallback, Action servicesCallback = null, Action loggingCallback = null, - IDictionary overrideSource = null) + List overrideSource = null) { IHost host = CreateHost(outputHelper, setup, servicesCallback, loggingCallback, overrideSource); @@ -64,7 +62,7 @@ public static IHost CreateHost( Action setup, Action servicesCallback, Action loggingCallback = null, - IDictionary overrideSource = null) + List overrideSource = null) { return new HostBuilder() .ConfigureAppConfiguration(builder => @@ -86,7 +84,7 @@ public static IHost CreateHost( if (null != overrideSource) { - builder.AddInMemoryCollection(overrideSource); + overrideSource.ForEach(source => builder.Sources.Add(source)); } }) .ConfigureLogging( loggingBuilder => @@ -101,6 +99,7 @@ public static IHost CreateHost( services.AddSingleton(RealSystemClock.Instance); services.ConfigureGlobalCounter(context.Configuration); services.ConfigureCollectionRuleDefaults(context.Configuration); + services.ConfigureTemplates(context.Configuration); services.AddSingleton(); services.ConfigureCollectionRules(); services.ConfigureEgress(); diff --git a/src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRuleBindingHelper.cs b/src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRuleBindingHelper.cs new file mode 100644 index 00000000000..be8860621b1 --- /dev/null +++ b/src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRuleBindingHelper.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Actions; +using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options; +using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Triggers; +using Microsoft.Extensions.Configuration; + +namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Configuration +{ + internal class CollectionRuleBindingHelper + { + public static void BindActionSettings(IConfigurationSection actionSection, CollectionRuleActionOptions actionOptions, ICollectionRuleActionOperations actionOperations) + { + if (null != actionOptions && + actionOperations.TryCreateOptions(actionOptions.Type, out object actionSettings)) + { + IConfigurationSection settingsSection = actionSection.GetSection(nameof(CollectionRuleActionOptions.Settings)); + + settingsSection.Bind(actionSettings); + + actionOptions.Settings = actionSettings; + } + } + + public static void BindTriggerSettings(IConfigurationSection triggerSection, CollectionRuleTriggerOptions triggerOptions, ICollectionRuleTriggerOperations triggerOperations) + { + if (null != triggerOptions && + triggerOperations.TryCreateOptions(triggerOptions.Type, out object triggerSettings)) + { + IConfigurationSection settingsSection = triggerSection.GetSection(nameof(CollectionRuleTriggerOptions.Settings)); + + settingsSection.Bind(triggerSettings); + + triggerOptions.Settings = triggerSettings; + } + } + } +} diff --git a/src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRuleConfigureNamedOptions.cs b/src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRuleConfigureNamedOptions.cs index d5720e438ba..3d62320a0cd 100644 --- a/src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRuleConfigureNamedOptions.cs +++ b/src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRuleConfigureNamedOptions.cs @@ -2,31 +2,22 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Actions; using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options; -using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Triggers; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Options; using System; -using System.Globalization; namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Configuration { internal sealed class CollectionRuleConfigureNamedOptions : IConfigureNamedOptions { - private readonly ICollectionRuleActionOperations _actionOperations; private readonly CollectionRulesConfigurationProvider _configurationProvider; - private readonly ICollectionRuleTriggerOperations _triggerOperations; public CollectionRuleConfigureNamedOptions( - CollectionRulesConfigurationProvider configurationProvider, - ICollectionRuleActionOperations actionOperations, - ICollectionRuleTriggerOperations triggerOperations) + CollectionRulesConfigurationProvider configurationProvider) { - _actionOperations = actionOperations; _configurationProvider = configurationProvider; - _triggerOperations = triggerOperations; } public void Configure(string name, CollectionRuleOptions options) @@ -35,13 +26,6 @@ public void Configure(string name, CollectionRuleOptions options) if (ruleSection.Exists()) { ruleSection.Bind(options); - - BindTriggerSettings(ruleSection, options); - - for (int i = 0; i < options.Actions.Count; i++) - { - BindActionSettings(ruleSection, options, i); - } } } @@ -49,40 +33,5 @@ public void Configure(CollectionRuleOptions options) { throw new NotSupportedException(); } - - private void BindActionSettings(IConfigurationSection ruleSection, CollectionRuleOptions ruleOptions, int actionIndex) - { - CollectionRuleActionOptions actionOptions = ruleOptions.Actions[actionIndex]; - - if (null != actionOptions && - _actionOperations.TryCreateOptions(actionOptions.Type, out object actionSettings)) - { - IConfigurationSection settingsSection = ruleSection.GetSection(ConfigurationPath.Combine( - nameof(CollectionRuleOptions.Actions), - actionIndex.ToString(CultureInfo.InvariantCulture), - nameof(CollectionRuleActionOptions.Settings))); - - settingsSection.Bind(actionSettings); - - actionOptions.Settings = actionSettings; - } - } - - private void BindTriggerSettings(IConfigurationSection ruleSection, CollectionRuleOptions ruleOptions) - { - CollectionRuleTriggerOptions triggerOptions = ruleOptions.Trigger; - - if (null != triggerOptions && - _triggerOperations.TryCreateOptions(triggerOptions.Type, out object triggerSettings)) - { - IConfigurationSection settingsSection = ruleSection.GetSection(ConfigurationPath.Combine( - nameof(CollectionRuleOptions.Trigger), - nameof(CollectionRuleTriggerOptions.Settings))); - - settingsSection.Bind(triggerSettings); - - triggerOptions.Settings = triggerSettings; - } - } } } diff --git a/src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRulePostConfigureNamedOptions.cs b/src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRulePostConfigureNamedOptions.cs new file mode 100644 index 00000000000..4e9c05c8a79 --- /dev/null +++ b/src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRulePostConfigureNamedOptions.cs @@ -0,0 +1,147 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Diagnostics.Monitoring.WebApi; +using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Actions; +using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options; +using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Triggers; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Options; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Globalization; + +namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Configuration +{ + internal sealed class CollectionRulePostConfigureOptions : + IPostConfigureOptions + { + private readonly ICollectionRuleActionOperations _actionOperations; + private readonly ICollectionRuleTriggerOperations _triggerOperations; + private readonly TemplateOptions _templateOptions; + private readonly IConfiguration _configuration; + + public CollectionRulePostConfigureOptions( + IOptionsMonitor templateOptions, + IConfiguration configuration, + ICollectionRuleActionOperations actionOperations, + ICollectionRuleTriggerOperations triggerOperations) + { + _templateOptions = templateOptions.CurrentValue; + _configuration = configuration; + _actionOperations = actionOperations; + _triggerOperations = triggerOperations; + } + + public void PostConfigure(string name, CollectionRuleOptions options) + { + IConfigurationSection ruleSection = _configuration.GetSection(ConfigurationPath.Combine(nameof(RootOptions.CollectionRules), name)); + + ResolveActionList(options, ruleSection); + ResolveTrigger(options, ruleSection); + ResolveFilterList(options, ruleSection); + ResolveLimits(options, ruleSection); + } + + private void ResolveActionList(CollectionRuleOptions ruleOptions, IConfigurationSection ruleSection) + { + ruleOptions.Actions.Clear(); + + IConfigurationSection actionSections = ruleSection.GetSection(nameof(CollectionRuleOptions.Actions)); + + foreach (IConfigurationSection actionSection in actionSections.GetChildren()) + { + // The Section Key is the action index; the value (if present) is the name of the template + if (SectionHasValue(actionSection)) + { + TryGetTemplate(ruleOptions, _templateOptions.CollectionRuleActions, actionSection.Value, out CollectionRuleActionOptions templateActionOptions); + + ruleOptions.Actions.Add(templateActionOptions); + } + else + { + CollectionRuleActionOptions actionOptions = new(); + + actionSection.Bind(actionOptions); + + CollectionRuleBindingHelper.BindActionSettings(actionSection, actionOptions, _actionOperations); + + ruleOptions.Actions.Add(actionOptions); + } + } + } + + private void ResolveTrigger(CollectionRuleOptions ruleOptions, IConfigurationSection ruleSection) + { + IConfigurationSection section = ruleSection.GetSection(nameof(CollectionRuleOptions.Trigger)); + + if (SectionHasValue(section)) + { + TryGetTemplate(ruleOptions, _templateOptions.CollectionRuleTriggers, section.Value, out CollectionRuleTriggerOptions triggerOptions); + + ruleOptions.Trigger = triggerOptions; + } + else + { + CollectionRuleBindingHelper.BindTriggerSettings(section, ruleOptions.Trigger, _triggerOperations); + } + } + + private void ResolveFilterList(CollectionRuleOptions ruleOptions, IConfigurationSection ruleSection) + { + ruleOptions.Filters.Clear(); + + IConfigurationSection filterSections = ruleSection.GetSection(nameof(CollectionRuleOptions.Filters)); + + foreach (IConfigurationSection filterSection in filterSections.GetChildren()) + { + // The Section Key is the filter index; the value (if present) is the name of the template + if (SectionHasValue(filterSection)) + { + TryGetTemplate(ruleOptions, _templateOptions.CollectionRuleFilters, filterSection.Value, out ProcessFilterDescriptor templateFilterOptions); + + ruleOptions.Filters.Add(templateFilterOptions); + } + else + { + ProcessFilterDescriptor filterOptions = new(); + + filterSection.Bind(filterOptions); + + ruleOptions.Filters.Add(filterOptions); + } + } + } + + private void ResolveLimits(CollectionRuleOptions ruleOptions, IConfigurationSection ruleSection) + { + IConfigurationSection section = ruleSection.GetSection(nameof(CollectionRuleOptions.Limits)); + + if (SectionHasValue(section)) + { + TryGetTemplate(ruleOptions, _templateOptions.CollectionRuleLimits, section.Value, out CollectionRuleLimitsOptions limitsOptions); + + ruleOptions.Limits = limitsOptions; + } + } + + private bool TryGetTemplate(CollectionRuleOptions ruleOptions, IDictionary templatesOptions, string templateKey, out T templatesValue) where T : new() + { + if (!templatesOptions.TryGetValue(templateKey, out templatesValue)) + { + templatesValue = new(); + ruleOptions.ErrorList.Add(new ValidationResult(string.Format(CultureInfo.CurrentCulture, Strings.ErrorMessage_TemplateNotFound, templateKey))); + return false; + } + + return true; + } + + private bool SectionHasValue(IConfigurationSection section) + { + // If the section has a value, the value is the name of a template. + return !string.IsNullOrEmpty(section.Value); + } + } +} diff --git a/src/Tools/dotnet-monitor/CollectionRules/Configuration/TemplatesConfigureNamedOptions.cs b/src/Tools/dotnet-monitor/CollectionRules/Configuration/TemplatesConfigureNamedOptions.cs new file mode 100644 index 00000000000..9df7114bcf8 --- /dev/null +++ b/src/Tools/dotnet-monitor/CollectionRules/Configuration/TemplatesConfigureNamedOptions.cs @@ -0,0 +1,59 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Actions; +using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options; +using Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Triggers; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Options; + +namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Configuration +{ + internal sealed class TemplatesPostConfigureOptions : + IPostConfigureOptions + { + private readonly ICollectionRuleTriggerOperations _triggerOperations; + private readonly ICollectionRuleActionOperations _actionOperations; + private readonly IConfiguration _configuration; + private static readonly string collectionRuleActionsPath = ConfigurationPath.Combine(nameof(RootOptions.Templates), nameof(TemplateOptions.CollectionRuleActions)); + private static readonly string collectionRuleTriggersPath = ConfigurationPath.Combine(nameof(RootOptions.Templates), nameof(TemplateOptions.CollectionRuleTriggers)); + + public TemplatesPostConfigureOptions( + ICollectionRuleTriggerOperations triggerOperations, + ICollectionRuleActionOperations actionOperations, + IConfiguration configuration) + { + _triggerOperations = triggerOperations; + _actionOperations = actionOperations; + _configuration = configuration; + } + + public void PostConfigure(string name, TemplateOptions options) + { + IConfigurationSection collectionRuleActionsSection = _configuration.GetSection(collectionRuleActionsPath); + + foreach (string key in options.CollectionRuleActions.Keys) + { + IConfigurationSection actionSection = collectionRuleActionsSection.GetSection(key); + + if (actionSection.Exists()) + { + CollectionRuleBindingHelper.BindActionSettings(actionSection, options.CollectionRuleActions[key], _actionOperations); + } + } + + IConfigurationSection collectionRuleTriggersSection = _configuration.GetSection(collectionRuleTriggersPath); + + foreach (string key in options.CollectionRuleTriggers.Keys) + { + IConfigurationSection triggerSection = collectionRuleTriggersSection.GetSection(key); + + if (triggerSection.Exists()) + { + CollectionRuleBindingHelper.BindTriggerSettings(triggerSection, options.CollectionRuleTriggers[key], _triggerOperations); + } + } + } + } +} diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.Validate.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.Validate.cs index df9c38f8767..b28b01c8046 100644 --- a/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.Validate.cs +++ b/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.Validate.cs @@ -15,6 +15,14 @@ IEnumerable IValidatableObject.Validate(ValidationContext vali { List results = new(); + // ErrorList is populated by incorrectly using templates - this will be empty if all templates names can be resolved or if templates are not used. + results.AddRange(ErrorList); + + if (results.Count > 0) + { + return results; + } + ValidationContext filtersContext = new(Filters, validationContext, validationContext.Items); filtersContext.MemberName = nameof(Filters); ValidationHelper.TryValidateItems(Filters, filtersContext, results); diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs index 868289f6727..3589f9d6870 100644 --- a/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs +++ b/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs @@ -33,5 +33,7 @@ internal sealed partial class CollectionRuleOptions ResourceType = typeof(OptionsDisplayStrings), Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectionRuleOptions_Limits))] public CollectionRuleLimitsOptions Limits { get; set; } + + internal List ErrorList { get; } = new List(); } } diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/TemplateOptions.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/TemplateOptions.cs new file mode 100644 index 00000000000..2284a2f7876 --- /dev/null +++ b/src/Tools/dotnet-monitor/CollectionRules/Options/TemplateOptions.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.Diagnostics.Monitoring.WebApi; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace Microsoft.Diagnostics.Tools.Monitor.CollectionRules.Options +{ + /// + /// Options for describing custom user-defined templates. + /// + internal sealed partial class TemplateOptions + { + [Display( + ResourceType = typeof(OptionsDisplayStrings), + Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectionRuleOptions_Filters))] + public IDictionary CollectionRuleFilters { get; } = new Dictionary(); + + [Display( + ResourceType = typeof(OptionsDisplayStrings), + Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectionRuleOptions_Trigger))] + public IDictionary CollectionRuleTriggers { get; set; } = new Dictionary(); + + [Display( + ResourceType = typeof(OptionsDisplayStrings), + Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectionRuleOptions_Actions))] + public IDictionary CollectionRuleActions { get; set; } = new Dictionary(); + + [Display( + ResourceType = typeof(OptionsDisplayStrings), + Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_CollectionRuleOptions_Limits))] + public IDictionary CollectionRuleLimits { get; set; } = new Dictionary(); + } +} diff --git a/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs b/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs index fe72a1ff8f0..7ac1bfc9861 100644 --- a/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs +++ b/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs @@ -150,6 +150,8 @@ private static IHostBuilder ConfigureServices(this IHostBuilder builder, AuthCon services.ConfigureCollectionRuleDefaults(context.Configuration); + services.ConfigureTemplates(context.Configuration); + services.AddSingleton(); services.AddSingleton(); services.AddHostedServiceForwarder(); diff --git a/src/Tools/dotnet-monitor/ConfigurationJsonWriter.cs b/src/Tools/dotnet-monitor/ConfigurationJsonWriter.cs index 7794f0ad9f5..5c89a2c5fd6 100644 --- a/src/Tools/dotnet-monitor/ConfigurationJsonWriter.cs +++ b/src/Tools/dotnet-monitor/ConfigurationJsonWriter.cs @@ -65,6 +65,7 @@ public void Write(IConfiguration configuration, bool full, bool skipNotPresent, } //No sensitive information + ProcessChildSection(configuration, ConfigurationKeys.Templates, skipNotPresent, includeChildSections: true, showSources: showSources); ProcessChildSection(configuration, ConfigurationKeys.CollectionRuleDefaults, skipNotPresent, includeChildSections: true, showSources: showSources); ProcessChildSection(configuration, ConfigurationKeys.GlobalCounter, skipNotPresent, includeChildSections: true, showSources: showSources); ProcessChildSection(configuration, ConfigurationKeys.CollectionRules, skipNotPresent, includeChildSections: true, showSources: showSources); diff --git a/src/Tools/dotnet-monitor/ConfigurationKeys.cs b/src/Tools/dotnet-monitor/ConfigurationKeys.cs index f34049667a1..c2a8d04d58f 100644 --- a/src/Tools/dotnet-monitor/ConfigurationKeys.cs +++ b/src/Tools/dotnet-monitor/ConfigurationKeys.cs @@ -29,5 +29,7 @@ internal static class ConfigurationKeys public const string GlobalCounter = nameof(RootOptions.GlobalCounter); public const string CollectionRuleDefaults = nameof(RootOptions.CollectionRuleDefaults); + + public const string Templates = nameof(RootOptions.Templates); } } diff --git a/src/Tools/dotnet-monitor/RootOptions.cs b/src/Tools/dotnet-monitor/RootOptions.cs index 7141aa85055..0fefe2f4687 100644 --- a/src/Tools/dotnet-monitor/RootOptions.cs +++ b/src/Tools/dotnet-monitor/RootOptions.cs @@ -30,5 +30,7 @@ internal partial class RootOptions public ProcessFilterOptions DefaultProcess { get; set; } public CollectionRuleDefaultsOptions CollectionRuleDefaults { get; set; } + + public TemplateOptions Templates { get; set; } } } diff --git a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs index 109bd62ec44..e7f4f3369f8 100644 --- a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs +++ b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs @@ -40,6 +40,11 @@ public static IServiceCollection ConfigureCollectionRuleDefaults(this IServiceCo return ConfigureOptions(services, configuration, ConfigurationKeys.CollectionRuleDefaults); } + public static IServiceCollection ConfigureTemplates(this IServiceCollection services, IConfiguration configuration) + { + return ConfigureOptions(services, configuration, ConfigurationKeys.Templates); + } + public static IServiceCollection ConfigureMetrics(this IServiceCollection services, IConfiguration configuration) { return ConfigureOptions(services, configuration, ConfigurationKeys.Metrics) @@ -106,7 +111,11 @@ public static IServiceCollection ConfigureCollectionRules(this IServiceCollectio services.AddSingleton(); services.AddSingleton(); + services.AddSingleton, TemplatesPostConfigureOptions>(); + services.AddSingleton, CollectionRuleConfigureNamedOptions>(); + services.AddSingleton, CollectionRulePostConfigureOptions>(); + services.AddSingleton, DefaultCollectionRulePostConfigureOptions>(); services.AddSingleton, DataAnnotationValidateOptions>(); // Register change sources for the options type @@ -120,8 +129,6 @@ public static IServiceCollection ConfigureCollectionRules(this IServiceCollectio services.AddHostedServiceForwarder(); services.AddSingleton(); - services.AddSingleton, DefaultCollectionRulePostConfigureOptions>(); - return services; } diff --git a/src/Tools/dotnet-monitor/Strings.Designer.cs b/src/Tools/dotnet-monitor/Strings.Designer.cs index 7f706b318f7..34befa5d0d0 100644 --- a/src/Tools/dotnet-monitor/Strings.Designer.cs +++ b/src/Tools/dotnet-monitor/Strings.Designer.cs @@ -330,6 +330,15 @@ internal static string ErrorMessage_RejectedJwk { } } + /// + /// Looks up a localized string similar to Could not find a template with the name: {0}. + /// + internal static string ErrorMessage_TemplateNotFound { + get { + return ResourceManager.GetString("ErrorMessage_TemplateNotFound", resourceCulture); + } + } + /// /// Looks up a localized string similar to The '{0}' trigger factory failed to create a trigger instance.. /// diff --git a/src/Tools/dotnet-monitor/Strings.resx b/src/Tools/dotnet-monitor/Strings.resx index 1c2e1cd3456..c4ea56bd357 100644 --- a/src/Tools/dotnet-monitor/Strings.resx +++ b/src/Tools/dotnet-monitor/Strings.resx @@ -273,6 +273,12 @@ Gets the format string for rejecting a config param because it is not a jwk type that is accepted. 1 Format Parameter: 0. configName: The variable name for the provided string. + + + Could not find a template with the name: {0} + Gets the format string for template resolution failure. +1 Format Parameter: +0. templateName: The name of the template that could not be found. The '{0}' trigger factory failed to create a trigger instance. From ab4767ab4426b2cf8691e528bb0da5b1fe67bfb7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 21 May 2022 12:59:19 +0000 Subject: [PATCH 52/71] Update dependencies from https://github.com/dotnet/arcade build 20220519.3 (#1913) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 72d5c3766c9..8287404ddeb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -18,13 +18,13 @@ https://github.com/dotnet/aspnetcore 0fd9575194b556332aeb9d9b1a37e88ccef7be01
- + https://github.com/dotnet/arcade - 70d269dfe645525adb6836d25d8a97d7960eda1a + 0403b0d07aff1b103256cfbe082c97a5c8846d20 - + https://github.com/dotnet/arcade - 70d269dfe645525adb6836d25d8a97d7960eda1a + 0403b0d07aff1b103256cfbe082c97a5c8846d20 https://github.com/dotnet/symstore diff --git a/eng/Versions.props b/eng/Versions.props index f204a7610fe..e1df1ff2804 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -43,7 +43,7 @@ --> - 7.0.0-beta.22266.1 + 7.0.0-beta.22269.3 7.0.0-preview.5.22269.12 7.0.0-preview.5.22269.12 diff --git a/global.json b/global.json index bf070531662..5469ac2d75f 100644 --- a/global.json +++ b/global.json @@ -18,6 +18,6 @@ }, "msbuild-sdks": { "Microsoft.Build.NoTargets": "2.0.1", - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22266.1" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22269.3" } } From 276952c44a92a1de7d6b4e5595cd3fb7cc97853d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 22 May 2022 12:49:35 +0000 Subject: [PATCH 53/71] Update dependencies from https://github.com/dotnet/diagnostics build 20220520.1 (#1915) [main] Update dependencies from dotnet/diagnostics --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8287404ddeb..4eab2009b3c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,11 +4,11 @@ https://github.com/dotnet/command-line-api 166610c56ff732093f0145a2911d4f6c40b786da - + https://github.com/dotnet/diagnostics 1e8e658f1bae02a0b5cb98336c09c7a18089bfa7 - + https://github.com/dotnet/diagnostics 1e8e658f1bae02a0b5cb98336c09c7a18089bfa7 diff --git a/eng/Versions.props b/eng/Versions.props index e1df1ff2804..87876a830f0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -48,8 +48,8 @@ 7.0.0-preview.5.22269.12 7.0.0-preview.5.22269.12 - 5.0.0-preview.22269.1 - 5.0.0-preview.22269.1 + 5.0.0-preview.22270.1 + 5.0.0-preview.22270.1 7.0.0-preview.5.22267.11 7.0.0-preview.5.22267.11 From 9fc828f562cb3eae3c94361cb2202e616a207a0e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 22 May 2022 13:10:49 -0700 Subject: [PATCH 54/71] [main] Update dependencies from dotnet/aspnetcore (#1914) --- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4eab2009b3c..30f343fdd00 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,9 +14,9 @@ - + https://github.com/dotnet/aspnetcore - 0fd9575194b556332aeb9d9b1a37e88ccef7be01 + 94ec159f8b0d0a35c3df30f6633a6c393bb0370f https://github.com/dotnet/arcade @@ -30,17 +30,17 @@ https://github.com/dotnet/symstore 073abc4f492cbc6795989e4a813b0d32017a8623 - + https://github.com/dotnet/runtime - 5b1fd50332e02057634d156bc5d62a8e77d4202d + 334989f6cc0600f9c12e9fa989dc1814c8300d1d - + https://github.com/dotnet/aspnetcore - 0fd9575194b556332aeb9d9b1a37e88ccef7be01 + 94ec159f8b0d0a35c3df30f6633a6c393bb0370f - + https://github.com/dotnet/runtime - 5b1fd50332e02057634d156bc5d62a8e77d4202d + 334989f6cc0600f9c12e9fa989dc1814c8300d1d diff --git a/eng/Versions.props b/eng/Versions.props index 87876a830f0..a64647c853e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -45,14 +45,14 @@ 7.0.0-beta.22269.3 - 7.0.0-preview.5.22269.12 - 7.0.0-preview.5.22269.12 + 7.0.0-preview.5.22271.1 + 7.0.0-preview.5.22271.1 5.0.0-preview.22270.1 5.0.0-preview.22270.1 - 7.0.0-preview.5.22267.11 - 7.0.0-preview.5.22267.11 + 7.0.0-preview.5.22269.8 + 7.0.0-preview.5.22269.8 1.0.326601 From 6c822ccf6c310a1878b0b0c9547b5735d7b7f786 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 23 May 2022 13:17:12 +0000 Subject: [PATCH 55/71] Update dependencies from https://github.com/dotnet/aspnetcore build 20220522.3 (#1916) [main] Update dependencies from dotnet/aspnetcore - Coherency Updates: - Microsoft.NETCore.App.Runtime.win-x64: from 7.0.0-preview.5.22269.8 to 7.0.0-preview.5.22271.4 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - VS.Redist.Common.NetCore.SharedFramework.x64.7.0: from 7.0.0-preview.5.22269.8 to 7.0.0-preview.5.22271.4 (parent: VS.Redist.Common.AspNetCore.SharedFramework.x64.7.0) --- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 30f343fdd00..3d03c2d8fc5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,9 +14,9 @@ - + https://github.com/dotnet/aspnetcore - 94ec159f8b0d0a35c3df30f6633a6c393bb0370f + a5bb3e8761dcfc21d3a31f3c85d4d31779ef4f4f https://github.com/dotnet/arcade @@ -30,17 +30,17 @@ https://github.com/dotnet/symstore 073abc4f492cbc6795989e4a813b0d32017a8623 - + https://github.com/dotnet/runtime - 334989f6cc0600f9c12e9fa989dc1814c8300d1d + 621cd59436cb29cab4b1162409ae0947c4bd780d - + https://github.com/dotnet/aspnetcore - 94ec159f8b0d0a35c3df30f6633a6c393bb0370f + a5bb3e8761dcfc21d3a31f3c85d4d31779ef4f4f - + https://github.com/dotnet/runtime - 334989f6cc0600f9c12e9fa989dc1814c8300d1d + 621cd59436cb29cab4b1162409ae0947c4bd780d diff --git a/eng/Versions.props b/eng/Versions.props index a64647c853e..5379d4f1f9a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -45,14 +45,14 @@ 7.0.0-beta.22269.3 - 7.0.0-preview.5.22271.1 - 7.0.0-preview.5.22271.1 + 7.0.0-preview.5.22272.3 + 7.0.0-preview.5.22272.3 5.0.0-preview.22270.1 5.0.0-preview.22270.1 - 7.0.0-preview.5.22269.8 - 7.0.0-preview.5.22269.8 + 7.0.0-preview.5.22271.4 + 7.0.0-preview.5.22271.4 1.0.326601 From cae14c98374c89cf34e6cb4be60d85cc43c7b257 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 24 May 2022 12:56:18 +0000 Subject: [PATCH 56/71] Update dependencies from https://github.com/dotnet/diagnostics build 20220523.1 (#1917) [main] Update dependencies from dotnet/diagnostics --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3d03c2d8fc5..1a45c3a1fca 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,13 +4,13 @@ https://github.com/dotnet/command-line-api 166610c56ff732093f0145a2911d4f6c40b786da - + https://github.com/dotnet/diagnostics - 1e8e658f1bae02a0b5cb98336c09c7a18089bfa7 + e5ba58f4957213ba79aec25a4bb7f8afb18c19a7 - + https://github.com/dotnet/diagnostics - 1e8e658f1bae02a0b5cb98336c09c7a18089bfa7 + e5ba58f4957213ba79aec25a4bb7f8afb18c19a7 diff --git a/eng/Versions.props b/eng/Versions.props index 5379d4f1f9a..c355bb4bbfe 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -48,8 +48,8 @@ 7.0.0-preview.5.22272.3 7.0.0-preview.5.22272.3 - 5.0.0-preview.22270.1 - 5.0.0-preview.22270.1 + 5.0.0-preview.22273.1 + 5.0.0-preview.22273.1 7.0.0-preview.5.22271.4 7.0.0-preview.5.22271.4 From c19e86ec42646010918830ca20819c393aa96fcb Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 24 May 2022 13:00:02 +0000 Subject: [PATCH 57/71] Update dependencies from https://github.com/dotnet/arcade build 20220523.1 (#1918) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- eng/common/tools.ps1 | 4 ++++ global.json | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1a45c3a1fca..2733e342d5a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -18,13 +18,13 @@ https://github.com/dotnet/aspnetcore a5bb3e8761dcfc21d3a31f3c85d4d31779ef4f4f - + https://github.com/dotnet/arcade - 0403b0d07aff1b103256cfbe082c97a5c8846d20 + ad55f9b957b9539613ecff82649d17650e4624d2 - + https://github.com/dotnet/arcade - 0403b0d07aff1b103256cfbe082c97a5c8846d20 + ad55f9b957b9539613ecff82649d17650e4624d2 https://github.com/dotnet/symstore diff --git a/eng/Versions.props b/eng/Versions.props index c355bb4bbfe..e8725ee8950 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -43,7 +43,7 @@ --> - 7.0.0-beta.22269.3 + 7.0.0-beta.22273.1 7.0.0-preview.5.22272.3 7.0.0-preview.5.22272.3 diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 797f05292a8..423bd962e96 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -635,6 +635,10 @@ function InitializeNativeTools() { InstallDirectory = "$ToolsDir" } } + if (Test-Path variable:NativeToolsOnMachine) { + Write-Host "Variable NativeToolsOnMachine detected, enabling native tool path promotion..." + $nativeArgs += @{ PathPromotion = $true } + } & "$PSScriptRoot/init-tools-native.ps1" @nativeArgs } } diff --git a/global.json b/global.json index 5469ac2d75f..2f3c97a80c9 100644 --- a/global.json +++ b/global.json @@ -18,6 +18,6 @@ }, "msbuild-sdks": { "Microsoft.Build.NoTargets": "2.0.1", - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22269.3" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22273.1" } } From 1669e8e6e18ac05ed848f910ce010efd80b02a27 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 24 May 2022 13:33:41 +0000 Subject: [PATCH 58/71] Update dependencies from https://github.com/dotnet/aspnetcore build 20220524.1 (#1920) [main] Update dependencies from dotnet/aspnetcore - Coherency Updates: - Microsoft.NETCore.App.Runtime.win-x64: from 7.0.0-preview.5.22271.4 to 7.0.0-preview.5.22272.3 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - VS.Redist.Common.NetCore.SharedFramework.x64.7.0: from 7.0.0-preview.5.22271.4 to 7.0.0-preview.5.22272.3 (parent: VS.Redist.Common.AspNetCore.SharedFramework.x64.7.0) --- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2733e342d5a..0e30eef3d60 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,9 +14,9 @@ - + https://github.com/dotnet/aspnetcore - a5bb3e8761dcfc21d3a31f3c85d4d31779ef4f4f + 5ff6e316a8e34bb06b986ec13ec7aae3f61e886b https://github.com/dotnet/arcade @@ -30,17 +30,17 @@ https://github.com/dotnet/symstore 073abc4f492cbc6795989e4a813b0d32017a8623 - + https://github.com/dotnet/runtime - 621cd59436cb29cab4b1162409ae0947c4bd780d + 0864cc5539e0ddd109b443b0bee804878cd7ba76 - + https://github.com/dotnet/aspnetcore - a5bb3e8761dcfc21d3a31f3c85d4d31779ef4f4f + 5ff6e316a8e34bb06b986ec13ec7aae3f61e886b - + https://github.com/dotnet/runtime - 621cd59436cb29cab4b1162409ae0947c4bd780d + 0864cc5539e0ddd109b443b0bee804878cd7ba76 diff --git a/eng/Versions.props b/eng/Versions.props index e8725ee8950..299a80a6d90 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -45,14 +45,14 @@ 7.0.0-beta.22273.1 - 7.0.0-preview.5.22272.3 - 7.0.0-preview.5.22272.3 + 7.0.0-preview.5.22274.1 + 7.0.0-preview.5.22274.1 5.0.0-preview.22273.1 5.0.0-preview.22273.1 - 7.0.0-preview.5.22271.4 - 7.0.0-preview.5.22271.4 + 7.0.0-preview.5.22272.3 + 7.0.0-preview.5.22272.3 1.0.326601 From 626592c02352236a57957817efe39f2c3e3e2fe6 Mon Sep 17 00:00:00 2001 From: Wiktor Kopec Date: Tue, 24 May 2022 08:55:49 -0700 Subject: [PATCH 59/71] Add command ipc to profiler (#1790) (#1912) Add a communication mechanism between the profiler and dotnet-monitor. - Currently using Unix Domain Socket on both Windows and Linux - Current model is to receive small control messages from dotnet-monitor. - Requests are handled serially, long/con-current sessions are not really supported with the current model. --- src/MonitorProfiler/CMakeLists.txt | 14 ++ .../Communication/CommandServer.cpp | 109 +++++++++++++ .../Communication/CommandServer.h | 37 +++++ .../Communication/IpcCommClient.cpp | 114 ++++++++++++++ .../Communication/IpcCommClient.h | 23 +++ .../Communication/IpcCommServer.cpp | 146 ++++++++++++++++++ .../Communication/IpcCommServer.h | 29 ++++ src/MonitorProfiler/Communication/Messages.h | 18 +++ .../Communication/SocketWrapper.h | 137 ++++++++++++++++ .../Environment/EnvironmentHelper.cpp | 30 ++++ .../Environment/EnvironmentHelper.h | 19 +++ .../MainProfiler/MainProfiler.cpp | 45 ++++++ .../MainProfiler/MainProfiler.h | 5 + src/MonitorProfiler/Utilities/BlockingQueue.h | 58 +++++++ 14 files changed, 784 insertions(+) create mode 100644 src/MonitorProfiler/Communication/CommandServer.cpp create mode 100644 src/MonitorProfiler/Communication/CommandServer.h create mode 100644 src/MonitorProfiler/Communication/IpcCommClient.cpp create mode 100644 src/MonitorProfiler/Communication/IpcCommClient.h create mode 100644 src/MonitorProfiler/Communication/IpcCommServer.cpp create mode 100644 src/MonitorProfiler/Communication/IpcCommServer.h create mode 100644 src/MonitorProfiler/Communication/Messages.h create mode 100644 src/MonitorProfiler/Communication/SocketWrapper.h create mode 100644 src/MonitorProfiler/Utilities/BlockingQueue.h diff --git a/src/MonitorProfiler/CMakeLists.txt b/src/MonitorProfiler/CMakeLists.txt index 542f9c0ab8b..06d43be228a 100644 --- a/src/MonitorProfiler/CMakeLists.txt +++ b/src/MonitorProfiler/CMakeLists.txt @@ -8,6 +8,7 @@ if(CLR_CMAKE_HOST_WIN32) Logging/DebugLogger.cpp MonitorProfiler.def ) + add_definitions(-DWIN32_LEAN_AND_MEAN) endif(CLR_CMAKE_HOST_WIN32) set(SOURCES @@ -20,11 +21,24 @@ set(SOURCES ClassFactory.cpp DllMain.cpp ProfilerBase.cpp + Communication/IpcCommServer.cpp + Communication/IpcCommClient.cpp + Communication/CommandServer.cpp ) # Build library and split symbols add_library_clr(MonitorProfiler SHARED ${SOURCES}) +if(CLR_CMAKE_HOST_WIN32) + target_link_libraries(MonitorProfiler ws2_32) +endif(CLR_CMAKE_HOST_WIN32) + +if (CLR_CMAKE_HOST_UNIX) + target_link_libraries(MonitorProfiler + stdc++ + pthread) +endif(CLR_CMAKE_HOST_UNIX) + # Install library install(TARGETS MonitorProfiler DESTINATION .) # Install symbols diff --git a/src/MonitorProfiler/Communication/CommandServer.cpp b/src/MonitorProfiler/Communication/CommandServer.cpp new file mode 100644 index 00000000000..f307b529945 --- /dev/null +++ b/src/MonitorProfiler/Communication/CommandServer.cpp @@ -0,0 +1,109 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#include "CommandServer.h" +#include +#include "../Logging/Logger.h" + +CommandServer::CommandServer(const std::shared_ptr& logger) : _shutdown(false), _logger(logger) +{ +} + +HRESULT CommandServer::Start(const std::string& path, std::function callback) +{ + if (_shutdown.load()) + { + return E_UNEXPECTED; + } + + HRESULT hr; +#if TARGET_WINDOWS + WSADATA wsaData; + int result = WSAStartup(MAKEWORD(2, 2), &wsaData); + if (result != 0) + { + return HRESULT_FROM_WIN32(result); + } +#endif + + _callback = callback; + + IfFailLogRet_(_logger, _server.Bind(path)); + _listeningThread = std::thread(&CommandServer::ListeningThread, this); + _clientThread = std::thread(&CommandServer::ClientProcessingThread, this); + return S_OK; +} + +void CommandServer::Shutdown() +{ + bool shutdown = false; + if (_shutdown.compare_exchange_strong(shutdown, true)) + { + _clientQueue.Complete(); + _server.Shutdown(); + + _listeningThread.join(); + _clientThread.join(); + } +} + +void CommandServer::ListeningThread() +{ + while (true) + { + std::shared_ptr client; + HRESULT hr = _server.Accept(client); + if (FAILED(hr)) + { + break; + } + + IpcMessage message; + + //Note this can timeout if the client doesn't send anything + hr = client->Receive(message); + if (FAILED(hr)) + { + _logger->Log(LogLevel::Error, _T("Unexpected error when receiving data: 0x%08x"), hr); + continue; + } + + IpcMessage response; + response.MessageType = SUCCEEDED(hr) ? MessageType::OK : MessageType::Error; + response.Parameters = hr; + + hr = client->Send(response); + if (FAILED(hr)) + { + _logger->Log(LogLevel::Error, _T("Unexpected error when sending data: 0x%08x"), hr); + continue; + } + hr = client->Shutdown(); + if (FAILED(hr)) + { + _logger->Log(LogLevel::Warning, _T("Unexpected error during shutdown: 0x%08x"), hr); + } + + _clientQueue.Enqueue(message); + } +} + +void CommandServer::ClientProcessingThread() +{ + while (true) + { + IpcMessage message; + HRESULT hr = _clientQueue.BlockingDequeue(message); + if (hr != S_OK) + { + //We are complete, discard all messages + break; + } + hr = _callback(message); + if (hr != S_OK) + { + _logger->Log(LogLevel::Warning, _T("IpcMessage callback failed: 0x%08x"), hr); + } + } +} \ No newline at end of file diff --git a/src/MonitorProfiler/Communication/CommandServer.h b/src/MonitorProfiler/Communication/CommandServer.h new file mode 100644 index 00000000000..323929b3dea --- /dev/null +++ b/src/MonitorProfiler/Communication/CommandServer.h @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#pragma once + +#include "IpcCommServer.h" +#include "Messages.h" +#include +#include +#include +#include +#include "../Logging/Logger.h" +#include "../Utilities/BlockingQueue.h" + +class CommandServer final +{ +public: + CommandServer(const std::shared_ptr& logger); + HRESULT Start(const std::string& path, std::function callback); + void Shutdown(); + +private: + void ListeningThread(); + void ClientProcessingThread(); + + std::atomic_bool _shutdown; + + std::function _callback; + IpcCommServer _server; + + BlockingQueue _clientQueue; + std::shared_ptr _logger; + + std::thread _listeningThread; + std::thread _clientThread; +}; \ No newline at end of file diff --git a/src/MonitorProfiler/Communication/IpcCommClient.cpp b/src/MonitorProfiler/Communication/IpcCommClient.cpp new file mode 100644 index 00000000000..bc46c7df069 --- /dev/null +++ b/src/MonitorProfiler/Communication/IpcCommClient.cpp @@ -0,0 +1,114 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#include "IpcCommClient.h" +#include + +HRESULT IpcCommClient::Receive(IpcMessage& message) +{ + if (_shutdown.load()) + { + return E_UNEXPECTED; + } + if (!_socket.Valid()) + { + return E_UNEXPECTED; + } + + //CONSIDER It is generally more performant to read and buffer larger chunks, in this case we are not expecting very frequent communication. + char buffer[sizeof(MessageType) + sizeof(int)]; + int read = 0; + int offset = 0; + + do + { + int read = recv(_socket, &buffer[offset], sizeof(buffer) - offset, 0); + if (read == 0) + { + return E_ABORT; + } + if (read < 0) + { +#if TARGET_UNIX + if (errno == EINTR) + { + //Signal can interrupt operations. Try again. + continue; + } +#endif + return SocketWrapper::GetSocketError(); + } + offset += read; + + } while (offset < sizeof(buffer)); + + message.MessageType = *reinterpret_cast(buffer); + message.Parameters = *reinterpret_cast(&buffer[sizeof(MessageType)]); + + return S_OK; +} + +HRESULT IpcCommClient::Send(const IpcMessage& message) +{ + if (_shutdown.load()) + { + return E_UNEXPECTED; + } + if (!_socket.Valid()) + { + return E_UNEXPECTED; + } + + char buffer[sizeof(MessageType) + sizeof(int)]; + *reinterpret_cast(buffer) = message.MessageType; + *reinterpret_cast(&buffer[sizeof(MessageType)]) = message.Parameters; + + int sent = 0; + int offset = 0; + do + { + sent = send(_socket, &buffer[offset], sizeof(buffer) - offset, 0); + + if (sent == 0) + { + return E_ABORT; + } + if (sent < 0) + { +#if TARGET_UNIX + if (errno == EINTR) + { + //Signal can interrupt operations. Try again. + continue; + } +#endif + return SocketWrapper::GetSocketError(); + } + offset += sent; + } while (offset < sizeof(buffer)); + + return S_OK; +} + +HRESULT IpcCommClient::Shutdown() +{ + _shutdown.store(true); + int result = shutdown(_socket, +#if TARGET_WINDOWS + SD_BOTH +#else + SHUT_RDWR +#endif + ); + + if (result != 0) + { + return SocketWrapper::GetSocketError(); + } + return S_OK; +} + +IpcCommClient::IpcCommClient(SOCKET socket) : _socket(socket), _shutdown(false) +{ +} diff --git a/src/MonitorProfiler/Communication/IpcCommClient.h b/src/MonitorProfiler/Communication/IpcCommClient.h new file mode 100644 index 00000000000..7ab2f7767a2 --- /dev/null +++ b/src/MonitorProfiler/Communication/IpcCommClient.h @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#pragma once + +#include "SocketWrapper.h" +#include "Messages.h" +#include + +class IpcCommClient +{ + friend class IpcCommServer; +public: + HRESULT Receive(IpcMessage& message); + HRESULT Send(const IpcMessage& message); + HRESULT Shutdown(); + IpcCommClient(SOCKET socket); + +private: + SocketWrapper _socket; + std::atomic_bool _shutdown; +}; diff --git a/src/MonitorProfiler/Communication/IpcCommServer.cpp b/src/MonitorProfiler/Communication/IpcCommServer.cpp new file mode 100644 index 00000000000..6ba9c414cc2 --- /dev/null +++ b/src/MonitorProfiler/Communication/IpcCommServer.cpp @@ -0,0 +1,146 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#include "IpcCommClient.h" +#include "IpcCommServer.h" +#include "../Logging/Logger.h" + +IpcCommServer::IpcCommServer() : _shutdown(false) +{ +} + +IpcCommServer::~IpcCommServer() +{ + //We explicitly run the destructor first so that it can call closesocket prior to deletion of the path. + _domainSocket.~SocketWrapper(); + std::remove(_rootAddress.c_str()); +} + +HRESULT IpcCommServer::Bind(const std::string& rootAddress) +{ + if (_shutdown.load()) + { + return E_UNEXPECTED; + } + + if (_domainSocket.Valid()) + { + return E_UNEXPECTED; + } + + _rootAddress = rootAddress; + + sockaddr_un address; + memset(&address, 0, sizeof(address)); + + if ((rootAddress.length() == 0) || (rootAddress.length() >= sizeof(address.sun_path))) + { + return E_INVALIDARG; + } + + //We don't error check this on purpose + std::remove(rootAddress.c_str()); + + address.sun_family = AF_UNIX; +#if TARGET_WINDOWS + strncpy_s(address.sun_path, rootAddress.c_str(), sizeof(address.sun_path)); +#else + strncpy(address.sun_path, rootAddress.c_str(), sizeof(address.sun_path)); +#endif + _domainSocket = socket(AF_UNIX, SOCK_STREAM, 0); + if (!_domainSocket.Valid()) + { + return SocketWrapper::GetSocketError(); + } + + HRESULT hr; + IfFailRet(_domainSocket.SetBlocking(false)); + + if (bind(_domainSocket, reinterpret_cast(&address), sizeof(address)) != 0) + { + return SocketWrapper::GetSocketError(); + } + if (listen(_domainSocket, Backlog) != 0) + { + return SocketWrapper::GetSocketError(); + } + + return S_OK; +} + +HRESULT IpcCommServer::Accept(std::shared_ptr& client) +{ + if (_shutdown.load()) + { + return E_UNEXPECTED; + } + if (!_domainSocket.Valid()) + { + return E_UNEXPECTED; + } + + int result = 0; + + do + { + fd_set set; + FD_ZERO(&set); + FD_SET(_domainSocket, &set); + + TIMEVAL timeout; + timeout.tv_sec = AcceptTimeoutSeconds; + timeout.tv_usec = 0; + result = select(2, &set, nullptr, nullptr, &timeout); + + if (_shutdown.load()) + { + return E_ABORT; + } + + //0 indicates timeout + if (result < 0) + { +#if TARGET_UNIX + if (errno == EINTR) + { + continue; + } +#endif + return SocketWrapper::GetSocketError(); + } + } while (result <= 0); + + SocketWrapper clientSocket = SocketWrapper(accept(_domainSocket, nullptr, nullptr)); + if (!clientSocket.Valid()) + { + return SocketWrapper::GetSocketError(); + } +#if TARGET_WINDOWS + DWORD receiveTimeout = ReceiveTimeoutMilliseconds; + + HRESULT hr; + + //Windows sockets inherit non-blocking + IfFailRet(clientSocket.SetBlocking(true)); + +#else + TIMEVAL receiveTimeout; + receiveTimeout.tv_sec = ReceiveTimeoutMilliseconds / 1000; + receiveTimeout.tv_usec = 0; +#endif + + if (setsockopt(clientSocket, SOL_SOCKET, SO_RCVTIMEO, reinterpret_cast(&receiveTimeout), sizeof(receiveTimeout)) != 0) + { + return SocketWrapper::GetSocketError(); + } + + client = std::make_shared(clientSocket.Release()); + + return S_OK; +} + +void IpcCommServer::Shutdown() +{ + _shutdown.store(true); +} diff --git a/src/MonitorProfiler/Communication/IpcCommServer.h b/src/MonitorProfiler/Communication/IpcCommServer.h new file mode 100644 index 00000000000..8e3bdcb0b5d --- /dev/null +++ b/src/MonitorProfiler/Communication/IpcCommServer.h @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#pragma once + +#include +#include +#include + +#include "SocketWrapper.h" +#include "IpcCommClient.h" + +class IpcCommServer +{ +public: + IpcCommServer(); + ~IpcCommServer(); + HRESULT Bind(const std::string& rootAddress); + HRESULT Accept(std::shared_ptr& client); + void Shutdown(); +private: + const int ReceiveTimeoutMilliseconds = 10000; + const int AcceptTimeoutSeconds = 3; + const int Backlog = 20; + std::string _rootAddress; + SocketWrapper _domainSocket = 0; + std::atomic_bool _shutdown; +}; \ No newline at end of file diff --git a/src/MonitorProfiler/Communication/Messages.h b/src/MonitorProfiler/Communication/Messages.h new file mode 100644 index 00000000000..c03a959d952 --- /dev/null +++ b/src/MonitorProfiler/Communication/Messages.h @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#pragma once + +enum class MessageType : short +{ + OK, + Error, + Callstack +}; + +struct IpcMessage +{ + MessageType MessageType = MessageType::OK; + int Parameters = 0; +}; \ No newline at end of file diff --git a/src/MonitorProfiler/Communication/SocketWrapper.h b/src/MonitorProfiler/Communication/SocketWrapper.h new file mode 100644 index 00000000000..f42a3adbbdd --- /dev/null +++ b/src/MonitorProfiler/Communication/SocketWrapper.h @@ -0,0 +1,137 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#pragma once + +#if TARGET_WINDOWS +#include +#include +#else +#include +#include +#include +#include +#include +typedef int SOCKET; +typedef struct timeval TIMEVAL; +#endif + +//Includes pal on Linux +#include + +class SocketWrapper +{ +private: + SOCKET _socket; + +public: + SocketWrapper(SOCKET socket) : _socket(socket) + { + } + + SocketWrapper(SocketWrapper&& other) + { + _socket = other._socket; + other._socket = 0; + } + + operator SOCKET const () + { + return _socket; + } + + SOCKET Release() + { + SOCKET s = _socket; + _socket = 0; + return s; + } + + HRESULT SetBlocking(bool blocking) + { +#if TARGET_WINDOWS + u_long blockParameter = blocking ? 0 : 1; //0 == blocking + if (ioctlsocket(_socket, FIONBIO, &blockParameter) != 0) + { + return SocketWrapper::GetSocketError(); + } +#else + int flags = fcntl(_socket, F_GETFD); + if (flags < 0) + { + return SocketWrapper::GetSocketError(); + } + if (blocking) + { + flags &= ~O_NONBLOCK; + } + else + { + flags |= O_NONBLOCK; + } + + if (fcntl(_socket, F_SETFD, flags) != 0) + { + return SocketWrapper::GetSocketError(); + } +#endif + + return S_OK; + } + + static HRESULT GetSocketError() + { +#if TARGET_UNIX + return HRESULT_FROM_WIN32(errno); +#else + return HRESULT_FROM_WIN32(WSAGetLastError()); +#endif + } + + const SocketWrapper& operator = (SocketWrapper&& other) + { + if (&other == this) + { + return *this; + } + + Close(); + _socket = other._socket; + other._socket = 0; + + return *this; + } + + const SocketWrapper& operator = (const SocketWrapper&) = delete; + SocketWrapper(const SocketWrapper&) = delete; + + ~SocketWrapper() + { + Close(); + } + + bool Valid() + { +#if TARGET_UNIX + return _socket > 0; +#else + return _socket != 0 && _socket != INVALID_SOCKET; +#endif + } + +private: + void Close() + { + //Note this should be idempotent. The destructor may be called twice. + if (Valid()) + { +#if TARGET_WINDOWS + closesocket(_socket); +#else + close(_socket); +#endif + _socket = 0; + } + } +}; diff --git a/src/MonitorProfiler/Environment/EnvironmentHelper.cpp b/src/MonitorProfiler/Environment/EnvironmentHelper.cpp index c4bfaf6ae4e..8c1dc830772 100644 --- a/src/MonitorProfiler/Environment/EnvironmentHelper.cpp +++ b/src/MonitorProfiler/Environment/EnvironmentHelper.cpp @@ -40,3 +40,33 @@ HRESULT EnvironmentHelper::SetProductVersion( return S_OK; } + +HRESULT EnvironmentHelper::GetRuntimeInstanceId(const std::shared_ptr& pEnvironment, const std::shared_ptr& pLogger, tstring& instanceId) +{ + HRESULT hr = S_OK; + + IfFailLogRet(pEnvironment->GetEnvironmentVariable(s_wszRuntimeInstanceEnvVar, instanceId)); + + return S_OK; +} + +HRESULT EnvironmentHelper::GetTempFolder(const std::shared_ptr& pEnvironment, const std::shared_ptr& pLogger, tstring& tempFolder) +{ + HRESULT hr = S_OK; + + tstring tmpDir; +#if TARGET_WINDOWS + IfFailLogRet(pEnvironment->GetEnvironmentVariable(s_wszTempEnvVar, tmpDir)); +#else + hr = pEnvironment->GetEnvironmentVariable(s_wszTempEnvVar, tmpDir); +#endif + + if (FAILED(hr)) + { + tmpDir = s_wszDefaultTempFolder; + } + + tempFolder = std::move(tmpDir); + + return S_OK; +} diff --git a/src/MonitorProfiler/Environment/EnvironmentHelper.h b/src/MonitorProfiler/Environment/EnvironmentHelper.h index 12942ea7e26..a0a9cb04979 100644 --- a/src/MonitorProfiler/Environment/EnvironmentHelper.h +++ b/src/MonitorProfiler/Environment/EnvironmentHelper.h @@ -16,6 +16,15 @@ class EnvironmentHelper final private: static constexpr LPCWSTR s_wszDebugLoggerLevelEnvVar = _T("DotnetMonitorProfiler_DebugLogger_Level"); static constexpr LPCWSTR s_wszProfilerVersionEnvVar = _T("DotnetMonitorProfiler_ProductVersion"); + static constexpr LPCWSTR s_wszRuntimeInstanceEnvVar = _T("DotnetMonitorProfiler_InstanceId"); + static constexpr LPCWSTR s_wszDefaultTempFolder = _T("/tmp"); + + static constexpr LPCWSTR s_wszTempEnvVar = +#if TARGET_WINDOWS + _T("TEMP"); +#else + _T("TMPDIR"); +#endif public: /// @@ -31,4 +40,14 @@ class EnvironmentHelper final static HRESULT SetProductVersion( const std::shared_ptr& pEnvironment, const std::shared_ptr& pLogger); + + static HRESULT GetRuntimeInstanceId( + const std::shared_ptr& pEnvironment, + const std::shared_ptr& pLogger, + tstring& instanceId); + + static HRESULT GetTempFolder( + const std::shared_ptr& pEnvironment, + const std::shared_ptr& pLogger, + tstring& tempFolder); }; diff --git a/src/MonitorProfiler/MainProfiler/MainProfiler.cpp b/src/MonitorProfiler/MainProfiler/MainProfiler.cpp index 8954c25bdbc..e20908153d4 100644 --- a/src/MonitorProfiler/MainProfiler/MainProfiler.cpp +++ b/src/MonitorProfiler/MainProfiler/MainProfiler.cpp @@ -9,6 +9,7 @@ #include "../Logging/DebugLogger.h" #include "corhlpr.h" #include "macros.h" +#include using namespace std; @@ -28,10 +29,13 @@ STDMETHODIMP MainProfiler::Initialize(IUnknown *pICorProfilerInfoUnk) HRESULT hr = S_OK; + //These should always be initialized first IfFailRet(ProfilerBase::Initialize(pICorProfilerInfoUnk)); IfFailRet(InitializeEnvironment()); IfFailRet(InitializeLogging()); + IfFailLogRet(InitializeCommandServer()); + // Logging is initialized and can now be used // Set product version environment variable to allow discovery of if the profiler @@ -51,6 +55,8 @@ STDMETHODIMP MainProfiler::Shutdown() { m_pLogger.reset(); m_pEnvironment.reset(); + _commandServer->Shutdown(); + _commandServer.reset(); return ProfilerBase::Shutdown(); } @@ -93,3 +99,42 @@ HRESULT MainProfiler::InitializeLogging() return S_OK; } + +HRESULT MainProfiler::InitializeCommandServer() +{ + HRESULT hr = S_OK; + + //TODO For now we are using the process id to generate the unique server name. We should use the environment + //value with the runtime instance id once it's available. + unsigned long pid = +#if TARGET_WINDOWS + GetCurrentProcessId(); +#else + getpid(); +#endif + + tstring instanceId = to_tstring(to_string(pid)); + //IfFailRet(EnvironmentHelper::GetRuntimeInstanceId(m_pEnvironment, m_pLogger, instanceId)); + +#if TARGET_UNIX + tstring separator = _T("/"); +#else + tstring separator = _T("\\"); +#endif + + tstring tmpDir; + IfFailRet(EnvironmentHelper::GetTempFolder(m_pEnvironment, m_pLogger, tmpDir)); + + _commandServer = std::unique_ptr(new CommandServer(m_pLogger)); + tstring socketPath = tmpDir + separator + instanceId + _T(".sock"); + + IfFailRet(_commandServer->Start(to_string(socketPath), [this](const IpcMessage& message)-> HRESULT { return this->MessageCallback(message); })); + + return S_OK; +} + +HRESULT MainProfiler::MessageCallback(const IpcMessage& message) +{ + m_pLogger->Log(LogLevel::Information, _T("Message received from client: %d %d"), message.MessageType, message.Parameters); + return S_OK; +} diff --git a/src/MonitorProfiler/MainProfiler/MainProfiler.h b/src/MonitorProfiler/MainProfiler/MainProfiler.h index 7ebbf7e2ddf..9836f0335f6 100644 --- a/src/MonitorProfiler/MainProfiler/MainProfiler.h +++ b/src/MonitorProfiler/MainProfiler/MainProfiler.h @@ -7,6 +7,7 @@ #include "../ProfilerBase.h" #include "../Environment/Environment.h" #include "../Logging/Logger.h" +#include "../Communication/CommandServer.h" #include class MainProfiler final : @@ -26,4 +27,8 @@ class MainProfiler final : private: HRESULT InitializeEnvironment(); HRESULT InitializeLogging(); + HRESULT InitializeCommandServer(); + HRESULT MessageCallback(const IpcMessage& message); +private: + std::unique_ptr _commandServer; }; diff --git a/src/MonitorProfiler/Utilities/BlockingQueue.h b/src/MonitorProfiler/Utilities/BlockingQueue.h new file mode 100644 index 00000000000..96d4128fa18 --- /dev/null +++ b/src/MonitorProfiler/Utilities/BlockingQueue.h @@ -0,0 +1,58 @@ +#// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#include +#include +#include + +template +class BlockingQueue final +{ +public: + HRESULT Enqueue(const T& item) + { + { + std::lock_guard lock(_mutex); + if (_complete) + { + return E_UNEXPECTED; + } + _queue.push(item); + } + _condition.notify_all(); + + return S_OK; + } + + HRESULT BlockingDequeue(T& item) + { + std::unique_lock lock(_mutex); + _condition.wait(lock, [this]() { return !_queue.empty() || _complete; }); + + //We can't really tell if the caller wants to drain the remaining entries or simply abandon the queue + if (!_queue.empty()) + { + item = _queue.front(); + _queue.pop(); + return _complete ? S_FALSE : S_OK; + } + + return E_FAIL; + } + + void Complete() + { + { + std::lock_guard lock(_mutex); + _complete = true; + } + _condition.notify_all(); + } + +private: + std::queue _queue; + std::mutex _mutex; + std::condition_variable _condition; + bool _complete = false; +}; \ No newline at end of file From 4c8cf42d28ccbc6ee0a3a5fa2f4bc4b6164ce32c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 24 May 2022 16:20:47 +0000 Subject: [PATCH 60/71] Update dependencies from https://github.com/dotnet/symstore build 20220523.1 (#1919) [main] Update dependencies from dotnet/symstore --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0e30eef3d60..49d67d94bae 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -26,9 +26,9 @@ https://github.com/dotnet/arcade ad55f9b957b9539613ecff82649d17650e4624d2 - + https://github.com/dotnet/symstore - 073abc4f492cbc6795989e4a813b0d32017a8623 + adf3d62fe38ae79afe7ac3da7db13ddba601279a https://github.com/dotnet/runtime diff --git a/eng/Versions.props b/eng/Versions.props index 299a80a6d90..190a87fb80c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -54,7 +54,7 @@ 7.0.0-preview.5.22272.3 7.0.0-preview.5.22272.3 - 1.0.326601 + 1.0.327301 3.1.25 From 15c19e3e8b011d2642694507c214e6644e407fb1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 25 May 2022 12:58:55 +0000 Subject: [PATCH 61/71] Update dependencies from https://github.com/dotnet/diagnostics build 20220524.1 (#1922) [main] Update dependencies from dotnet/diagnostics --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 49d67d94bae..ad61eef4a91 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,13 +4,13 @@ https://github.com/dotnet/command-line-api 166610c56ff732093f0145a2911d4f6c40b786da - + https://github.com/dotnet/diagnostics - e5ba58f4957213ba79aec25a4bb7f8afb18c19a7 + 5857722a5b23ebad9a1115af9cd516bf26a11c04 - + https://github.com/dotnet/diagnostics - e5ba58f4957213ba79aec25a4bb7f8afb18c19a7 + 5857722a5b23ebad9a1115af9cd516bf26a11c04 diff --git a/eng/Versions.props b/eng/Versions.props index 190a87fb80c..12d11f6e0dd 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -48,8 +48,8 @@ 7.0.0-preview.5.22274.1 7.0.0-preview.5.22274.1 - 5.0.0-preview.22273.1 - 5.0.0-preview.22273.1 + 5.0.0-preview.22274.1 + 5.0.0-preview.22274.1 7.0.0-preview.5.22272.3 7.0.0-preview.5.22272.3 From e92cf1355068cb79936bdb5d149476de22697beb Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 25 May 2022 13:59:39 +0000 Subject: [PATCH 62/71] Update dependencies from https://github.com/dotnet/aspnetcore build 20220524.9 (#1924) [main] Update dependencies from dotnet/aspnetcore --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ad61eef4a91..cc4196036cf 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,9 +14,9 @@ - + https://github.com/dotnet/aspnetcore - 5ff6e316a8e34bb06b986ec13ec7aae3f61e886b + 19d21ad0d209b5c7be6387c7db3cf202c91951af https://github.com/dotnet/arcade @@ -34,9 +34,9 @@ https://github.com/dotnet/runtime 0864cc5539e0ddd109b443b0bee804878cd7ba76 - + https://github.com/dotnet/aspnetcore - 5ff6e316a8e34bb06b986ec13ec7aae3f61e886b + 19d21ad0d209b5c7be6387c7db3cf202c91951af https://github.com/dotnet/runtime diff --git a/eng/Versions.props b/eng/Versions.props index 12d11f6e0dd..07f7acf5eb0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -45,8 +45,8 @@ 7.0.0-beta.22273.1 - 7.0.0-preview.5.22274.1 - 7.0.0-preview.5.22274.1 + 7.0.0-preview.6.22274.9 + 7.0.0-preview.6.22274.9 5.0.0-preview.22274.1 5.0.0-preview.22274.1 From 992d7cce688a8e8d45aee5fe7a3876341a68344c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 25 May 2022 16:14:52 +0000 Subject: [PATCH 63/71] Update dependencies from https://github.com/dotnet/arcade build 20220524.7 (#1923) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index cc4196036cf..e7cf162c218 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -18,13 +18,13 @@ https://github.com/dotnet/aspnetcore 19d21ad0d209b5c7be6387c7db3cf202c91951af - + https://github.com/dotnet/arcade - ad55f9b957b9539613ecff82649d17650e4624d2 + 007adcd66f519c3c96fa0ecc21ed197a6da9e015 - + https://github.com/dotnet/arcade - ad55f9b957b9539613ecff82649d17650e4624d2 + 007adcd66f519c3c96fa0ecc21ed197a6da9e015 https://github.com/dotnet/symstore diff --git a/eng/Versions.props b/eng/Versions.props index 07f7acf5eb0..7b02cf8cc06 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -43,7 +43,7 @@ --> - 7.0.0-beta.22273.1 + 7.0.0-beta.22274.7 7.0.0-preview.6.22274.9 7.0.0-preview.6.22274.9 diff --git a/global.json b/global.json index 2f3c97a80c9..431982bc19a 100644 --- a/global.json +++ b/global.json @@ -18,6 +18,6 @@ }, "msbuild-sdks": { "Microsoft.Build.NoTargets": "2.0.1", - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22273.1" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22274.7" } } From d88d645cf3f1bd1b1253894983fd9a80813561af Mon Sep 17 00:00:00 2001 From: Wiktor Kopec Date: Wed, 25 May 2022 22:00:52 -0700 Subject: [PATCH 64/71] Add support for Managed Identity authentication for egress. (#1884) (#1928) * Add support for Managed Identity authentication for egress. * PR feedback * Fix test baselines --- documentation/configuration.md | 1 + documentation/schema.json | 7 +++ eng/Versions.props | 1 + ...AzureBlobEgressProviderOptions.Validate.cs | 9 ++-- .../AzureBlobEgressProviderOptions.cs | 5 ++ .../OptionsDisplayStrings.Designer.cs | 27 ++++++---- .../OptionsDisplayStrings.resx | 14 ++++-- .../Operation/EgressOperationService.cs | 15 ++++-- .../EgressRedacted.json | 3 +- .../EgressRedacted.json | 3 +- .../dotnet-monitor/ConfigurationJsonWriter.cs | 1 + .../AzureBlob/AzureBlobEgressProvider.cs | 49 ++++++++++++++++++- src/Tools/dotnet-monitor/Strings.Designer.cs | 6 +-- src/Tools/dotnet-monitor/Strings.resx | 6 +-- .../dotnet-monitor/dotnet-monitor.csproj | 1 + 15 files changed, 116 insertions(+), 32 deletions(-) diff --git a/documentation/configuration.md b/documentation/configuration.md index f0dfe02de2c..19d6cbffd34 100644 --- a/documentation/configuration.md +++ b/documentation/configuration.md @@ -719,6 +719,7 @@ In addition to enabling custom providers, `dotnet monitor` also allows you to di | accountKey | string | false | The account key used to access the Azure blob storage account; must be specified if `accountKeyName` is not specified.| | sharedAccessSignature | string | false | The shared access signature (SAS) used to access the azure blob storage account; if using SAS, must be specified if `sharedAccessSignatureName` is not specified.| | accountKeyName | string | false | Name of the property in the Properties section that will contain the account key; must be specified if `accountKey` is not specified.| +| managedIdentityClientId | string | false | The ClientId of the ManagedIdentity that can be used to authorize egress. Note this identity must be used by the hosting environment (such as Kubernetes) and must also have a Storage role with appropriate permissions. | | sharedAccessSignatureName | string | false | Name of the property in the Properties section that will contain the SAS token; if using SAS, must be specified if `sharedAccessSignature` is not specified.| | queueName | string | false | The name of the queue to which a message will be dispatched upon writing to a blob.| | queueAccountUri | string | false | The URI of the Azure queue account.| diff --git a/documentation/schema.json b/documentation/schema.json index dba3dc0bd82..252561e608e 100644 --- a/documentation/schema.json +++ b/documentation/schema.json @@ -988,6 +988,13 @@ ], "description": "The name of the shared access signature (SAS) used to look up the value from the Egress options Properties map." }, + "ManagedIdentityClientId": { + "type": [ + "null", + "string" + ], + "description": "Client id of the Managed Identity used for authentication. The identity must have permissions to create containers and write to blob storage." + }, "ContainerName": { "type": "string", "description": "The name of the container to which the blob will be egressed. If egressing to the root container, use the \"$root\" sentinel value.", diff --git a/eng/Versions.props b/eng/Versions.props index 7b02cf8cc06..4506e5ea333 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -67,6 +67,7 @@ $(MicrosoftAspNetCoreAppRuntimewinx64Version) + 1.6.0 12.12.0 12.10.0 6.0.5 diff --git a/src/Microsoft.Diagnostics.Monitoring.Options/AzureBlobEgressProviderOptions.Validate.cs b/src/Microsoft.Diagnostics.Monitoring.Options/AzureBlobEgressProviderOptions.Validate.cs index ce7da1d8bc8..77c77149641 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Options/AzureBlobEgressProviderOptions.Validate.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Options/AzureBlobEgressProviderOptions.Validate.cs @@ -13,21 +13,22 @@ internal sealed partial class AzureBlobEgressProviderOptions : { /// /// Provides extra validation to ensure that either the - /// or the have been set. + /// , , or have been set. /// IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { IList results = new List(); // One of the authentication keys/tokens is required - if (string.IsNullOrEmpty(AccountKey) && string.IsNullOrEmpty(SharedAccessSignature)) + if (string.IsNullOrEmpty(AccountKey) && string.IsNullOrEmpty(SharedAccessSignature) && string.IsNullOrEmpty(ManagedIdentityClientId)) { results.Add( new ValidationResult( string.Format( - OptionsDisplayStrings.ErrorMessage_TwoFieldsMissing, + OptionsDisplayStrings.ErrorMessage_CredentialsMissing, nameof(AccountKey), - nameof(SharedAccessSignature)))); + nameof(SharedAccessSignature), + nameof(ManagedIdentityClientId)))); } return results; diff --git a/src/Microsoft.Diagnostics.Monitoring.Options/AzureBlobEgressProviderOptions.cs b/src/Microsoft.Diagnostics.Monitoring.Options/AzureBlobEgressProviderOptions.cs index 2fa43adcf95..f428d440fcf 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Options/AzureBlobEgressProviderOptions.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Options/AzureBlobEgressProviderOptions.cs @@ -40,6 +40,11 @@ internal sealed partial class AzureBlobEgressProviderOptions : Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_AzureBlobEgressProviderOptions_SharedAccessSignatureName))] public string SharedAccessSignatureName { get; set; } + [Display( + ResourceType = typeof(OptionsDisplayStrings), + Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_AzureBlobEgressProviderOptions_ManagedIdentityClientId))] + public string ManagedIdentityClientId { get; set; } + [Display( ResourceType = typeof(OptionsDisplayStrings), Description = nameof(OptionsDisplayStrings.DisplayAttributeDescription_AzureBlobEgressProviderOptions_ContainerName))] diff --git a/src/Microsoft.Diagnostics.Monitoring.Options/OptionsDisplayStrings.Designer.cs b/src/Microsoft.Diagnostics.Monitoring.Options/OptionsDisplayStrings.Designer.cs index a2a9a543f48..9fe20e24497 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Options/OptionsDisplayStrings.Designer.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Options/OptionsDisplayStrings.Designer.cs @@ -240,6 +240,16 @@ public static string DisplayAttributeDescription_AzureBlobEgressProviderOptions_ } } + /// + /// Looks up a localized string similar to Client id of the Managed Identity used for authentication. The identity must have permissions to create containers and write to blob storage.. + /// + public static string DisplayAttributeDescription_AzureBlobEgressProviderOptions_ManagedIdentityClientId { + get { + return ResourceManager.GetString("DisplayAttributeDescription_AzureBlobEgressProviderOptions_ManagedIdentityClientI" + + "d", resourceCulture); + } + } + /// /// Looks up a localized string similar to The URI of the Azure queue account.. /// @@ -1262,6 +1272,14 @@ public static string DisplayAttributeDescription_ThreadpoolQueueLengthOptions_Le } } + /// Looks up a localized string similar to The {0} field, {1} field, or {2} field is required.. + /// + public static string ErrorMessage_CredentialsMissing { + get { + return ResourceManager.GetString("ErrorMessage_CredentialsMissing", resourceCulture); + } + } + /// /// Looks up a localized string similar to A value is required for the process filter.. /// @@ -1306,14 +1324,5 @@ public static string ErrorMessage_StatusCodesRegularExpressionDoesNotMatch { return ResourceManager.GetString("ErrorMessage_StatusCodesRegularExpressionDoesNotMatch", resourceCulture); } } - - /// - /// Looks up a localized string similar to The {0} field or the {1} field is required.. - /// - public static string ErrorMessage_TwoFieldsMissing { - get { - return ResourceManager.GetString("ErrorMessage_TwoFieldsMissing", resourceCulture); - } - } } } diff --git a/src/Microsoft.Diagnostics.Monitoring.Options/OptionsDisplayStrings.resx b/src/Microsoft.Diagnostics.Monitoring.Options/OptionsDisplayStrings.resx index d23e0fba9b6..154d6035ce1 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Options/OptionsDisplayStrings.resx +++ b/src/Microsoft.Diagnostics.Monitoring.Options/OptionsDisplayStrings.resx @@ -529,12 +529,13 @@ The location for temporary dump files. Defaults to the temp folder. The description provided for the DumpTempFolder parameter on StorageOptions. - - The {0} field or the {1} field is required. - Gets the format string for rejecting validation due to 2 missing fields where at least one is required. -2 Format Parameters: + + The {0} field, {1} field, or {2} field is required. + Gets the format string for rejecting validation due to 3 missing fields where at least one is required. +3 Format Parameters: 0. fieldNameOne: The name of the first field that is missing -1. fieldNameTwo: The name of the second field that is missing +1. fieldNameTwo: The name of the second field that is missing +2. fieldNameThree: The name of the third field that is missing The format of the logs artifact. @@ -677,4 +678,7 @@ The threshold level the counter must maintain (or lower) for the specified duration. If LessThan is specified, the default value of GreaterThan becomes null. The description provided for the LessThan parameter on ThreadpoolQueueLengthOptions. + + Client id of the Managed Identity used for authentication. The identity must have permissions to create containers and write to blob storage. + \ No newline at end of file diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/Operation/EgressOperationService.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/Operation/EgressOperationService.cs index 39d5f4decf1..31f0e84d018 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/Operation/EgressOperationService.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/Operation/EgressOperationService.cs @@ -47,11 +47,18 @@ private async Task ExecuteEgressOperation(EgressRequest egressRequest, Cancellat CancellationToken token = linkedTokenSource.Token; token.ThrowIfCancellationRequested(); - var result = await egressRequest.EgressOperation.ExecuteAsync(_serviceProvider, token); + try + { + var result = await egressRequest.EgressOperation.ExecuteAsync(_serviceProvider, token); - //It is possible that this operation never completes, due to infinite duration operations. - - _operationsStore.CompleteOperation(egressRequest.OperationId, result); + //It is possible that this operation never completes, due to infinite duration operations. + _operationsStore.CompleteOperation(egressRequest.OperationId, result); + } + //This is unexpected, but an unhandled exception should still fail the operation. + catch (Exception e) when (!(e is OperationCanceledException)) + { + _operationsStore.CompleteOperation(egressRequest.OperationId, ExecutionResult.Failed(e)); + } } } } diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedConfigurations/EgressRedacted.json b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedConfigurations/EgressRedacted.json index 117d636d057..294b94d8b97 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedConfigurations/EgressRedacted.json +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedConfigurations/EgressRedacted.json @@ -13,7 +13,8 @@ "SharedAccessSignature": ":NOT PRESENT:", "AccountKey": ":NOT PRESENT:", "SharedAccessSignatureName": ":NOT PRESENT:", - "AccountKeyName": "MonitorBlobAccountKey" + "AccountKeyName": "MonitorBlobAccountKey", + "ManagedIdentityClientId": ":NOT PRESENT:" } }, "FileSystem": { diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedShowSourcesConfigurations/EgressRedacted.json b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedShowSourcesConfigurations/EgressRedacted.json index 3d1759cb59a..44dd1093cda 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedShowSourcesConfigurations/EgressRedacted.json +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests/ExpectedShowSourcesConfigurations/EgressRedacted.json @@ -13,7 +13,8 @@ "SharedAccessSignature": ":NOT PRESENT:", "AccountKey": ":NOT PRESENT:", "SharedAccessSignatureName": ":NOT PRESENT:", - "AccountKeyName": "MonitorBlobAccountKey" /*JsonConfigurationProvider for 'settings.json' (Optional)*/ + "AccountKeyName": "MonitorBlobAccountKey" /*JsonConfigurationProvider for 'settings.json' (Optional)*/, + "ManagedIdentityClientId": ":NOT PRESENT:" } }, "FileSystem": { diff --git a/src/Tools/dotnet-monitor/ConfigurationJsonWriter.cs b/src/Tools/dotnet-monitor/ConfigurationJsonWriter.cs index 5c89a2c5fd6..80bd3a7a9cc 100644 --- a/src/Tools/dotnet-monitor/ConfigurationJsonWriter.cs +++ b/src/Tools/dotnet-monitor/ConfigurationJsonWriter.cs @@ -147,6 +147,7 @@ private void ProcessEgressSection(IConfiguration egress, bool skipNotPresent, bo ProcessChildSection(optionsSection, nameof(AzureBlobEgressProviderOptions.AccountKey), skipNotPresent, includeChildSections: false, redact: true, showSources: showSources); ProcessChildSection(optionsSection, nameof(AzureBlobEgressProviderOptions.SharedAccessSignatureName), skipNotPresent, includeChildSections: false, redact: false, showSources: showSources); ProcessChildSection(optionsSection, nameof(AzureBlobEgressProviderOptions.AccountKeyName), skipNotPresent, includeChildSections: false, redact: false, showSources: showSources); + ProcessChildSection(optionsSection, nameof(AzureBlobEgressProviderOptions.ManagedIdentityClientId), skipNotPresent, includeChildSections: false, redact: false, showSources: showSources); } } } diff --git a/src/Tools/dotnet-monitor/Egress/AzureBlob/AzureBlobEgressProvider.cs b/src/Tools/dotnet-monitor/Egress/AzureBlob/AzureBlobEgressProvider.cs index 68627576607..74fc8e00dee 100644 --- a/src/Tools/dotnet-monitor/Egress/AzureBlob/AzureBlobEgressProvider.cs +++ b/src/Tools/dotnet-monitor/Egress/AzureBlob/AzureBlobEgressProvider.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using Azure; +using Azure.Identity; using Azure.Storage; using Azure.Storage.Blobs; using Azure.Storage.Blobs.Models; @@ -73,6 +74,10 @@ public override async Task EgressAsync( { throw CreateException(ex); } + catch (CredentialUnavailableException ex) + { + throw CreateException(ex); + } } public override async Task EgressAsync( @@ -134,6 +139,10 @@ public override async Task EgressAsync( { throw CreateException(ex); } + catch (CredentialUnavailableException ex) + { + throw CreateException(ex); + } } private bool CheckQueueEgressOptions(AzureBlobEgressProviderOptions options) @@ -222,9 +231,18 @@ private async Task GetQueueClientAsync(AzureBlobEgressProviderOptio serviceClient = new QueueServiceClient(accountUri, credential, clientOptions); } + else if (!string.IsNullOrEmpty(options.ManagedIdentityClientId)) + { + // Remove Query in case SAS token was specified + Uri accountUri = GetQueueAccountUri(options, out _); + + DefaultAzureCredential credential = CreateManagedIdentityCredentials(options.ManagedIdentityClientId); + + serviceClient = new QueueServiceClient(accountUri, credential, clientOptions); + } else { - throw CreateException(Strings.ErrorMessage_EgressMissingSasOrKey); + throw CreateException(Strings.ErrorMessage_EgressMissingCredentials); } QueueClient queueClient = serviceClient.GetQueueClient(options.QueueName); @@ -262,9 +280,18 @@ private async Task GetBlobContainerClientAsync(AzureBlobEgr serviceClient = new BlobServiceClient(accountUri, credential); } + else if (!string.IsNullOrEmpty(options.ManagedIdentityClientId)) + { + // Remove Query in case SAS token was specified + Uri accountUri = GetBlobAccountUri(options, out _); + + DefaultAzureCredential credential = CreateManagedIdentityCredentials(options.ManagedIdentityClientId); + + serviceClient = new BlobServiceClient(accountUri, credential); + } else { - throw CreateException(Strings.ErrorMessage_EgressMissingSasOrKey); + throw CreateException(Strings.ErrorMessage_EgressMissingCredentials); } BlobContainerClient containerClient = serviceClient.GetBlobContainerClient(options.ContainerName); @@ -324,5 +351,23 @@ private static string WrapMessage(string innerMessage) return Strings.ErrorMessage_EgressAzureFailedGeneric; } } + + private static DefaultAzureCredential CreateManagedIdentityCredentials(string clientId) + { + var credential = new DefaultAzureCredential( + new DefaultAzureCredentialOptions + { + ManagedIdentityClientId = clientId, + ExcludeAzureCliCredential = true, + ExcludeAzurePowerShellCredential = true, + ExcludeEnvironmentCredential = true, + ExcludeInteractiveBrowserCredential = true, + ExcludeSharedTokenCacheCredential = true, + ExcludeVisualStudioCodeCredential = true, + ExcludeVisualStudioCredential = true + }); + + return credential; + } } } diff --git a/src/Tools/dotnet-monitor/Strings.Designer.cs b/src/Tools/dotnet-monitor/Strings.Designer.cs index 34befa5d0d0..b971ca6dddc 100644 --- a/src/Tools/dotnet-monitor/Strings.Designer.cs +++ b/src/Tools/dotnet-monitor/Strings.Designer.cs @@ -142,11 +142,11 @@ internal static string ErrorMessage_EgressFileFailedGeneric { } /// - /// Looks up a localized string similar to SharedAccessSignature or AccountKey must be specified.. + /// Looks up a localized string similar to SharedAccessSignature, AccountKey, or ManagedIdentityClientId must be specified.. /// - internal static string ErrorMessage_EgressMissingSasOrKey { + internal static string ErrorMessage_EgressMissingCredentials { get { - return ResourceManager.GetString("ErrorMessage_EgressMissingSasOrKey", resourceCulture); + return ResourceManager.GetString("ErrorMessage_EgressMissingCredentials", resourceCulture); } } diff --git a/src/Tools/dotnet-monitor/Strings.resx b/src/Tools/dotnet-monitor/Strings.resx index c4ea56bd357..cc08e8249b7 100644 --- a/src/Tools/dotnet-monitor/Strings.resx +++ b/src/Tools/dotnet-monitor/Strings.resx @@ -156,9 +156,9 @@ File system egress failed. Gets a string similar to "File system egress failed.". - - SharedAccessSignature or AccountKey must be specified. - Gets a string similar to "SharedAccessSignature or AccountKey must be specified.". + + SharedAccessSignature, AccountKey, or ManagedIdentityClientId must be specified. + Gets a string similar to "SharedAccessSignature, AccountKey, or ManagedIdentityClientId must be specified.". Egress provider '{0}' does not exist. diff --git a/src/Tools/dotnet-monitor/dotnet-monitor.csproj b/src/Tools/dotnet-monitor/dotnet-monitor.csproj index 159ad81273a..44f1a325192 100644 --- a/src/Tools/dotnet-monitor/dotnet-monitor.csproj +++ b/src/Tools/dotnet-monitor/dotnet-monitor.csproj @@ -13,6 +13,7 @@ + From 6a35f15c3d6b8b575d731ba04f57dbbb91a6ce48 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 26 May 2022 12:57:15 +0000 Subject: [PATCH 65/71] Update dependencies from https://github.com/dotnet/diagnostics build 20220525.1 (#1929) [main] Update dependencies from dotnet/diagnostics --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e7cf162c218..f3a93acbf32 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,13 +4,13 @@ https://github.com/dotnet/command-line-api 166610c56ff732093f0145a2911d4f6c40b786da - + https://github.com/dotnet/diagnostics - 5857722a5b23ebad9a1115af9cd516bf26a11c04 + a29569b3f85589bd69bf76976e95fe962dc66eef - + https://github.com/dotnet/diagnostics - 5857722a5b23ebad9a1115af9cd516bf26a11c04 + a29569b3f85589bd69bf76976e95fe962dc66eef diff --git a/eng/Versions.props b/eng/Versions.props index 4506e5ea333..854451549c0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -48,8 +48,8 @@ 7.0.0-preview.6.22274.9 7.0.0-preview.6.22274.9 - 5.0.0-preview.22274.1 - 5.0.0-preview.22274.1 + 5.0.0-preview.22275.1 + 5.0.0-preview.22275.1 7.0.0-preview.5.22272.3 7.0.0-preview.5.22272.3 From 9108da74145d48927640b064af29bd8611559ed0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 26 May 2022 13:02:17 +0000 Subject: [PATCH 66/71] Update dependencies from https://github.com/dotnet/arcade build 20220525.2 (#1930) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f3a93acbf32..a38ed705dbb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -18,13 +18,13 @@ https://github.com/dotnet/aspnetcore 19d21ad0d209b5c7be6387c7db3cf202c91951af - + https://github.com/dotnet/arcade - 007adcd66f519c3c96fa0ecc21ed197a6da9e015 + a8aae93d709533604b73c619268415c6ccc71292 - + https://github.com/dotnet/arcade - 007adcd66f519c3c96fa0ecc21ed197a6da9e015 + a8aae93d709533604b73c619268415c6ccc71292 https://github.com/dotnet/symstore diff --git a/eng/Versions.props b/eng/Versions.props index 854451549c0..f9982e4f136 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -43,7 +43,7 @@ --> - 7.0.0-beta.22274.7 + 7.0.0-beta.22275.2 7.0.0-preview.6.22274.9 7.0.0-preview.6.22274.9 diff --git a/global.json b/global.json index 431982bc19a..fe45eeb267f 100644 --- a/global.json +++ b/global.json @@ -18,6 +18,6 @@ }, "msbuild-sdks": { "Microsoft.Build.NoTargets": "2.0.1", - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22274.7" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22275.2" } } From 3210468658203565404887290ed03c593176874a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 26 May 2022 13:44:25 +0000 Subject: [PATCH 67/71] Update dependencies from https://github.com/dotnet/aspnetcore build 20220525.2 (#1931) [main] Update dependencies from dotnet/aspnetcore - Coherency Updates: - Microsoft.NETCore.App.Runtime.win-x64: from 7.0.0-preview.5.22272.3 to 7.0.0-preview.5.22274.8 (parent: Microsoft.AspNetCore.App.Runtime.win-x64) - VS.Redist.Common.NetCore.SharedFramework.x64.7.0: from 7.0.0-preview.5.22272.3 to 7.0.0-preview.5.22274.8 (parent: VS.Redist.Common.AspNetCore.SharedFramework.x64.7.0) --- eng/Version.Details.xml | 16 ++++++++-------- eng/Versions.props | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a38ed705dbb..fc42905ef36 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,9 +14,9 @@ - + https://github.com/dotnet/aspnetcore - 19d21ad0d209b5c7be6387c7db3cf202c91951af + c983855ccccb1324a7635c1b08bde89aeb699ef0 https://github.com/dotnet/arcade @@ -30,17 +30,17 @@ https://github.com/dotnet/symstore adf3d62fe38ae79afe7ac3da7db13ddba601279a - + https://github.com/dotnet/runtime - 0864cc5539e0ddd109b443b0bee804878cd7ba76 + 69679789fba3c377b1d14689ebab2e30a9f9ad8a - + https://github.com/dotnet/aspnetcore - 19d21ad0d209b5c7be6387c7db3cf202c91951af + c983855ccccb1324a7635c1b08bde89aeb699ef0 - + https://github.com/dotnet/runtime - 0864cc5539e0ddd109b443b0bee804878cd7ba76 + 69679789fba3c377b1d14689ebab2e30a9f9ad8a diff --git a/eng/Versions.props b/eng/Versions.props index f9982e4f136..88c59729c16 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -45,14 +45,14 @@ 7.0.0-beta.22275.2 - 7.0.0-preview.6.22274.9 - 7.0.0-preview.6.22274.9 + 7.0.0-preview.6.22275.2 + 7.0.0-preview.6.22275.2 5.0.0-preview.22275.1 5.0.0-preview.22275.1 - 7.0.0-preview.5.22272.3 - 7.0.0-preview.5.22272.3 + 7.0.0-preview.5.22274.8 + 7.0.0-preview.5.22274.8 1.0.327301 From de09c95d11b0dce903213e19a05f5d999cc59f91 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 27 May 2022 12:51:28 +0000 Subject: [PATCH 68/71] Update dependencies from https://github.com/dotnet/diagnostics build 20220526.1 (#1936) [main] Update dependencies from dotnet/diagnostics --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fc42905ef36..b58e2dc54fb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,11 +4,11 @@ https://github.com/dotnet/command-line-api 166610c56ff732093f0145a2911d4f6c40b786da - + https://github.com/dotnet/diagnostics a29569b3f85589bd69bf76976e95fe962dc66eef - + https://github.com/dotnet/diagnostics a29569b3f85589bd69bf76976e95fe962dc66eef diff --git a/eng/Versions.props b/eng/Versions.props index 88c59729c16..7b8c56985bb 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -48,8 +48,8 @@ 7.0.0-preview.6.22275.2 7.0.0-preview.6.22275.2 - 5.0.0-preview.22275.1 - 5.0.0-preview.22275.1 + 5.0.0-preview.22276.1 + 5.0.0-preview.22276.1 7.0.0-preview.5.22274.8 7.0.0-preview.5.22274.8 From 7d12cd62a8e5c4be7904e755de8bb2f75eefe3f5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 27 May 2022 13:00:18 +0000 Subject: [PATCH 69/71] Update dependencies from https://github.com/dotnet/arcade build 20220526.1 (#1937) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b58e2dc54fb..2d75cfbcfd4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -18,13 +18,13 @@ https://github.com/dotnet/aspnetcore c983855ccccb1324a7635c1b08bde89aeb699ef0 - + https://github.com/dotnet/arcade - a8aae93d709533604b73c619268415c6ccc71292 + b8b67b243ba93bf9b89390c85b4dee034d3c5609 - + https://github.com/dotnet/arcade - a8aae93d709533604b73c619268415c6ccc71292 + b8b67b243ba93bf9b89390c85b4dee034d3c5609 https://github.com/dotnet/symstore diff --git a/eng/Versions.props b/eng/Versions.props index 7b8c56985bb..7613b9a3a70 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -43,7 +43,7 @@ --> - 7.0.0-beta.22275.2 + 7.0.0-beta.22276.1 7.0.0-preview.6.22275.2 7.0.0-preview.6.22275.2 diff --git a/global.json b/global.json index fe45eeb267f..dd92c194893 100644 --- a/global.json +++ b/global.json @@ -18,6 +18,6 @@ }, "msbuild-sdks": { "Microsoft.Build.NoTargets": "2.0.1", - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22275.2" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22276.1" } } From 3f7cd501961e79d3f479ddbc804c27b1e596ef83 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 27 May 2022 13:33:10 +0000 Subject: [PATCH 70/71] Update dependencies from https://github.com/dotnet/aspnetcore build 20220526.1 (#1938) [main] Update dependencies from dotnet/aspnetcore --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2d75cfbcfd4..110fa410357 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -14,9 +14,9 @@ - + https://github.com/dotnet/aspnetcore - c983855ccccb1324a7635c1b08bde89aeb699ef0 + dd11b0e1aaf274b2049e56c35466ad06d684298b https://github.com/dotnet/arcade @@ -34,9 +34,9 @@ https://github.com/dotnet/runtime 69679789fba3c377b1d14689ebab2e30a9f9ad8a - + https://github.com/dotnet/aspnetcore - c983855ccccb1324a7635c1b08bde89aeb699ef0 + dd11b0e1aaf274b2049e56c35466ad06d684298b https://github.com/dotnet/runtime diff --git a/eng/Versions.props b/eng/Versions.props index 7613b9a3a70..009965bb1a2 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -45,8 +45,8 @@ 7.0.0-beta.22276.1 - 7.0.0-preview.6.22275.2 - 7.0.0-preview.6.22275.2 + 7.0.0-preview.6.22276.1 + 7.0.0-preview.6.22276.1 5.0.0-preview.22276.1 5.0.0-preview.22276.1 From 2ba1f5e44635c27fdfde49682287468c1b661998 Mon Sep 17 00:00:00 2001 From: Patrick Fenelon Date: Fri, 27 May 2022 14:12:27 -0700 Subject: [PATCH 71/71] Fix missing ',' in LoggingEventIds declaration --- src/Tools/dotnet-monitor/LoggingEventIds.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tools/dotnet-monitor/LoggingEventIds.cs b/src/Tools/dotnet-monitor/LoggingEventIds.cs index 6be92d1d74f..02e2ef7bdf2 100644 --- a/src/Tools/dotnet-monitor/LoggingEventIds.cs +++ b/src/Tools/dotnet-monitor/LoggingEventIds.cs @@ -75,7 +75,7 @@ internal enum LoggingEventIds ExtensionProbeStart = 62, ExtensionProbeRepo = 63, ExtensionProbeSucceeded = 64, - ExtensionProbeFailed = 65 + ExtensionProbeFailed = 65, ExtensionStarting = 66, ExtensionConfigured = 67, ExtensionEgressPayloadCompleted = 68,