Skip to content

Commit

Permalink
PlanBGmbH#91 PlanBGmbH#59 Add App Insights
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusMeyer13 committed Feb 26, 2020
1 parent 368994d commit bb12359
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ProviderId": "Microsoft.ApplicationInsights.ConnectedService.ConnectedServiceProvider",
"Version": "16.0.0.0",
"GettingStartedDocument": {
"Uri": "https://go.microsoft.com/fwlink/?LinkID=798432"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<UserSecretsId>82b45153-dea6-42fe-94f4-c897cc45ea91</UserSecretsId>
<DockerDefaultTargetOS>Windows</DockerDefaultTargetOS>
<Company>PlanB. GmbH</Company>
<ApplicationInsightsResourceId>/subscriptions/0b2d10f3-ce35-4020-a415-33e1455eed50/resourcegroups/PlanButlerV2/providers/microsoft.insights/components/planbutlerbotservicev2</ApplicationInsightsResourceId>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down Expand Up @@ -43,6 +44,10 @@
</PackageReference>
</ItemGroup>

<ItemGroup>
<WCFMetadata Include="Connected Services" />
</ItemGroup>



</Project>
35 changes: 27 additions & 8 deletions PlanB.Butler.Admin/PlanB.Butler.Admin/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// Copyright (c) PlanB. GmbH. All Rights Reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
Expand All @@ -13,27 +17,40 @@

namespace PlanB.Butler.Admin
{
/// <summary>
/// Startup.
/// </summary>
public class Startup
{
/// <summary>
/// Initializes a new instance of the <see cref="Startup"/> class.
/// </summary>
/// <param name="configuration">The configuration.</param>
public Startup(IConfiguration configuration)
{
Configuration = configuration;
this.Configuration = configuration;
}

/// <summary>
/// Gets the configuration.
/// </summary>
/// <value>
/// The configuration.
/// </value>
public IConfiguration Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
/// <summary>
/// This method gets called by the runtime. Use this method to add services to the container.
/// </summary>
/// <param name="services">The services.</param>
public void ConfigureServices(IServiceCollection services)
{
// The following line enables Application Insights telemetry collection.
services.AddApplicationInsightsTelemetry();

services.AddControllersWithViews();
//Set 5 min as the lifetime for the HttpMessageHandler objects in the pool used for the Catalog Typed Client
services.AddHttpClient<IMealService, MealService>()
.SetHandlerLifetime(TimeSpan.FromMinutes(5));

//services.AddHttpClient<IMealService, MealService>(client =>
//{
// client.BaseAddress = new Uri("https://planbbutlerservices.azurewebsites.net/api/");
//});
}

/// <summary>
Expand All @@ -50,9 +67,11 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
else
{
app.UseExceptionHandler("/Home/Error");

// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<!DOCTYPE html>
@inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - PlanB.Butler.Admin</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" />
@Html.Raw(JavaScriptSnippet.FullScript)
</head>
<body>
<header>
Expand Down

0 comments on commit bb12359

Please sign in to comment.