Skip to content

Commit

Permalink
Merge pull request #220 from Microsoft/develop
Browse files Browse the repository at this point in the history
Develop to master
  • Loading branch information
abaranch committed Apr 12, 2016
2 parents 1ccd5b4 + 2be9876 commit 0110215
Show file tree
Hide file tree
Showing 45 changed files with 1,141 additions and 360 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@

This changelog will be used to generate documentation on [release notes page](http://azure.microsoft.com/en-us/documentation/articles/app-insights-release-notes-dotnet/).

## Version 2.1.0-beta3
- Support partial success (206) from the Application Insights backend. Before this change SDK may have lost data because some items of the batch were accepted and some items of the batch were asked to be retried (because of burst throttling or intermittent issues).
- Bug fixes

## Version 2.1.0-beta1

- Upgraded to depend on EventSource.Redist nuget version 1.1.28
- Upgraded to depend on Microsoft.Bcl nuget version 1.1.10

## Version 2.0.0 (stable)
## Version 2.0.1

- Add Win Phone, Win Store and UWP targets that include 1.2.3 version of ApplicationInsights.dll. It is included to prevent applications that upgrade to 2.0.0 from crashing. In any case using this nuget for Win Phone, Win Store and UWP targets is not recommended and not supported.

## Version 2.0.0

- Disallow Nan, +-Infinity measurements. Value will be replaced on 0.
- Disallow Nan, +-Infinity metrics (Value, Min, Max and StandardDeviation). Values will be replaced on 0.
Expand Down
4 changes: 2 additions & 2 deletions GlobalStaticVersion.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<SemanticVersionMajor>2</SemanticVersionMajor>
<SemanticVersionMinor>1</SemanticVersionMinor>
<SemanticVersionPatch>0</SemanticVersionPatch>
<PreReleaseMilestone>beta1</PreReleaseMilestone>
<PreReleaseMilestone>beta3</PreReleaseMilestone>
<!--
Date when Semantic Version was changed.
Update for every public release.
Expand All @@ -18,4 +18,4 @@
<PreReleaseVersionFileName>.PreReleaseVersion</PreReleaseVersionFileName>
<PreReleaseVersionFilePath>$(MSBuildThisFileDirectory)$(PreReleaseVersionFileName)</PreReleaseVersionFilePath>
</PropertyGroup>
</Project>
</Project>
36 changes: 33 additions & 3 deletions Microsoft.ApplicationInsights.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Core.Shared", "src\Core\Managed\Shared\Core.Shared.shproj", "{C1AAA703-5E32-45C0-A69D-F46D1C659AE4}"
EndProject
Expand Down Expand Up @@ -65,19 +65,28 @@ EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Operation.AL.Tests.Shared", "Test\CoreSDK.Test\Operation.AL.Shared.Tests\Operation.AL.Tests.Shared.shproj", "{4E54ED64-28B4-484F-AD5E-089FD2EC9B8B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core.NuGet", "src\Core\NuGet\Core\Core.NuGet.csproj", "{B69CBB57-4D1F-4FBE-B4AB-FD87EDBEE12B}"
ProjectSection(ProjectDependencies) = postProject
{40CCD816-19FD-4B1D-9E24-AD2099351187} = {40CCD816-19FD-4B1D-9E24-AD2099351187}
{958CFE53-53B7-4E26-846D-DA3F214013E6} = {958CFE53-53B7-4E26-846D-DA3F214013E6}
{862B97AF-F620-43FD-9B65-7E5423F3B7E3} = {862B97AF-F620-43FD-9B65-7E5423F3B7E3}
{412659CA-49B0-4834-BFBF-8183055083C8} = {412659CA-49B0-4834-BFBF-8183055083C8}
{CD752CD2-6711-4AD7-B5C8-F8C23CF076B1} = {CD752CD2-6711-4AD7-B5C8-F8C23CF076B1}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DummyCore", "src\Core\Managed\DummyCore\DummyCore.csproj", "{40CCD816-19FD-4B1D-9E24-AD2099351187}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\Core\Managed\Shared\Shared.projitems*{412659ca-49b0-4834-bfbf-8183055083c8}*SharedItemsImports = 4
src\Core\Managed\Operation.CC.Shared\Operation.CC.Shared.projitems*{412659ca-49b0-4834-bfbf-8183055083c8}*SharedItemsImports = 4
Test\CoreSDK.Test\Operation.AL.Shared.Tests\Operation.AL.Tests.Shared.projitems*{0927e682-4a56-46b6-8125-94fa066b2f57}*SharedItemsImports = 4
Test\CoreSDK.Test\Shared\Core.Shared.Tests.projitems*{0927e682-4a56-46b6-8125-94fa066b2f57}*SharedItemsImports = 4
Test\CoreSDK.Test\Shared\Core.Shared.Tests.projitems*{0927e682-4a56-45b6-8125-94fa066b2f57}*SharedItemsImports = 4
Test\CoreSDK.Test\Operation.CC.Shared.Tests\Operation.CC.Tests.Shared.projitems*{0927e682-4a56-45b6-8125-94fa066b2f57}*SharedItemsImports = 4
Test\CoreSDK.Test\Shared\Core.Shared.Tests.projitems*{0927e682-4a56-45b6-8125-94fa066b2f57}*SharedItemsImports = 4
Test\CoreSDK.Test\Operation.CC.Shared.Tests\Operation.CC.Tests.Shared.projitems*{4dc2927f-bb78-4363-8428-0f02955064bc}*SharedItemsImports = 13
src\Core\Managed\Shared\Shared.projitems*{862b97af-f620-43fd-9b65-7e5423f3b7e3}*SharedItemsImports = 4
Test\CoreSDK.Test\Shared\Core.Shared.Tests.projitems*{394a78e5-2f8f-4d2d-ae08-027380c9f6b2}*SharedItemsImports = 4
Test\CoreSDK.Test\Operation.CC.Shared.Tests\Operation.CC.Tests.Shared.projitems*{394a78e5-2f8f-4d2d-ae08-027380c9f6b2}*SharedItemsImports = 4
Test\CoreSDK.Test\Shared\Core.Shared.Tests.projitems*{394a78e5-2f8f-4d2d-ae08-027380c9f6b2}*SharedItemsImports = 4
Test\CoreSDK.Test\TestFramework\Shared\TestFramework.Shared.projitems*{f76c6cbd-29b0-4564-bdcb-c969f8fec136}*SharedItemsImports = 13
src\Core\Managed\Shared\Shared.projitems*{958cfe53-53b7-4e26-846d-da3f214013e6}*SharedItemsImports = 4
src\Core\Managed\Operation.AL.Shared\Operation.AL.Shared.projitems*{958cfe53-53b7-4e26-846d-da3f214013e6}*SharedItemsImports = 4
Expand Down Expand Up @@ -323,6 +332,26 @@ Global
{B69CBB57-4D1F-4FBE-B4AB-FD87EDBEE12B}.Release|x64.Build.0 = Release|Any CPU
{B69CBB57-4D1F-4FBE-B4AB-FD87EDBEE12B}.Release|x86.ActiveCfg = Release|Any CPU
{B69CBB57-4D1F-4FBE-B4AB-FD87EDBEE12B}.Release|x86.Build.0 = Release|Any CPU
{40CCD816-19FD-4B1D-9E24-AD2099351187}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{40CCD816-19FD-4B1D-9E24-AD2099351187}.Debug|Any CPU.Build.0 = Debug|Any CPU
{40CCD816-19FD-4B1D-9E24-AD2099351187}.Debug|ARM.ActiveCfg = Debug|Any CPU
{40CCD816-19FD-4B1D-9E24-AD2099351187}.Debug|ARM.Build.0 = Debug|Any CPU
{40CCD816-19FD-4B1D-9E24-AD2099351187}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{40CCD816-19FD-4B1D-9E24-AD2099351187}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{40CCD816-19FD-4B1D-9E24-AD2099351187}.Debug|x64.ActiveCfg = Debug|Any CPU
{40CCD816-19FD-4B1D-9E24-AD2099351187}.Debug|x64.Build.0 = Debug|Any CPU
{40CCD816-19FD-4B1D-9E24-AD2099351187}.Debug|x86.ActiveCfg = Debug|Any CPU
{40CCD816-19FD-4B1D-9E24-AD2099351187}.Debug|x86.Build.0 = Debug|Any CPU
{40CCD816-19FD-4B1D-9E24-AD2099351187}.Release|Any CPU.ActiveCfg = Release|Any CPU
{40CCD816-19FD-4B1D-9E24-AD2099351187}.Release|Any CPU.Build.0 = Release|Any CPU
{40CCD816-19FD-4B1D-9E24-AD2099351187}.Release|ARM.ActiveCfg = Release|Any CPU
{40CCD816-19FD-4B1D-9E24-AD2099351187}.Release|ARM.Build.0 = Release|Any CPU
{40CCD816-19FD-4B1D-9E24-AD2099351187}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{40CCD816-19FD-4B1D-9E24-AD2099351187}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{40CCD816-19FD-4B1D-9E24-AD2099351187}.Release|x64.ActiveCfg = Release|Any CPU
{40CCD816-19FD-4B1D-9E24-AD2099351187}.Release|x64.Build.0 = Release|Any CPU
{40CCD816-19FD-4B1D-9E24-AD2099351187}.Release|x86.ActiveCfg = Release|Any CPU
{40CCD816-19FD-4B1D-9E24-AD2099351187}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -346,5 +375,6 @@ Global
{21350114-0BF7-4F90-9732-5395840E8CBB} = {68CC2924-E162-44BE-8D7A-DBA385365585}
{4E54ED64-28B4-484F-AD5E-089FD2EC9B8B} = {C2FEEDE5-8CAE-41A4-8932-42D284A86EA7}
{B69CBB57-4D1F-4FBE-B4AB-FD87EDBEE12B} = {05ACA4F0-E560-4E7A-BF50-1C248DAAA0D2}
{40CCD816-19FD-4B1D-9E24-AD2099351187} = {68CC2924-E162-44BE-8D7A-DBA385365585}
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion Test/CoreSDK.Test/Shared/Channel/TransmissionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void SetsContentPropertyToSpecifiedValue()
[TestMethod]
public void ThrowsArgumentNullExceptionWhenContentIsNull()
{
Assert.Throws<ArgumentNullException>(() => new Transmission(new Uri("http://address"), null, "content/type", "content/encoding"));
Assert.Throws<ArgumentNullException>(() => new Transmission(new Uri("http://address"), (byte[])null, "content/type", "content/encoding"));
}

[TestMethod]
Expand Down
1 change: 0 additions & 1 deletion Test/CoreSDK.Test/Shared/Core.Shared.Tests.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
<Compile Include="$(MSBuildThisFileDirectory)Extensibility\Implementation\Tracing\ThreadResourceLockTest.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensibility\Implementation\UserContextTest.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensibility\Implementation\WeakConcurrentRandomTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensibility\SdkVersionPropertyTelemetryInitializerTest.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensibility\TelemetryConfigurationFactoryTest.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensibility\TelemetryConfigurationTest.cs" />
<Compile Include="$(MSBuildThisFileDirectory)OperationTelemetryExtensionsTests.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,13 @@ public void SanitizesTimestampInIsoFormat()
Assert.True(json.Contains("\"time\":\"0001-01-01T00:00:00.0000000Z\""));
}

[TestMethod]
public void IfCallConvertToArrayAndThanDeserializeYouGetSameResult()
{
byte[] array = JsonSerializer.ConvertToByteArray("test");
string result = JsonSerializer.Deserialize(array);

Assert.Equal("test", result);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
#if NET40
using Microsoft.Diagnostics.Tracing;
#endif
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Assert = Xunit.Assert;

[TestClass]
public class DiagnosticsTelemetryModuleTest
Expand All @@ -20,12 +23,12 @@ public void TestModuleDefaultInitialization()
{
initializedModule.Initialize(new TelemetryConfiguration());

Assert.IsTrue(string.IsNullOrEmpty(initializedModule.DiagnosticsInstrumentationKey));
Assert.AreEqual("Error", initializedModule.Severity);
Assert.True(string.IsNullOrEmpty(initializedModule.DiagnosticsInstrumentationKey));
Assert.Equal("Error", initializedModule.Severity);

Assert.AreEqual(2, initializedModule.Senders.Count);
Assert.AreEqual(1, initializedModule.Senders.OfType<PortalDiagnosticsSender>().Count());
Assert.AreEqual(1, initializedModule.Senders.OfType<F5DiagnosticsSender>().Count());
Assert.Equal(2, initializedModule.Senders.Count);
Assert.Equal(1, initializedModule.Senders.OfType<PortalDiagnosticsSender>().Count());
Assert.Equal(1, initializedModule.Senders.OfType<F5DiagnosticsSender>().Count());
}
}

Expand All @@ -38,9 +41,9 @@ public void TestDiagnosticsModuleSetInstrumentationKey()
initializedModule.Initialize(new TelemetryConfiguration());
initializedModule.DiagnosticsInstrumentationKey = diagnosticsInstrumentationKey;

Assert.AreEqual(diagnosticsInstrumentationKey, initializedModule.DiagnosticsInstrumentationKey);
Assert.Equal(diagnosticsInstrumentationKey, initializedModule.DiagnosticsInstrumentationKey);

Assert.AreEqual(
Assert.Equal(
diagnosticsInstrumentationKey,
initializedModule.Senders.OfType<PortalDiagnosticsSender>().First().DiagnosticsInstrumentationKey);
}
Expand All @@ -53,20 +56,51 @@ public void TestDiagnosticsModuleSetSeverity()
{
initializedModule.Initialize(new TelemetryConfiguration());

Assert.AreEqual(EventLevel.Error.ToString(), initializedModule.Severity);
Assert.Equal(EventLevel.Error.ToString(), initializedModule.Severity);

initializedModule.Severity = "Informational";

Assert.AreEqual(EventLevel.Informational, initializedModule.EventListener.LogLevel);
Assert.Equal(EventLevel.Informational, initializedModule.EventListener.LogLevel);
}
}

[TestMethod]
public void TestDiagnosticModuleDoesNotThrowIfInitailizedTwice()
{
DiagnosticsTelemetryModule module = new DiagnosticsTelemetryModule();
module.Initialize(TelemetryConfiguration.Active);
module.Initialize(TelemetryConfiguration.Active);
using (DiagnosticsTelemetryModule module = new DiagnosticsTelemetryModule())
{
module.Initialize(new TelemetryConfiguration());
module.Initialize(new TelemetryConfiguration());
}
}

[TestMethod]
public void DiagnosticModuleDoesNotThrowIfQueueSenderContinuesRecieveEvents()
{
using (DiagnosticsTelemetryModule module = new DiagnosticsTelemetryModule())
{
var queueSender = module.Senders.OfType<PortalDiagnosticsQueueSender>().First();

using (var cancellationTokenSource = new CancellationTokenSource())
{
var taskStarted = new AutoResetEvent(false);
TaskEx.Run(() =>
{
taskStarted.Set();
while (!cancellationTokenSource.IsCancellationRequested)
{
queueSender.Send(new TraceEvent());
Thread.Sleep(1);
}
}, cancellationTokenSource.Token);

taskStarted.WaitOne(TimeSpan.FromSeconds(5));

Assert.DoesNotThrow(() => module.Initialize(new TelemetryConfiguration()));

cancellationTokenSource.Cancel();
}
}
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,11 @@ public void InitializeAddsOperationContextTelemetryInitializerByDefault()
var configuration = new TelemetryConfiguration();
new TestableTelemetryConfigurationFactory().Initialize(configuration, null);

// Assume that SdkVersionInitializer is added by default
var contextInitializer = configuration.TelemetryInitializers[1];
var contextInitializer = configuration.TelemetryInitializers[0];
Assert.IsType<OperationCorrelationTelemetryInitializer>(contextInitializer);
}
#endif
[TestMethod]
public void InitializeAddsSdkVersionTelemetryInitializerByDefault()
{
var configuration = new TelemetryConfiguration();
new TestableTelemetryConfigurationFactory().Initialize(configuration, null);

// Assume that SdkVersionInitializer is added by default
var contextInitializer = configuration.TelemetryInitializers[0];
Assert.IsType<SdkVersionPropertyTelemetryInitializer>(contextInitializer);
}



[TestMethod]
public void InitializeNotifiesTelemetryInitializersImplementingITelemetryModuleInterface()
{
Expand Down Expand Up @@ -610,7 +598,7 @@ public void InitializeAddTelemetryInitializersWithOneInvalid()
var configuration = new TelemetryConfiguration();
new TestableTelemetryConfigurationFactory().Initialize(configuration, null, configFileContents);

Assert.Equal(3, configuration.TelemetryInitializers.Count); // Time and operation initializers are added by default
Assert.Equal(2, configuration.TelemetryInitializers.Count); // Time and operation initializers are added by default
Assert.NotNull(configuration.TelemetryInitializers.First(item => item.GetType().Name == "StubTelemetryInitializer"));
}

Expand Down
27 changes: 27 additions & 0 deletions Test/CoreSDK.Test/Shared/TelemetryClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,33 @@ public void TrackWhenChannelIsNullWillThrowInvalidOperationException()
Assert.Throws<InvalidOperationException>(() => client.TrackTrace("test trace"));
}

[TestMethod]
public void TrackAddsSdkVerionByDefault()
{
var configuration = new TelemetryConfiguration { TelemetryChannel = new StubTelemetryChannel(), InstrumentationKey = Guid.NewGuid().ToString() };
var client = new TelemetryClient(configuration);

client.Context.InstrumentationKey = "Test";
EventTelemetry eventTelemetry = new EventTelemetry("test");
client.Track(eventTelemetry);

Assert.StartsWith("dotnet: ", eventTelemetry.Context.Internal.SdkVersion);
}

[TestMethod]
public void TrackDoesNotOverrideSdkVersion()
{
var configuration = new TelemetryConfiguration { TelemetryChannel = new StubTelemetryChannel(), InstrumentationKey = Guid.NewGuid().ToString() };
var client = new TelemetryClient(configuration);

client.Context.InstrumentationKey = "Test";
EventTelemetry eventTelemetry = new EventTelemetry("test");
eventTelemetry.Context.Internal.SdkVersion = "test";
client.Track(eventTelemetry);

Assert.Equal("test", eventTelemetry.Context.Internal.SdkVersion);
}

#endregion

#region Sampling
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<HintPath>..\..\..\..\packages\Microsoft.Bcl.1.1.10\lib\net40\System.Runtime.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Threading.Tasks">
<HintPath>..\..\..\..\packages\Microsoft.Bcl.1.1.10\lib\net40\System.Threading.Tasks.dll</HintPath>
<Private>True</Private>
Expand Down
Loading

0 comments on commit 0110215

Please sign in to comment.