Merge branch 'cithomas/evencounter1_app' of https://github.com/Microsoft/ApplicationInsights-dotnet-server into cithomas/evencounter1_app

This commit is contained in:
Cijo Thomas 2019-06-28 16:25:19 -07:00
Родитель 0bf60899b7 6c53d84c69
Коммит 729a6c940b
10 изменённых файлов: 275 добавлений и 3 удалений

Просмотреть файл

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<ResourceId>/subscriptions/8938312c-1467-4f13-8676-62397dfcdaa1/resourceGroups/cijocore30tests/providers/Microsoft.Web/sites/DemoEventCounterPerfCounter</ResourceId>
<ResourceGroup>cijocore30tests</ResourceGroup>
<PublishProvider>AzureWebSite</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>https://demoeventcounterperfcounter.azurewebsites.net</SiteUrlToLaunchAfterPublish>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<TargetFramework>netcoreapp3.0</TargetFramework>
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
<ProjectGuid>e9d8c14f-c6e5-4203-b182-6f636a1ff687</ProjectGuid>
<SelfContained>true</SelfContained>
<_IsPortable>false</_IsPortable>
<MSDeployServiceURL>demoeventcounterperfcounter.scm.azurewebsites.net:443</MSDeployServiceURL>
<DeployIisAppPath>DemoEventCounterPerfCounter</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>True</EnableMSDeployBackup>
<UserName>$DemoEventCounterPerfCounter</UserName>
<_SavePWD>True</_SavePWD>
<_DestinationType>AzureWebSite</_DestinationType>
</PropertyGroup>
</Project>

Просмотреть файл

@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace DemoLinuxWebApp.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class ValuesController : ControllerBase
{
// GET api/values
[HttpGet]
public ActionResult<IEnumerable<string>> Get()
{
for (int i = 0; i < 1000; i++)
{
var s = Guid.NewGuid();
}
for (int i = 0; i < 1000; i++)
{
try
{
int ss = 10 / 0;
}
catch(Exception ex)
{
}
}
var currentProcess = Process.GetCurrentProcess();
return new string[] { "value1", "value2",
currentProcess.PrivateMemorySize64.ToString(),
currentProcess.VirtualMemorySize64.ToString(),
currentProcess.WorkingSet64.ToString()};
}
// GET api/values/5
[HttpGet("{id}")]
public ActionResult<string> Get(int id)
{
return "value";
}
// POST api/values
[HttpPost]
public void Post([FromBody] string value)
{
}
// PUT api/values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] string value)
{
}
// DELETE api/values/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}

Просмотреть файл

@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.7.1" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PerformanceCollector\PerformanceCollector\Perf.csproj" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace DemoLinuxWebApp
{
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}
}

Просмотреть файл

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<ResourceId>/subscriptions/8938312c-1467-4f13-8676-62397dfcdaa1/resourcegroups/cijolinux1/providers/Microsoft.Web/sites/DemoLinuxWebApp</ResourceId>
<ResourceGroup>cijolinux1</ResourceGroup>
<LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
<SiteUrlToLaunchAfterPublish>https://demolinuxwebapp.azurewebsites.net</SiteUrlToLaunchAfterPublish>
<IsLinux>true</IsLinux>
<PublishProvider>AzureWebSite</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<ExcludeApp_Data>False</ExcludeApp_Data>
<ProjectGuid>a1275c82-bb76-4bf2-a0c4-e4374cb349e4</ProjectGuid>
<MSDeployServiceURL>waws-prod-bay-129.publish.azurewebsites.windows.net:443</MSDeployServiceURL>
<DeployIisAppPath>DemoLinuxWebApp</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>True</EnableMSDeployBackup>
<UserName>$DemoLinuxWebApp</UserName>
<_SavePWD>True</_SavePWD>
<_DestinationType>AzureWebSite</_DestinationType>
</PropertyGroup>
</Project>

Просмотреть файл

@ -0,0 +1,30 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:56582",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"DemoLinuxWebApp": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/values",
"applicationUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

Просмотреть файл

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace DemoLinuxWebApp
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry("e1bc542b-7db3-496f-9928-4415e93439ef");
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseMvc();
}
}
}

Просмотреть файл

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}

Просмотреть файл

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*"
}

Просмотреть файл

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29001.49
# Visual Studio 15
VisualStudioVersion = 15.0.28307.705
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Web", "Web", "{1A75535C-B8E5-4C31-BC6E-50456C8C4052}"
EndProject
@ -94,7 +94,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventCounterCollector", "Ev
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventCounterCollector.Tests", "EventCounterCollector\EventCounterCollector.Tests\EventCounterCollector.Tests\EventCounterCollector.Tests.csproj", "{6ABC0D66-F577-44A7-8F61-B23882B7A1FF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DemoEventCounterPerfCounter", "DemoEventCounterPerfCounter\DemoEventCounterPerfCounter.csproj", "{E9D8C14F-C6E5-4203-B182-6F636A1FF687}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DemoEventCounterPerfCounter", "DemoEventCounterPerfCounter\DemoEventCounterPerfCounter.csproj", "{E9D8C14F-C6E5-4203-B182-6F636A1FF687}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DemoLinuxWebApp", "DemoLinuxWebApp\DemoLinuxWebApp.csproj", "{A1275C82-BB76-4BF2-A0C4-E4374CB349E4}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
@ -275,6 +277,14 @@ Global
{E9D8C14F-C6E5-4203-B182-6F636A1FF687}.Release|Any CPU.Build.0 = Release|Any CPU
{E9D8C14F-C6E5-4203-B182-6F636A1FF687}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{E9D8C14F-C6E5-4203-B182-6F636A1FF687}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{A1275C82-BB76-4BF2-A0C4-E4374CB349E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1275C82-BB76-4BF2-A0C4-E4374CB349E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1275C82-BB76-4BF2-A0C4-E4374CB349E4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{A1275C82-BB76-4BF2-A0C4-E4374CB349E4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{A1275C82-BB76-4BF2-A0C4-E4374CB349E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1275C82-BB76-4BF2-A0C4-E4374CB349E4}.Release|Any CPU.Build.0 = Release|Any CPU
{A1275C82-BB76-4BF2-A0C4-E4374CB349E4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{A1275C82-BB76-4BF2-A0C4-E4374CB349E4}.Release|Mixed Platforms.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE