Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.

Commit 2215f5f

Browse files
Merge pull request #925 from microsoft/develop
Merge develop to master
2 parents 05e634b + 86c3bd6 commit 2215f5f

File tree

66 files changed

+1000
-524
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1000
-524
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ If you are reporting bug/issue, please provide detailed Repro instructions.
1111

1212

1313
## Version Info
14-
SDK Version :
15-
.NET Version :
16-
How Application was onboarded with SDK(VisualStudio/StatusMonitor/Azure Extension) :
14+
SDK Version (version of https://www.nuget.org/packages/Microsoft.ApplicationInsights.AspNetCore) :
15+
.NET Core Version (TargetFramework in your .csproj file) :
16+
How Application was onboarded with SDK(Installed Nugets/VisualStudio/Azure WebAppExtension) :
1717
OS :
18-
Hosting Info (IIS/Azure WebApps/ etc) :
18+
Hosting Info (IIS/Azure Web Apps/Running From Visual Studio etc) :

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ Fix Issue # .
22
<Short description of the fix.>
33

44
- [ ] I ran Unit Tests locally.
5+
- [ ] CHANGELOG.md updated with one line description of the fix, and a link to the original issue if available.
56

67
For significant contributions please make sure you have completed the following items:
78

89
- [ ] Changes in public surface reviewed
910
- [ ] Design discussion issue #
10-
- [ ] CHANGELOG.md updated with one line description of the fix, and a link to the original issue.
1111
- [ ] The PR will trigger build, unit tests, and functional tests automatically. If your PR was submitted from fork - mention one of committers to initiate the build for you.
1212
If you want to to re-run the build/tests, the easiest way is to simply Close and Re-Open this same PR. (Just click 'close pull request' followed by 'open pull request' buttons at the bottom of the PR)
1313

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# Changelog
22

3+
## Version 2.8.0-beta1
4+
- [Add EventCounter collection.](https://github.com/microsoft/ApplicationInsights-aspnetcore/issues/913)
5+
- [Performance fixes: One DiagSource Listener; Head Sampling Feature; No Concurrent Dictionary; etc...](https://github.com/microsoft/ApplicationInsights-aspnetcore/pull/907)
6+
- [Fix: Add `IJavaScriptSnippet` service interface and update the `IServiceCollection` extension to register it for `JavaScriptSnippet`.](https://github.com/microsoft/ApplicationInsights-aspnetcore/issues/890)
7+
- [Make JavaScriptEncoder optional and Fallback to JavaScriptEncoder.Default.](https://github.com/microsoft/ApplicationInsights-aspnetcore/pull/918)
8+
39
## Version 2.7.1
410
- [Fix - ApplicationInsights StartupFilter should not swallow exceptions from downstream ApplicationBuilder.](https://github.com/microsoft/ApplicationInsights-aspnetcore/issues/897)
511

612
## Version 2.7.0
7-
- Updated Web/Base SDK version dependency to 2.10.0
13+
- Updated Web/Base SDK version dependency to 2.10.0
814
- [Remove unused reference to System.Net.Http](https://github.com/microsoft/ApplicationInsights-aspnetcore/pull/879)
915

1016
## Version 2.7.0-beta4

Readme.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ Linux :[![Build Status](https://mseng.visualstudio.com/AppInsights/_apis/build/s
1111
Microsoft Application Insights for ASP.NET Core applications
1212
=============================================================
1313

14-
This repository has a code for [Application Insights monitoring](http://azure.microsoft.com/en-us/services/application-insights/) of [ASP.NET Core](https://github.com/aspnet/home) applications. Read about contribution policies on Application Insights Home [repository](https://github.com/microsoft/ApplicationInsights-home)
14+
This repository has a code for [Application Insights monitoring](http://azure.microsoft.com/en-us/services/application-insights/) of [ASP.NET Core](https://docs.microsoft.com/aspnet/core) applications. Read about contribution policies on Application Insights Home [repository](https://github.com/microsoft/ApplicationInsights-home)
1515

1616
Getting Started
1717
---------------
1818

19-
[Application Insights monitoring](http://azure.microsoft.com/en-us/services/application-insights/) is a service that allows you to collect monitoring and diagnostics information about your application. The [getting started](https://github.com/Microsoft/ApplicationInsights-aspnet5/wiki/Getting-Started) guide shows how you can onboard your ASP.NET Core web application to use the Application Insights SDK.
20-
21-
Application Insights collects a lot of information out-of-the-box such as requests, dependencies, exceptions, and usage. It also allows you to configure additional data collection. The [configure](https://github.com/Microsoft/ApplicationInsights-aspnet5/wiki/Configure) guide demonstrates the most common tasks you may want to do.
19+
[Application Insights monitoring](http://azure.microsoft.com/en-us/services/application-insights/) is a service that allows you to collect monitoring and diagnostics information about your application. The [getting started](https://docs.microsoft.com/azure/azure-monitor/app/asp-net-core) guide shows how you can onboard your ASP.NET Core web application to use the Application Insights SDK.
2220

2321

2422
Repository structure

src/Microsoft.ApplicationInsights.AspNetCore/DiagnosticListeners/Implementation/ContextData.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
namespace Microsoft.ApplicationInsights.AspNetCore.DiagnosticListeners
22
{
33
#if NET451 || NET46
4-
using System.Runtime.Remoting.Messaging;
54
using System.Runtime.Remoting;
5+
using System.Runtime.Remoting.Messaging;
66
#else
77
using System.Threading;
88
#endif
9+
910
/// <summary>
1011
/// Represents ambient data that is local to a given asynchronous control flow, such as an asynchronous method.
1112
/// </summary>
@@ -15,7 +16,6 @@ internal class ContextData<T>
1516
#if NET451 || NET46
1617
private static readonly string Key = typeof(ContextData<T>).FullName;
1718

18-
1919
/// <summary>
2020
/// Gets or sets the value of the ambient data.
2121
/// </summary>
@@ -27,6 +27,7 @@ public T Value
2727
var handle = CallContext.LogicalGetData(Key) as ObjectHandle;
2828
return handle != null ? (T)handle.Unwrap() : default(T);
2929
}
30+
3031
set
3132
{
3233
CallContext.LogicalSetData(Key, new ObjectHandle(value));

src/Microsoft.ApplicationInsights.AspNetCore/DiagnosticListeners/Implementation/HeadersUtilities.cs

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ internal static class HeadersUtilities
2121
public static string GetHeaderKeyValue(IEnumerable<string> headerValues, string keyName)
2222
{
2323
if (headerValues != null)
24-
{
24+
{
2525
foreach (string keyNameValue in headerValues)
2626
{
2727
string[] keyNameValueParts = keyNameValue.Trim().Split('=');
@@ -43,9 +43,9 @@ public static string GetHeaderKeyValue(IEnumerable<string> headerValues, string
4343
/// provided key value. If the initial header value strings don't contain the key name,
4444
/// then the key name/value pair should be added to the comma-separated list and returned.
4545
/// </summary>
46-
/// <param name="headerValues">The existing header values that the key/value pair should be added to.</param>
47-
/// <param name="keyName">The name of the key to add.</param>
48-
/// <param name="keyValue">The value of the key to add.</param>
46+
/// <param name="currentHeaders">The existing header values that the key/value pair should be added to.</param>
47+
/// <param name="key">The name of the key to add.</param>
48+
/// <param name="value">The value of the key to add.</param>
4949
/// <returns>The result of setting the provided key name/value pair into the provided headerValues.</returns>
5050
public static StringValues SetHeaderKeyValue(string[] currentHeaders, string key, string value)
5151
{
@@ -60,14 +60,32 @@ public static StringValues SetHeaderKeyValue(string[] currentHeaders, string key
6060
}
6161
}
6262

63-
return StringValues.Concat(currentHeaders, string.Concat(key, "=", value));
63+
return StringValues.Concat(currentHeaders, string.Concat(key, "=", value));
6464
}
6565
else
6666
{
6767
return string.Concat(key, "=", value);
6868
}
6969
}
7070

71+
/// <summary>
72+
/// Http Headers only allow Printable US-ASCII characters.
73+
/// Remove all other characters.
74+
/// </summary>
75+
public static string SanitizeString(string input)
76+
{
77+
if (string.IsNullOrWhiteSpace(input))
78+
{
79+
return input;
80+
}
81+
82+
// US-ASCII characters (hex: 0x00 - 0x7F) (decimal: 0-127)
83+
// ASCII Extended characters (hex: 0x80 - 0xFF) (decimal: 128-255) (NOT ALLOWED)
84+
// Non-Printable ASCII characters are (hex: 0x00 - 0x1F) (decimal: 0-31) (NOT ALLOWED)
85+
// Printable ASCII characters are (hex: 0x20 - 0xFF) (decimal: 32-255)
86+
return Regex.Replace(input, @"[^\u0020-\u007F]", string.Empty);
87+
}
88+
7189
/// <summary>
7290
/// Check if the header contains the key, case insensitve, ignore leading and trailing whitepsaces.
7391
/// </summary>
@@ -108,24 +126,5 @@ private static bool HeaderMatchesKey(string headerValue, string key)
108126

109127
return true;
110128
}
111-
112-
/// <summary>
113-
/// Http Headers only allow Printable US-ASCII characters.
114-
/// Remove all other characters.
115-
/// </summary>
116-
public static string SanitizeString(string input)
117-
{
118-
if (string.IsNullOrWhiteSpace(input))
119-
{
120-
return input;
121-
}
122-
123-
// US-ASCII characters (hex: 0x00 - 0x7F) (decimal: 0-127)
124-
// ASCII Extended characters (hex: 0x80 - 0xFF) (decimal: 0-255) (NOT ALLOWED)
125-
// Non-Printable ASCII characters are (hex: 0x00 - 0x1F) (decimal: 0-31) (NOT ALLOWED)
126-
// Printable ASCII characters are (hex: 0x20 - 0xFF) (decimal: 32-255)
127-
return Regex.Replace(input, @"[^\u0020-\u007F]", string.Empty);
128-
}
129-
130129
}
131130
}

0 commit comments

Comments
 (0)