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

Commit 4b61272

Browse files
author
Anastasia Baranchenkova
committed
2 parents 8f72f27 + f3f7969 commit 4b61272

File tree

8 files changed

+227
-39
lines changed

8 files changed

+227
-39
lines changed

NuGet.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<configuration>
33
<packageSources>
44
<add key="ASP.NET vNext" value="https://www.myget.org/F/aspnetrelease/api/v2/" />
5-
<add key="Application Insights" value="http://appinsights-aspnet.azurewebsites.net/nuget/" />
65
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
76
</packageSources>
87
</configuration>

Readme.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ This repository has a code for [Application Insights monitoring](http://azure.mi
77
Getting Started
88
---------------
99

10-
Add NuGet feed http://appinsights-aspnet.azurewebsites.net/nuget/. It has NuGet: Microsoft.ApplicationInsights.AspNet.
11-
1210
For standard Asp.Net template you need to modify four files (this will be the default template instrumentation in future).
1311

1412
***project.json***
1513
Add new reference:
1614
```
17-
"Microsoft.ApplicationInsights.AspNet": "1.0.0.0-alpha"
15+
"Microsoft.ApplicationInsights.AspNet": "0.30.0.1-beta"
1816
```
1917

2018
***config.json***
@@ -82,7 +80,7 @@ Developing
8280
----------
8381
1. Repository (private now): https://github.com/microsoft/AppInsights-aspnetv5
8482
2. Asp.Net information: https://github.com/aspnet/home
85-
3. Install VS 2015 RC.
83+
3. SDK is build with beta4 asp.net nuget packages so it cannot run with Visual Studio 2015 CTP6. You'll need to use dnx directly like explained in this [article](http://www.dzone.com/articles/developing-and-self-hosting). Please note, that recently "k" was renamed to "dnx" - you'll need to adjust instructions accordingly.
8684

8785

8886
Running and writing tests
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
#if fakeportable
2+
using Microsoft.ApplicationInsights.Channel;
3+
using Microsoft.ApplicationInsights.DataContracts;
4+
using System;
5+
using System.Collections.Generic;
6+
7+
namespace Microsoft.ApplicationInsights
8+
{
9+
public class TelemetryClient
10+
{
11+
public TelemetryContext Context { get; }
12+
public void TrackEvent(string eventName)
13+
{
14+
}
15+
public void TrackEvent(EventTelemetry telemetry)
16+
{
17+
}
18+
public void TrackMetric(string name, double value)
19+
{
20+
}
21+
public void TrackMetric(string name, double average, int sampleCount, double min, double max, IDictionary<string, string> properties)
22+
{
23+
}
24+
public void TrackRequest(RequestTelemetry request)
25+
{
26+
}
27+
public void TrackException(Exception exception)
28+
{
29+
}
30+
public void TrackTrace(string message)
31+
{
32+
}
33+
public void TrackTrace(string message, SeverityLevel? severityLevel)
34+
{
35+
}
36+
public void TrackTrace(string message, IDictionary<string, string> properties)
37+
{
38+
}
39+
public void TrackTrace(string message, SeverityLevel? severityLevel, IDictionary<string, string> properties)
40+
{
41+
}
42+
}
43+
}
44+
namespace Microsoft.ApplicationInsights.Channel
45+
{
46+
public interface ITelemetry
47+
{
48+
TelemetryContext Context { get; }
49+
}
50+
public interface ITelemetryChannel : IDisposable
51+
{
52+
bool DeveloperMode { get; set; }
53+
}
54+
}
55+
56+
namespace Microsoft.ApplicationInsights.DataContracts
57+
{
58+
public class TelemetryContext
59+
{
60+
public string InstrumentationKey { get; set; }
61+
public OperationContext Operation { get; }
62+
public LocationContext Location { get; }
63+
public DeviceContext Device { get; }
64+
public SessionContext Session { get; }
65+
public UserContext User { get; }
66+
}
67+
68+
public class OperationContext
69+
{
70+
public string Id { get; set; }
71+
public string Name { get; set; }
72+
}
73+
74+
public class LocationContext
75+
{
76+
public string Ip { get; set; }
77+
}
78+
79+
public class DeviceContext
80+
{
81+
public string RoleInstance { get; set; }
82+
}
83+
84+
public class SessionContext
85+
{
86+
public string Id { get; set; }
87+
}
88+
89+
public class UserContext
90+
{
91+
public string Id { get; set; }
92+
public string UserAgent { get; set; }
93+
public string AccountId { get; set; }
94+
public DateTimeOffset? AcquisitionDate { get; set; }
95+
}
96+
97+
public class RequestTelemetry : ITelemetry
98+
{
99+
public ITelemetryChannel TelemetryChannel { get; set; }
100+
public TelemetryContext Context { get; }
101+
public TimeSpan Duration { get; set; }
102+
public string HttpMethod { get; set; }
103+
public string Id { get; set; }
104+
public IDictionary<string, double> Metrics { get; }
105+
public string Name { get; set; }
106+
public IDictionary<string, string> Properties { get; }
107+
public string ResponseCode { get; set; }
108+
public string Sequence { get; set; }
109+
public bool Success { get; set; }
110+
public DateTimeOffset Timestamp { get; set; }
111+
public Uri Url { get; set; }
112+
}
113+
114+
public class EventTelemetry : ITelemetry
115+
{
116+
private TelemetryContext context = new TelemetryContext();
117+
public DateTimeOffset Timestamp { get; set; }
118+
public string Sequence { get; set; }
119+
120+
public TelemetryContext Context
121+
{
122+
get
123+
{
124+
return this.context;
125+
}
126+
}
127+
}
128+
129+
public class MetricTelemetry : ITelemetry
130+
{
131+
private TelemetryContext context = new TelemetryContext();
132+
public DateTimeOffset Timestamp { get; set; }
133+
public string Sequence { get; set; }
134+
public TelemetryContext Context
135+
{
136+
get
137+
{
138+
return this.context;
139+
}
140+
}
141+
}
142+
143+
public class TraceTelemetry : ITelemetry
144+
{
145+
private TelemetryContext context = new TelemetryContext();
146+
public DateTimeOffset Timestamp { get; set; }
147+
public string Sequence { get; set; }
148+
public TelemetryContext Context
149+
{
150+
get
151+
{
152+
return this.context;
153+
}
154+
}
155+
}
156+
157+
public enum SeverityLevel
158+
{
159+
Verbose,
160+
Information,
161+
Warning,
162+
Error,
163+
Critical
164+
}
165+
}
166+
167+
namespace Microsoft.ApplicationInsights.Extensibility
168+
{
169+
public class TelemetryConfiguration
170+
{
171+
public ITelemetryChannel TelemetryChannel { get; set; }
172+
public string InstrumentationKey { get; set; }
173+
public IList<IContextInitializer> ContextInitializers { get; }
174+
public IList<ITelemetryInitializer> TelemetryInitializers { get; }
175+
public static TelemetryConfiguration CreateDefault()
176+
{
177+
return new TelemetryConfiguration();
178+
}
179+
}
180+
181+
public class TimestampPropertyInitializer
182+
{
183+
}
184+
185+
public interface IContextInitializer
186+
{
187+
}
188+
189+
public interface ITelemetryInitializer
190+
{
191+
}
192+
}
193+
194+
namespace System.Net.NetworkInformation
195+
{
196+
public class IPGlobalProperties
197+
{
198+
public string DomainName { get; }
199+
public static IPGlobalProperties GetIPGlobalProperties()
200+
{
201+
return new IPGlobalProperties();
202+
}
203+
}
204+
}
205+
#endif
206+

src/Microsoft.ApplicationInsights.AspNet/Microsoft.ApplicationInsights.AspNet.xproj

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@
1010
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
1111
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
1212
</PropertyGroup>
13-
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
14-
<AssemblyName>Microsoft.ApplicationInsights.AspNet</AssemblyName>
15-
</PropertyGroup>
13+
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" />
1614
<PropertyGroup>
15+
<AssemblyName>Microsoft.ApplicationInsights.AspNet</AssemblyName>
1716
<SchemaVersion>2.0</SchemaVersion>
1817
</PropertyGroup>
19-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
18+
<PropertyGroup>
2019
<ProduceOutputsOnBuild>True</ProduceOutputsOnBuild>
2120
</PropertyGroup>
22-
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" />
2321
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" />
2422
</Project>

src/Microsoft.ApplicationInsights.AspNet/project.json

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
11
{
2+
"title": "Application Insights for ASP.NET 5 Web Applications",
23
"description": "Application Insights for ASP.NET 5 web applications. See http://go.microsoft.com/fwlink/?LinkID=510752 for more information.",
34
"authors": [ "Microsoft" ],
4-
"version": "1.0.0-*",
5+
"version": "0.30.0.1-beta",
6+
"copyright": "Copyright © Microsoft. All Rights Reserved.",
57
"projectUrl": "https://github.com/Microsoft/AppInsights-aspnetv5",
8+
"licenseUrl": "http://go.microsoft.com/fwlink/?LinkID=510709",
9+
"requireLicenseAcceptance": true,
10+
"iconUrl": "http://appanacdn.blob.core.windows.net/cdn/icons/aic.png",
611
"tags": [ "Analytics", "ApplicationInsights", "Telemetry", "AppInsights" ],
7-
/* TODO: Include and verify additional properties after upgrading to VS2015 RC and beta 5.
8-
* For details, see:
9-
* https://github.com/aspnet/dnx/issues/1302
10-
* https://github.com/aspnet/dnx/blob/dev/src/Microsoft.Framework.PackageManager/Building/BuildManager.cs#L237
11-
12-
"title": "Application Insights for ASP.NET 5 Web Applications",
13-
"copyright": "Copyright © Microsoft. All Rights Reserved.",
14-
"iconUrl": "http://appanacdn.blob.core.windows.net/cdn/icons/aic.png",
15-
"licenseUrl": "http://go.microsoft.com/fwlink/?LinkID=510709",
16-
"requireLicenseAcceptance": true,
17-
18-
* Do we need these?
19-
"summary": "Application Insights for ASP.NET 5 Web Applications",
20-
"owners": ["AppInsightsSdk"],
21-
*/
2212
"dependencies": {
2313
"Microsoft.AspNet.Hosting": "1.0.0-beta4-*",
2414
"Microsoft.Framework.Logging": "1.0.0-beta4-*",
@@ -35,12 +25,8 @@
3525
}
3626
},
3727
"dnxcore50": {
38-
"dependencies": {
39-
"System.Collections": "4.0.10-beta-22807",
40-
"System.Linq": "4.0.0-beta-22807",
41-
"System.Threading": "4.0.10-beta-22807",
42-
"Microsoft.CSharp": "4.0.0-beta-22807",
43-
"Microsoft.ApplicationInsights.Portable": "0.30.0.0-beta"
28+
"compilationOptions": {
29+
"define": [ "fakeportable" ]
4430
}
4531
}
4632
}

test/FunctionalTestUtils/project.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@
1818
},
1919
"dnxcore50": {
2020
"dependencies": {
21-
"System.Collections": "4.0.10-beta-22807",
22-
"System.Linq": "4.0.0-beta-22807",
23-
"System.Threading": "4.0.10-beta-22807",
24-
"Microsoft.CSharp": "4.0.0-beta-22807",
25-
"Microsoft.ApplicationInsights.Portable": "0.30.0.0-beta"
21+
"Microsoft.ApplicationInsights.AspNet": "0.30.0.1-beta"
2622
}
2723
}
2824
}

test/Microsoft.ApplicationInsights.AspNet.Tests/project.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"System.Runtime": "4.0.20-beta-*"
2020
}
2121
},
22-
"dnxcore50": {
23-
}
22+
"dnxcore50": { }
2423
}
2524
}

test/SampleWebAppIntegration/project.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,14 @@
3636
"frameworks": {
3737
"dnx451": {
3838
"dependencies": {
39+
"Microsoft.ApplicationInsights": "0.13.4-build00460",
3940
"System.Runtime": "4.0.20-beta-*"
4041
}
42+
},
43+
"dnxcore50": {
44+
"dependencies": {
45+
"Microsoft.ApplicationInsights.AspNet": "0.30.0.1-beta"
46+
}
4147
}
4248
},
4349
"exclude": [

0 commit comments

Comments
 (0)