Skip to content

Commit

Permalink
Merge pull request #1721 from microsoft/develop
Browse files Browse the repository at this point in the history
merge DEVELOP to MASTER (prep 2.14-beta3)
  • Loading branch information
TimothyMothra authored Mar 6, 2020
2 parents 4b24ca2 + aee56cd commit fb33eb7
Show file tree
Hide file tree
Showing 95 changed files with 1,252 additions and 231 deletions.
18 changes: 0 additions & 18 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Bug Report
about: Create a report to help us improve
labels: bug
---

**Describe your environment.** Describe any aspect of your environment relevant to the problem:
* SDK version:
* .NET runtime version (.NET or .NET Core, TargetFramework in the .csproj file):
* Hosting Info (IIS/Azure WebApps/etc):
* Platform and OS version:

If you're reporting a problem with a specific version of a library in this repo, please check whether the problem has been fixed on master.

**Steps to reproduce.**
Describe exactly how to reproduce the error. Include a code sample if applicable.

**What is the expected behavior?**
What did you expect to see?

**What is the actual behavior?**
What did you see instead?

**Additional context.**
Add any other context about the problem here.
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/documentation_issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: Documentation Issue
about: Create a report to help us improve the documents
labels: documentation
---

**Is this a document under https://docs.microsoft.com/en-us/azure/azure-monitor/**
If yes, [file issue against the document repo](https://github.com/MicrosoftDocs/azure-docs/issues/new).

**Does the document belong to this repo?**
If yes, please describe the issue and what you expect to see.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature Request
about: Suggest an idea for this project
labels: enhancement
---

**Is your feature request related to a problem?**
If so, provide a concise description of the problem.

**Describe the solution you'd like.**
What do you want to happen instead? What is the expected behavior?

**Describe alternatives you've considered.**
Which alternative solutions or features have you considered?

**Additional context.**
Add any other context about the feature request here.
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Question
about: Create a question to help us improve our knowledgebase and documentation
labels: question
---

**Describe your environment.**
Describe any aspect of your environment relevant to the question:
* SDK version:
* .NET runtime version (.NET or .NET Core, TargetFramework in the .csproj file):
* Hosting Info (IIS/Azure WebApps/etc):
* Platform and OS version:

**What are you trying to achieve?**
What did you expect to see?

**Additional context.**
Add any other context about the problem here.
2 changes: 1 addition & 1 deletion .props/_GlobalStaticVersion.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<SemanticVersionMajor>2</SemanticVersionMajor>
<SemanticVersionMinor>14</SemanticVersionMinor> <!-- If changing the Minor version, also update the Date value. -->
<SemanticVersionPatch>0</SemanticVersionPatch>
<PreReleaseMilestone>beta2</PreReleaseMilestone> <!--Valid values: beta1, beta2, EMPTY for stable -->
<PreReleaseMilestone>beta3</PreReleaseMilestone> <!--Valid values: beta1, beta2, EMPTY for stable -->
<!--
Date when Semantic Version was changed.
Update for every MINOR release.
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet.ScriptBody.get -> string

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet.ScriptBody.get -> string

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet.ScriptBody.get -> string

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet.ScriptBody.get -> string
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryExtensions
static Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryExtensions.GetEnvelopeName(this Microsoft.ApplicationInsights.Channel.ITelemetry telemetry) -> string
static Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryExtensions.TrySetEnvelopeName(this Microsoft.ApplicationInsights.Channel.ITelemetry telemetry, string envelopeName) -> bool
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryExtensions
static Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryExtensions.GetEnvelopeName(this Microsoft.ApplicationInsights.Channel.ITelemetry telemetry) -> string
static Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryExtensions.TrySetEnvelopeName(this Microsoft.ApplicationInsights.Channel.ITelemetry telemetry, string envelopeName) -> bool
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryExtensions
static Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryExtensions.GetEnvelopeName(this Microsoft.ApplicationInsights.Channel.ITelemetry telemetry) -> string
static Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryExtensions.TrySetEnvelopeName(this Microsoft.ApplicationInsights.Channel.ITelemetry telemetry, string envelopeName) -> bool
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryExtensions
static Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryExtensions.GetEnvelopeName(this Microsoft.ApplicationInsights.Channel.ITelemetry telemetry) -> string
static Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryExtensions.TrySetEnvelopeName(this Microsoft.ApplicationInsights.Channel.ITelemetry telemetry, string envelopeName) -> bool
2 changes: 1 addition & 1 deletion .scripts/tool_FinalizePublicApi.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# After every stable release, all PublicApi text files (Shipped & Unshipped) should be merged.
$path = "..\BASE\PublicAPI";
$path = "..\.publicApi";
$directory = $PSScriptRoot;

$searchPath = Join-Path -Path $directory -ChildPath $path;
Expand Down
1 change: 1 addition & 0 deletions BASE/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<PropsRoot>$(EnlistmentRoot)\.props</PropsRoot>
<RulesetsRoot>$(EnlistmentRoot)\.rulesets</RulesetsRoot>
<TargetsRoot>$(EnlistmentRoot)\.targets</TargetsRoot>
<PublicApiRoot>$(EnlistmentRoot)\.publicApi</PublicApiRoot>


<BinRoot>$(EnlistmentRoot)\..\bin</BinRoot>
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,20 @@
{
public class ItemType
{
public const string Metric = "Microsoft.ApplicationInsights.Metric";
public const string Metric = "AppMetrics";

public const string Request = "Microsoft.ApplicationInsights.Request";
public const string Request = "AppRequests";

public const string Exception = "Microsoft.ApplicationInsights.Exception";
public const string Exception = "AppExceptions";

public const string Message = "Microsoft.ApplicationInsights.Message";
public const string Message = "AppTraces";

public const string Event = "Microsoft.ApplicationInsights.Event";
public const string Event = "AppEvents";

public const string PageView = "Microsoft.ApplicationInsights.PageView";
public const string PageView = "AppPageViews";

public const string PageViewPerformance = "Microsoft.ApplicationInsights.PageViewPerformance";
public const string PageViewPerformance = "AppBrowserTimings";

public const string RemoteDependency = "Microsoft.ApplicationInsights.RemoteDependency";

public const string PerformanceCounter = "Microsoft.ApplicationInsights.PerformanceCounter";

public const string SessionState = "Microsoft.ApplicationInsights.SessionState";
public const string RemoteDependency = "AppDependencies";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Microsoft.ApplicationInsights.DataContracts;
using AI;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.ApplicationInsights.Extensibility.Implementation;

internal class ITelemetryTest<TTelemetry, TEndpointData>
Expand Down Expand Up @@ -222,7 +221,7 @@ private void SerializeWritesTelemetryNameAsExpectedByEndpoint()
.SerializeDeserializeTelemetryItem<TEndpointData>(expected);

Assert.AreEqual(
Constants.TelemetryNamePrefix + "312cbd799dbb4c48a7da3cc2a931cb71." + this.ExtractTelemetryNameFromType(typeof(TTelemetry)),
this.ExtractEnvelopeNameFromType(typeof(TTelemetry)),
actual.name);
}

Expand All @@ -237,7 +236,7 @@ private string ExtractTelemetryNameFromType(Type telemetryType)
else if (telemetryType == typeof(DependencyTelemetry))
{
// handle DeppendencyTelemetry separately
result = "RemoteDependency";
result = "RemoteDependency";
}
#pragma warning disable 618
else if (telemetryType == typeof(SessionStateTelemetry))
Expand All @@ -261,5 +260,63 @@ private string ExtractTelemetryNameFromType(Type telemetryType)

return result;
}

private string ExtractEnvelopeNameFromType(Type telemetryType)
{
string result;

if (telemetryType == typeof(MetricTelemetry))
{
result = ItemType.Metric;
}
else if (telemetryType == typeof(RequestTelemetry))
{
result = ItemType.Request;
}
else if (telemetryType == typeof(ExceptionTelemetry))
{
result = ItemType.Exception;
}
else if (telemetryType == typeof(TraceTelemetry))
{
result = ItemType.Message;
}
else if (telemetryType == typeof(EventTelemetry))
{
result = ItemType.Event;
}
else if (telemetryType == typeof(PageViewTelemetry))
{
result = ItemType.PageView;
}
else if (telemetryType == typeof(PageViewPerformanceTelemetry))
{
result = ItemType.PageViewPerformance;
}
else if (telemetryType == typeof(DependencyTelemetry))
{
result = ItemType.RemoteDependency;
}
#pragma warning disable 618
else if (telemetryType == typeof(SessionStateTelemetry))
{
// handle TraceTelemetry separately
result = ItemType.Event;
}
else if (telemetryType == typeof(PerformanceCounterTelemetry))
{
result = ItemType.Metric;
}
#pragma warning restore 618
else
{
// common logic is to strip out "Telemetry" suffix from the telemetry type
string typeName = telemetryType.Name;
StringAssert.EndsWith(typeName, "Telemetry", "Unknown Telemetry object");
result = typeName.Substring(0, typeName.LastIndexOf("Telemetry", StringComparison.Ordinal));
}

return result;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void SerializeAsStringMethodSerializesATelemetryCorrectly()

// Validates 2 random properties
Assert.IsNotNull(exceptionAsJson);
Assert.AreEqual("Microsoft.ApplicationInsights.Exception", obj["name"].ToString());
Assert.AreEqual(ItemType.Exception, obj["name"].ToString());
}

[TestMethod]
Expand Down Expand Up @@ -112,7 +112,7 @@ public void SerializesUnknownTelemetryIntoCustomEventWithProperties()

TelemetryItem<EventTelemetry> data = obj.ToObject<TelemetryItem<EventTelemetry>>();

Assert.AreEqual("Microsoft.ApplicationInsights.Event", data.name);
Assert.AreEqual(ItemType.Event, data.name);
Assert.AreEqual(Constants.EventNameForUnknownTelemetry, data.data.baseData.Name);
Assert.AreEqual("testUser", data.tags["ai.user.id"]);
Assert.IsTrue(DateTimeOffset.TryParse(data.time, out DateTimeOffset testResult));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
namespace Microsoft.ApplicationInsights.Extensibility.Implementation
{
using Microsoft.ApplicationInsights.Channel;
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

[TestClass]
public class TelemetryExtensionsTests
{
class NonSerializableTelemetry : ITelemetry
{
public DateTimeOffset Timestamp { get; set; }

public TelemetryContext Context { get; set; }

public IExtension Extension { get; set; }
public string Sequence { get; set; }

public ITelemetry DeepClone()
{
return new NonSerializableTelemetry();
}

public void Sanitize()
{}

public void SerializeData(ISerializationWriter serializationWriter)
{}
}

[TestMethod]
public void CanSetEnvelopeNameForSupportedTypes()
{
string testEnvelopeName = "Non_Standard*Envelope.Name";

var at = new AvailabilityTelemetry();
var dt = new DependencyTelemetry();
var et = new EventTelemetry();
var ext = new ExceptionTelemetry();
var mt = new MetricTelemetry();
var pvpt = new PageViewPerformanceTelemetry();
var pvt = new PageViewTelemetry();
var rt = new RequestTelemetry();
#pragma warning disable CS0618 // Type or member is obsolete
var pct = new PerformanceCounterTelemetry();
var sst = new SessionStateTelemetry();
#pragma warning restore CS0618 // Type or member is obsolete

Assert.IsTrue(at.TrySetEnvelopeName(testEnvelopeName));
Assert.IsTrue(dt.TrySetEnvelopeName(testEnvelopeName));
Assert.IsTrue(et.TrySetEnvelopeName(testEnvelopeName));
Assert.IsTrue(ext.TrySetEnvelopeName(testEnvelopeName));
Assert.IsTrue(mt.TrySetEnvelopeName(testEnvelopeName));
Assert.IsTrue(pvpt.TrySetEnvelopeName(testEnvelopeName));
Assert.IsTrue(pvt.TrySetEnvelopeName(testEnvelopeName));
Assert.IsTrue(rt.TrySetEnvelopeName(testEnvelopeName));
Assert.IsTrue(pct.TrySetEnvelopeName(testEnvelopeName));
Assert.IsTrue(sst.TrySetEnvelopeName(testEnvelopeName));

Assert.AreEqual(testEnvelopeName, at.GetEnvelopeName());
Assert.AreEqual(testEnvelopeName, dt.GetEnvelopeName());
Assert.AreEqual(testEnvelopeName, et.GetEnvelopeName());
Assert.AreEqual(testEnvelopeName, ext.GetEnvelopeName());
Assert.AreEqual(testEnvelopeName, mt.GetEnvelopeName());
Assert.AreEqual(testEnvelopeName, pvpt.GetEnvelopeName());
Assert.AreEqual(testEnvelopeName, pvt.GetEnvelopeName());
Assert.AreEqual(testEnvelopeName, rt.GetEnvelopeName());
Assert.AreEqual(testEnvelopeName, pct.Data.GetEnvelopeName());
Assert.AreEqual(testEnvelopeName, sst.Data.GetEnvelopeName());
}

[TestMethod]
public void TrySetEnvelopeNameReturnsFalseForUnsupportedTypes()
{
var nst = new NonSerializableTelemetry();
Assert.IsFalse(nst.TrySetEnvelopeName("Any")); // Returns false, NonSerializableTelemetry does not implement IAiSerializableTelemetry
}

[TestMethod]
public void GetEnvelopeNameReturnsDefaultForUnsupportedTypes()
{
var nst = new NonSerializableTelemetry();
Assert.AreEqual("Event", nst.GetEnvelopeName());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void EnqueuesTransmissionWithExpectedPropertiesForUnknownTelemetry()
Assert.AreEqual("application/x-json-stream", transmission.ContentType);
Assert.AreEqual("gzip", transmission.ContentEncoding);
Assert.AreEqual("{" +
"\"name\":\"Microsoft.ApplicationInsights.Event\"," +
"\"name\":\"AppEvents\"," +
"\"time\":\"0001-01-01T00:00:00.0000000Z\"," +
"\"data\":{\"baseType\":\"EventData\"," +
"\"baseData\":{\"ver\":2," +
Expand All @@ -132,7 +132,7 @@ public void EnqueuesTransmissionWithExpectedPropertiesForKnownTelemetry()
Assert.AreEqual("gzip", transmission.ContentEncoding);

var expectedContent = "{" +
"\"name\":\"Microsoft.ApplicationInsights.StubTelemetryName\"," +
"\"name\":\"StubTelemetryName\"," +
"\"time\":\"0001-01-01T00:00:00.0000000Z\"," +
"\"data\":{\"baseType\":\"StubTelemetryBaseType\"," +
"\"baseData\":{}" +
Expand Down
Loading

0 comments on commit fb33eb7

Please sign in to comment.