From 8c29beb46b3d45c0f8fc3ae5fffd3775d04d4101 Mon Sep 17 00:00:00 2001 From: Ed Chapel Date: Mon, 9 Sep 2013 20:23:06 +0200 Subject: [PATCH 1/7] vNext: 1.0.10 --- build/versions.targets | 2 +- src/Common/CommonAssemblyInfo.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/versions.targets b/build/versions.targets index 4bed4ba..d95248b 100644 --- a/build/versions.targets +++ b/build/versions.targets @@ -3,7 +3,7 @@ 1 0 - 9 + 10 diff --git a/src/Common/CommonAssemblyInfo.cs b/src/Common/CommonAssemblyInfo.cs index 6681236..658dfce 100644 --- a/src/Common/CommonAssemblyInfo.cs +++ b/src/Common/CommonAssemblyInfo.cs @@ -7,6 +7,6 @@ [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] -[assembly: AssemblyVersion("1.0.9")] -[assembly: AssemblyFileVersion("1.0.9")] -[assembly: AssemblyInformationalVersion("1.0.9")] +[assembly: AssemblyVersion("1.0.10")] +[assembly: AssemblyFileVersion("1.0.10")] +[assembly: AssemblyInformationalVersion("1.0.10")] From a8e49517ccee5e8660e42e384196d7d647ce60fd Mon Sep 17 00:00:00 2001 From: Jesse Stromwick Date: Mon, 9 Sep 2013 15:57:14 -0700 Subject: [PATCH 2/7] Tweaking README to clarify proxy configuration steps --- README.md | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index eef0aae..05dc0f9 100644 --- a/README.md +++ b/README.md @@ -119,20 +119,30 @@ If you are upgrading from version 1.0.8 or earlier, you'll need to add that snip **Authenticated Proxy** -Ensure the above `defaultProxy` configuration is in place before setting the credentials. The New Relic .NET SDK requires that you uncomment the default configuration and set the username and password as below: +If your proxy requires additional credentials (username and password) you need to take the following steps: + +1. Replace the above `defaultProxy` configuration with the snippet below + + + + + + + +This instructs the plugin to use our `the NewRelic.Platform.Binding.DotNET.Proxy` module when interacting with the proxy + +2. Specify the username and password as `appSettings` below: -When specifying the username and password, you *must* configure the default proxy seen immediately above. The domain name before the user is optional. +The domain name before the user is optional. -If you are upgrading from version 1.0.8 or earlier, you'll need to add that snippet to the config. - -**Authenticated Proxy with Proxy URL** - -The authenticated proxy with specified URL is a bit of a mix of the previous two settings. It is also mutually exclusive to the previous proxy setting. First, ensure the `` contain the proxy URL, username, and password: +By default the plugin will make web requests through the proxy at the address configured under Internet Settings in Windows. If, however, you +would like the plugin to point to a different proxy you should use the above configuration and simply add one +additional `appSettings` entry with a value key of `proxyAddress` like so: @@ -141,14 +151,6 @@ The authenticated proxy with specified URL is a bit of a mix of the previous two -Then the proxy handler must be configured. This is *similar* to the previous proxy config above: - - - - - - - If you have any questions regarding the expected look of the config file, please review the [latest source on GitHub](https://github.com/newrelic-platform/newrelic_microsoft_sqlserver_plugin/blob/develop/src/NewRelic.Microsoft.SqlServer.Plugin/app.config). From 42b72cd2f01f03b814d4c501079608deb9fe67cc Mon Sep 17 00:00:00 2001 From: Jesse Stromwick Date: Wed, 11 Sep 2013 21:33:43 -0700 Subject: [PATCH 3/7] Fixing Auth Proxy Example to display in GitHub's readme viewer --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 05dc0f9..712edd1 100644 --- a/README.md +++ b/README.md @@ -121,8 +121,8 @@ If you are upgrading from version 1.0.8 or earlier, you'll need to add that snip If your proxy requires additional credentials (username and password) you need to take the following steps: -1. Replace the above `defaultProxy` configuration with the snippet below - +Replace the above `defaultProxy` configuration with the snippet below + @@ -131,7 +131,7 @@ If your proxy requires additional credentials (username and password) you need t This instructs the plugin to use our `the NewRelic.Platform.Binding.DotNET.Proxy` module when interacting with the proxy -2. Specify the username and password as `appSettings` below: +Specify the username and password as `appSettings` below: From 372ad474dc8470b23066695289f8b05c58b5834f Mon Sep 17 00:00:00 2001 From: Ed Chapel Date: Sun, 15 Sep 2013 20:47:58 +0200 Subject: [PATCH 4/7] Trying a different approach for proxy support using WebProxy.DefaultProxy. Pulled proxy handling in New Relic SDK. Added proxy config section similar to the .NET Agent. --- lib/NewRelic.Platform.Binding.DotNET.dll | Bin 14848 -> 10752 bytes lib/NewRelic.Platform.Binding.DotNET.pdb | Bin 28160 -> 0 bytes .../NewRelicConfigurationSection.cs | 8 +- .../Configuration/ProxyElement.cs | 62 +++++++++++++ .../Configuration/Settings.cs | 71 ++++++++++++++ ...NewRelic.Microsoft.SqlServer.Plugin.csproj | 1 + .../app.config | 87 ++++-------------- .../app.deploy.config | 85 ++++------------- 8 files changed, 178 insertions(+), 136 deletions(-) delete mode 100644 lib/NewRelic.Platform.Binding.DotNET.pdb create mode 100644 src/NewRelic.Microsoft.SqlServer.Plugin/Configuration/ProxyElement.cs diff --git a/lib/NewRelic.Platform.Binding.DotNET.dll b/lib/NewRelic.Platform.Binding.DotNET.dll index f7b1bb64914fab9d9972b1873a0aa4c10360d230..6a882434409309db69df324a4c6d5a879d473735 100644 GIT binary patch delta 4584 zcmZ`-3vg7`8UD|?kG*>nR`zb*BxEiF(={=GpRru#+r~-zWHD@LJ_bv!gl4zzfmJq$5^~WN)8KPY1 z7p@>G^c;RTY}PEryP}`KVJCW~=)$3$=ee zYr#mVuNAmB>$(MM3~KxsM7B3fVAvxD6Brm@Hi8KZEI`&^0s}+O8cd$_2d~A^Q#CV% z*_kO;Nl1@l_K_O#GD>5rB8`&fVR111Vf|)|LfU5iHJV$54r->02{c`lR2+T2z>$4{ zmwbhnUf?clyRIaK=IjkuzpQGGBiGj4GL?aK9ER z+I3?ZbvnUYmclY#k9y(_0J|I0v^HLake&qQEGH0+&LVQrb34%8g*+Giu>&spZ+G7c zEjOyZxN#2fQ~=5$mT9_9@j`bTk`x-Tb1l;yk91TZcvr_N7fqtB3BZUR)`JBB7bCJe z+$LaHcP~crdTv;+4?s+WI2mv+LDGYK5i!DsI|*tV!h|~+EMg+sK(vvK4#&(o5?B*S zKc?dQ`Cx-TL-{Xdxn1aOwQJHt*ol>!iR!TdoAIl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in/Configuration/NewRelicConfigurationSection.cs index 8529132..580a1e0 100644 --- a/src/NewRelic.Microsoft.SqlServer.Plugin/Configuration/NewRelicConfigurationSection.cs +++ b/src/NewRelic.Microsoft.SqlServer.Plugin/Configuration/NewRelicConfigurationSection.cs @@ -4,12 +4,18 @@ namespace NewRelic.Microsoft.SqlServer.Plugin.Configuration { internal class NewRelicConfigurationSection : ConfigurationSection { - [ConfigurationProperty("service")] + [ConfigurationProperty("service", IsRequired = true)] public ServiceElement Service { get { return ((ServiceElement) (base["service"])); } } + [ConfigurationProperty("proxy")] + public ProxyElement Proxy + { + get { return ((ProxyElement)(base["proxy"])); } + } + [ConfigurationProperty("sqlServers")] public SqlServerCollection SqlServers { diff --git a/src/NewRelic.Microsoft.SqlServer.Plugin/Configuration/ProxyElement.cs b/src/NewRelic.Microsoft.SqlServer.Plugin/Configuration/ProxyElement.cs new file mode 100644 index 0000000..97373d4 --- /dev/null +++ b/src/NewRelic.Microsoft.SqlServer.Plugin/Configuration/ProxyElement.cs @@ -0,0 +1,62 @@ +using System.Configuration; + +namespace NewRelic.Microsoft.SqlServer.Plugin.Configuration +{ + internal class ProxyElement : ConfigurationElement + { + /// + /// The proxy server host name. Required. + /// + [ConfigurationProperty("host", DefaultValue = "", IsKey = false, IsRequired = true)] + public string Host + { + get { return ((string)(base["host"])); } + set { base["host"] = value; } + } + /// + /// The proxy server port (optional - defaults to 8080). + /// + [ConfigurationProperty("port", DefaultValue = "8080", IsKey = false, IsRequired = false)] + public string Port + { + get { return ((string)(base["port"])); } + set { base["port"] = value; } + } + /// + /// The username used to authenticate with the proxy server (optional). + /// + [ConfigurationProperty("user", DefaultValue = "", IsKey = false, IsRequired = false)] + public string User + { + get { return ((string)(base["user"])); } + set { base["user"] = value; } + } + /// + /// The password used to authenticate with the proxy server (optional). + /// + [ConfigurationProperty("password", DefaultValue = "", IsKey = false, IsRequired = false)] + public string Password + { + get { return ((string)(base["password"])); } + set { base["password"] = value; } + } + /// + /// The domain used to authenticate with the proxy server (optional). + /// + [ConfigurationProperty("domain", DefaultValue = "", IsKey = false, IsRequired = false)] + public string Domain + { + get { return ((string)(base["domain"])); } + set { base["domain"] = value; } + } + /// + /// 'true' or 'false. Uses the credentials of the account running the plugin (optional - defaults to false). + /// + [ConfigurationProperty("useDefaultCredentials", DefaultValue = "false", IsKey = false, IsRequired = false)] + public string UseDefaultCredentials + { + get { return ((string)(base["useDefaultCredentials"])); } + set { base["useDefaultCredentials"] = value; } + } + } +} \ No newline at end of file diff --git a/src/NewRelic.Microsoft.SqlServer.Plugin/Configuration/Settings.cs b/src/NewRelic.Microsoft.SqlServer.Plugin/Configuration/Settings.cs index cc9b7cc..e709986 100644 --- a/src/NewRelic.Microsoft.SqlServer.Plugin/Configuration/Settings.cs +++ b/src/NewRelic.Microsoft.SqlServer.Plugin/Configuration/Settings.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using System.Net; using System.Reflection; using System.Security.Principal; using System.Text.RegularExpressions; @@ -13,6 +14,7 @@ namespace NewRelic.Microsoft.SqlServer.Plugin.Configuration public class Settings { private string _version; + private static string _ProxyDetails; public Settings(ISqlEndpoint[] endpoints) { @@ -74,9 +76,72 @@ internal static Settings FromConfigurationSection(NewRelicConfigurationSection s settings.ServiceName = service.ServiceName; } + var webProxy = GetWebProxy(section, log); + if (webProxy != null) + { + WebRequest.DefaultWebProxy = webProxy; + } + return settings; } + private static IWebProxy GetWebProxy(NewRelicConfigurationSection section, ILog log) + { + var proxyElement = section.Proxy; + if (proxyElement == null || !proxyElement.ElementInformation.IsPresent) return null; + + Uri uri; + if (!Uri.TryCreate(proxyElement.Host, UriKind.RelativeOrAbsolute, out uri)) + { + log.ErrorFormat("Proxy host '{0}' is not a valid URI, skipping proxy.", proxyElement.Host); + return null; + } + + int port; + if (!int.TryParse(proxyElement.Port, out port)) + { + log.ErrorFormat("Unable to parse proxy port from '{0}', skipping proxy. Expecting a number from 1-65535.", proxyElement.Port); + return null; + } + + WebProxy webProxy; + try + { + webProxy = new WebProxy(proxyElement.Host, port); + } + catch (Exception e) + { + log.ErrorFormat("Proxy settings are invalid. {0}", e.Message); + return null; + } + + if ("true".Equals(proxyElement.UseDefaultCredentials, StringComparison.InvariantCultureIgnoreCase)) + { + webProxy.UseDefaultCredentials = true; + webProxy.Credentials = CredentialCache.DefaultCredentials; + _ProxyDetails = string.Format("Proxy Server: {0}:{1} with default credentials", proxyElement.Host, port); + } + else if (!string.IsNullOrEmpty(proxyElement.User)) + { + if (string.IsNullOrEmpty(proxyElement.Domain)) + { + webProxy.Credentials = new NetworkCredential(proxyElement.User, proxyElement.Password); + _ProxyDetails = string.Format("Proxy Server: {0}@{1}:{2}", proxyElement.User, proxyElement.Host, port); + } + else + { + webProxy.Credentials = new NetworkCredential(proxyElement.User, proxyElement.Password, proxyElement.Domain); + _ProxyDetails = string.Format("Proxy Server: {0}\\{1}@{2}:{3}", proxyElement.Domain, proxyElement.User, proxyElement.Host, port); + } + } + else + { + _ProxyDetails = string.Format("Proxy Server: {0}:{1}", proxyElement.Host, port); + } + + return webProxy; + } + public void ToLog(ILog log) { // Pending review by New Relic before adding this information @@ -87,6 +152,12 @@ public void ToLog(ILog log) log.Info(" Windows Service: " + (Environment.UserInteractive ? "No" : "Yes")); log.InfoFormat(@" User: {0}\{1}", Environment.UserDomainName, Environment.UserName); log.Info(" Run as Administrator: " + (IsProcessElevated ? "Yes" : "No")); + + if (_ProxyDetails != null) + { + log.Info(" " + _ProxyDetails); + } + log.Info(" Total Endpoints: " + Endpoints.Length); log.Info(" Poll Interval Seconds: " + PollIntervalSeconds); diff --git a/src/NewRelic.Microsoft.SqlServer.Plugin/NewRelic.Microsoft.SqlServer.Plugin.csproj b/src/NewRelic.Microsoft.SqlServer.Plugin/NewRelic.Microsoft.SqlServer.Plugin.csproj index 83196fe..e766740 100644 --- a/src/NewRelic.Microsoft.SqlServer.Plugin/NewRelic.Microsoft.SqlServer.Plugin.csproj +++ b/src/NewRelic.Microsoft.SqlServer.Plugin/NewRelic.Microsoft.SqlServer.Plugin.csproj @@ -73,6 +73,7 @@ + diff --git a/src/NewRelic.Microsoft.SqlServer.Plugin/app.config b/src/NewRelic.Microsoft.SqlServer.Plugin/app.config index 71b3c71..3f1486d 100644 --- a/src/NewRelic.Microsoft.SqlServer.Plugin/app.config +++ b/src/NewRelic.Microsoft.SqlServer.Plugin/app.config @@ -5,26 +5,6 @@
- - - - + + + + + + - - - - - - + \ No newline at end of file diff --git a/src/NewRelic.Microsoft.SqlServer.Plugin/app.deploy.config b/src/NewRelic.Microsoft.SqlServer.Plugin/app.deploy.config index d60139d..7b2f8bf 100644 --- a/src/NewRelic.Microsoft.SqlServer.Plugin/app.deploy.config +++ b/src/NewRelic.Microsoft.SqlServer.Plugin/app.deploy.config @@ -5,26 +5,6 @@
- - - - + + + + + + - - - - - - - \ No newline at end of file From c401954c69512b81624ab1c347dafed7502ff15a Mon Sep 17 00:00:00 2001 From: Jesse Stromwick Date: Sun, 15 Sep 2013 16:54:49 -0700 Subject: [PATCH 5/7] Fixed issue where if the server was down for a time, then came back up, the plugin would be unable to successfully send data unless the service was restarted. This was caused by our Duration being greater than the allowed maximum, and never being reset. This should fix the issue described in https://support.newrelic.com/tickets/55385 and https://support.newrelic.com/tickets/55367?col=2117133&page=1 --- .../SqlEndpointTests.cs | 23 ++++++++ .../SqlEndpointBase.cs | 55 +++++++++++++------ 2 files changed, 61 insertions(+), 17 deletions(-) diff --git a/src/NewRelic.Microsoft.SqlServer.Plugin.Tests/SqlEndpointTests.cs b/src/NewRelic.Microsoft.SqlServer.Plugin.Tests/SqlEndpointTests.cs index ac54f24..24fdd7b 100644 --- a/src/NewRelic.Microsoft.SqlServer.Plugin.Tests/SqlEndpointTests.cs +++ b/src/NewRelic.Microsoft.SqlServer.Plugin.Tests/SqlEndpointTests.cs @@ -27,6 +27,29 @@ public IEnumerable ComponentGuidTestCases } } + //Tests fix for issue where Plugin gets 400's after server is unavailable for a time https://support.newrelic.com/tickets/55385 + [Test] + [TestCase(1, TestName = "A Minute Since Success")] + [TestCase(5, TestName = "5 Minutes Since Success")] + [TestCase(30, TestName = "30 Minutes Since Success")] + [TestCase(60, TestName = "An Hour Since Success")] + [TestCase(120, TestName = "Two Hours Since Success")] + [TestCase(1440, TestName = "A Day Since Success")] + [TestCase(2880, TestName = "Two Days Since Success")] + public void Assert_duration_does_not_exceed_allowed_max(int minutesSinceLastSuccessful) + { + var endpoint = new SqlServerEndpoint("Foo",".",false); + endpoint.MetricReportSuccessful(DateTime.Now.AddMinutes(minutesSinceLastSuccessful * -1)); + + const int thirtyMinutesInSeconds = 30 * 60; + Assert.That(endpoint.Duration, Is.LessThanOrEqualTo(thirtyMinutesInSeconds), "Duration should never be longer than 30 minutes, regardless of last succssful reported time"); + + endpoint.MetricReportSuccessful(DateTime.Now.AddMinutes(-.5)); + Assert.That(endpoint.Duration, Is.LessThanOrEqualTo(31), "Duration should reset to be around 30 seconds regardless of previous value"); + + } + + [Test] public void Assert_endpoint_appropriately_massages_duplicated_data() { var endpoint = Substitute.For("", ""); diff --git a/src/NewRelic.Microsoft.SqlServer.Plugin/SqlEndpointBase.cs b/src/NewRelic.Microsoft.SqlServer.Plugin/SqlEndpointBase.cs index d158dac..4502873 100644 --- a/src/NewRelic.Microsoft.SqlServer.Plugin/SqlEndpointBase.cs +++ b/src/NewRelic.Microsoft.SqlServer.Plugin/SqlEndpointBase.cs @@ -4,18 +4,22 @@ using System.Linq; using System.Text; +using log4net; + using NewRelic.Microsoft.SqlServer.Plugin.Configuration; using NewRelic.Microsoft.SqlServer.Plugin.Core.Extensions; using NewRelic.Microsoft.SqlServer.Plugin.Properties; using NewRelic.Microsoft.SqlServer.Plugin.QueryTypes; using NewRelic.Platform.Binding.DotNET; -using log4net; - namespace NewRelic.Microsoft.SqlServer.Plugin { public abstract class SqlEndpointBase : ISqlEndpoint { + /// + /// Metrics with a Duration greater than this value will be rejected by the server (400) + /// + private const int MaximumAllowedDuration = 1800; private static readonly ILog _ErrorDetailOutputLogger = LogManager.GetLogger(Constants.ErrorDetailLogger); private static readonly ILog _VerboseSqlOutputLogger = LogManager.GetLogger(Constants.VerboseSqlLogger); @@ -54,7 +58,14 @@ public string[] IncludedDatabaseNames public int Duration { - get { return (int) DateTime.Now.Subtract(_lastSuccessfulReportTime).TotalSeconds; } + get + { + var secondsSinceLastSuccessfulReport = (int) DateTime.Now.Subtract(_lastSuccessfulReportTime).TotalSeconds; + + return secondsSinceLastSuccessfulReport <= MaximumAllowedDuration + ? secondsSinceLastSuccessfulReport + : MaximumAllowedDuration; + } } public void SetQueries(IEnumerable queries) @@ -77,7 +88,7 @@ public void UpdateHistory(IQueryContext[] queryContexts) { queryContexts.ForEach(queryContext => { - var queryHistory = QueryHistory.GetOrCreate(queryContext.QueryName); + Queue queryHistory = QueryHistory.GetOrCreate(queryContext.QueryName); if (queryHistory.Count >= 2) //Only track up to last run of this query { queryHistory.Dequeue(); @@ -90,8 +101,8 @@ public PlatformData GeneratePlatformData(AgentData agentData) { var platformData = new PlatformData(agentData); - var pendingComponentData = QueryHistory.Select(qh => ComponentDataRetriever.GetData(qh.Value.ToArray())) - .Where(c => c != null).ToArray(); + ComponentData[] pendingComponentData = QueryHistory.Select(qh => ComponentDataRetriever.GetData(qh.Value.ToArray())) + .Where(c => c != null).ToArray(); pendingComponentData.ForEach(platformData.AddComponent); @@ -110,12 +121,13 @@ public virtual void ToLog(ILog log) log.InfoFormat(" {0}: {1}", Name, safeConnectionString); // Validate that connection string do not provide both Trusted Security AND user/password - var hasUserCreds = !string.IsNullOrEmpty(safeConnectionString.UserID) || !string.IsNullOrEmpty(safeConnectionString.Password); + bool hasUserCreds = !string.IsNullOrEmpty(safeConnectionString.UserID) || !string.IsNullOrEmpty(safeConnectionString.Password); if (safeConnectionString.IntegratedSecurity == hasUserCreds) { log.Error("=================================================="); log.ErrorFormat("Connection string for '{0}' may not contain both Integrated Security and User ID/Password credentials. " + - "Review the readme.md and update the config file.", safeConnectionString.DataSource); + "Review the readme.md and update the config file.", + safeConnectionString.DataSource); log.Error("=================================================="); } } @@ -133,7 +145,7 @@ protected IEnumerable ExecuteQueries(SqlQuery[] queries, string c using (var conn = new SqlConnection(connectionString)) { - foreach (var query in queries) + foreach (SqlQuery query in queries) { object[] results; try @@ -159,12 +171,15 @@ protected IEnumerable ExecuteQueries(SqlQuery[] queries, string c protected static void LogVerboseSqlResults(ISqlQuery query, IEnumerable results) { // This could be slow, so only proceed if it actually gets logged - if (!_VerboseSqlOutputLogger.IsInfoEnabled) return; - + if (!_VerboseSqlOutputLogger.IsInfoEnabled) + { + return; + } + var verboseLogging = new StringBuilder(); verboseLogging.AppendFormat("Executed {0}", query.ResourceName).AppendLine(); - foreach (var result in results) + foreach (object result in results) { verboseLogging.AppendLine(result.ToString()); } @@ -197,7 +212,7 @@ internal object[] CalculateSqlDmlActivityIncrease(object[] inputResults, ILog lo return inputResults; } - var sqlDmlActivities = inputResults.OfType().ToArray(); + SqlDmlActivity[] sqlDmlActivities = inputResults.OfType().ToArray(); if (!sqlDmlActivities.Any()) { @@ -205,7 +220,7 @@ internal object[] CalculateSqlDmlActivityIncrease(object[] inputResults, ILog lo return inputResults; } - var currentValues = sqlDmlActivities + Dictionary currentValues = sqlDmlActivities .GroupBy(a => string.Format("{0}:{1}:{2}:{3}", BitConverter.ToString(a.PlanHandle), BitConverter.ToString(a.SqlStatementHash), a.CreationTime.Ticks, a.QueryType)) .Select(a => new { @@ -246,7 +261,10 @@ internal object[] CalculateSqlDmlActivityIncrease(object[] inputResults, ILog lo increase = a.Value.ExecutionCount - previous.ExecutionCount; // Only record positive deltas, though theoretically impossible here - if (increase <= 0) return; + if (increase <= 0) + { + return; + } } else { @@ -282,14 +300,17 @@ internal object[] CalculateSqlDmlActivityIncrease(object[] inputResults, ILog lo { Reads = reads, Writes = writes, - }, + } }; } private void LogErrorSummary(ILog log, Exception e, ISqlQuery query) { var sqlException = e.InnerException as SqlException; - if (sqlException == null) return; + if (sqlException == null) + { + return; + } log.LogSqlException(sqlException, query, ConnectionString); } From 400a528379192dacfb5eed3924b752ac7696d0b3 Mon Sep 17 00:00:00 2001 From: Ed Chapel Date: Tue, 24 Sep 2013 19:39:13 +0200 Subject: [PATCH 6/7] Fixes issue seen be several users where column names were missing from the sys.databases schema. Uses 'SELECT *' to fail gracefully. --- .../Queries/DatabaseDetails.SqlServer.sql | 7 ++++--- .../SqlEndpointBase.cs | 20 ++++++------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/NewRelic.Microsoft.SqlServer.Plugin/Queries/DatabaseDetails.SqlServer.sql b/src/NewRelic.Microsoft.SqlServer.Plugin/Queries/DatabaseDetails.SqlServer.sql index 6da32c4..03f52d1 100644 --- a/src/NewRelic.Microsoft.SqlServer.Plugin/Queries/DatabaseDetails.SqlServer.sql +++ b/src/NewRelic.Microsoft.SqlServer.Plugin/Queries/DatabaseDetails.SqlServer.sql @@ -2,9 +2,9 @@ -- Retrieves relevant data about each database -- Assists support when a user reports a problem - -SELECT - d.[name] AS DatabaseName, +SELECT d.[name] AS DatabaseName, + * -- Use * as differnt databases seem to have different columns. This isn't critical data so we must fail gracefully. +/* d.[database_id], d.[source_database_id], d.[create_date], @@ -70,5 +70,6 @@ SELECT d.[containment], d.[containment_desc], d.[target_recovery_time_in_seconds] +*/ FROM sys.databases d /*{WHERE}*/ \ No newline at end of file diff --git a/src/NewRelic.Microsoft.SqlServer.Plugin/SqlEndpointBase.cs b/src/NewRelic.Microsoft.SqlServer.Plugin/SqlEndpointBase.cs index 4502873..30da068 100644 --- a/src/NewRelic.Microsoft.SqlServer.Plugin/SqlEndpointBase.cs +++ b/src/NewRelic.Microsoft.SqlServer.Plugin/SqlEndpointBase.cs @@ -17,9 +17,10 @@ namespace NewRelic.Microsoft.SqlServer.Plugin public abstract class SqlEndpointBase : ISqlEndpoint { /// - /// Metrics with a Duration greater than this value will be rejected by the server (400) + /// Metrics with a Duration greater than this value will be rejected by the server (400) /// private const int MaximumAllowedDuration = 1800; + private static readonly ILog _ErrorDetailOutputLogger = LogManager.GetLogger(Constants.ErrorDetailLogger); private static readonly ILog _VerboseSqlOutputLogger = LogManager.GetLogger(Constants.VerboseSqlLogger); @@ -171,10 +172,7 @@ protected IEnumerable ExecuteQueries(SqlQuery[] queries, string c protected static void LogVerboseSqlResults(ISqlQuery query, IEnumerable results) { // This could be slow, so only proceed if it actually gets logged - if (!_VerboseSqlOutputLogger.IsInfoEnabled) - { - return; - } + if (!_VerboseSqlOutputLogger.IsInfoEnabled) return; var verboseLogging = new StringBuilder(); verboseLogging.AppendFormat("Executed {0}", query.ResourceName).AppendLine(); @@ -261,10 +259,7 @@ internal object[] CalculateSqlDmlActivityIncrease(object[] inputResults, ILog lo increase = a.Value.ExecutionCount - previous.ExecutionCount; // Only record positive deltas, though theoretically impossible here - if (increase <= 0) - { - return; - } + if (increase <= 0) return; } else { @@ -300,17 +295,14 @@ internal object[] CalculateSqlDmlActivityIncrease(object[] inputResults, ILog lo { Reads = reads, Writes = writes, - } + }, }; } private void LogErrorSummary(ILog log, Exception e, ISqlQuery query) { var sqlException = e.InnerException as SqlException; - if (sqlException == null) - { - return; - } + if (sqlException == null) return; log.LogSqlException(sqlException, query, ConnectionString); } From 4ef8803d54e224eb4d2ce38427f898d42c212a7c Mon Sep 17 00:00:00 2001 From: Ed Chapel Date: Tue, 24 Sep 2013 20:40:35 +0200 Subject: [PATCH 7/7] Updated Proxy details. --- README.md | 72 ++++++++++++++++--------------------------------------- 1 file changed, 20 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 712edd1..c2e13cb 100644 --- a/README.md +++ b/README.md @@ -101,58 +101,26 @@ In a new connection to each individual Azure SQL Database: ## Proxy Support ## -When the plugin is installed behind a proxy, there are a few configuration options. - -**Default Proxy** - -Assuming the proxy is configured at the system level (Internet Options in Control Panel), just uncomment the default configuration so that it reads as follows: - - - - - - - -This configuration may be used with the username and password in the next section. - -If you are upgrading from version 1.0.8 or earlier, you'll need to add that snippet to the config. - -**Authenticated Proxy** - -If your proxy requires additional credentials (username and password) you need to take the following steps: - -Replace the above `defaultProxy` configuration with the snippet below - - - - - - - -This instructs the plugin to use our `the NewRelic.Platform.Binding.DotNET.Proxy` module when interacting with the proxy - -Specify the username and password as `appSettings` below: - - - - - - -The domain name before the user is optional. - -By default the plugin will make web requests through the proxy at the address configured under Internet Settings in Windows. If, however, you -would like the plugin to point to a different proxy you should use the above configuration and simply add one -additional `appSettings` entry with a value key of `proxyAddress` like so: - - - - - - - - -If you have any questions regarding the expected look of the config file, please review the [latest source on GitHub](https://github.com/newrelic-platform/newrelic_microsoft_sqlserver_plugin/blob/develop/src/NewRelic.Microsoft.SqlServer.Plugin/app.config). - +For installations behind a proxy, the details are set in the config file. + + + + + + +If you are upgrading from version 1.0.9 or earlier, you'll need to replace the previous proxy settings with this new snippet in the config. ## Logging