();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "label": "Build Unit tests",
6 | "command": "dotnet",
7 | "type": "process",
8 | "args": [
9 | "build",
10 | "${workspaceFolder}/UnitTests/UnitTests.csproj"
11 | ],
12 | "problemMatcher": "$tsc"
13 | },
14 | {
15 | "label": "Run Unit Tests",
16 | "command": "dotnet",
17 | "type": "process",
18 | "group": "test",
19 | "options": {
20 | "cwd": "${workspaceFolder}/UnitTests"
21 | },
22 | "args": [
23 | "test"
24 | ],
25 | "problemMatcher": "$msCompile"
26 | }
27 | ]
28 | }
--------------------------------------------------------------------------------
/examples/BasicUsage/BasicUsage.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.0
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/examples/BasicUsage/wwwroot/css/site.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 50px;
3 | padding-bottom: 20px;
4 | }
5 |
6 | /* Wrapping element */
7 | /* Set some basic padding to keep content from hitting the edges */
8 | .body-content {
9 | padding-left: 15px;
10 | padding-right: 15px;
11 | }
12 |
13 | /* Carousel */
14 | .carousel-caption p {
15 | font-size: 20px;
16 | line-height: 1.4;
17 | }
18 |
19 | /* Make .svg files in the carousel display properly in older browsers */
20 | .carousel-inner .item img[src$=".svg"] {
21 | width: 100%;
22 | }
23 |
24 | /* QR code generator */
25 | #qrCode {
26 | margin: 15px;
27 | }
28 |
29 | /* Hide/rearrange for smaller screens */
30 | @media screen and (max-width: 767px) {
31 | /* Hide captions */
32 | .carousel-caption {
33 | display: none;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/examples/MultipleIKeys/wwwroot/css/site.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 50px;
3 | padding-bottom: 20px;
4 | }
5 |
6 | /* Wrapping element */
7 | /* Set some basic padding to keep content from hitting the edges */
8 | .body-content {
9 | padding-left: 15px;
10 | padding-right: 15px;
11 | }
12 |
13 | /* Carousel */
14 | .carousel-caption p {
15 | font-size: 20px;
16 | line-height: 1.4;
17 | }
18 |
19 | /* Make .svg files in the carousel display properly in older browsers */
20 | .carousel-inner .item img[src$=".svg"] {
21 | width: 100%;
22 | }
23 |
24 | /* QR code generator */
25 | #qrCode {
26 | margin: 15px;
27 | }
28 |
29 | /* Hide/rearrange for smaller screens */
30 | @media screen and (max-width: 767px) {
31 | /* Hide captions */
32 | .carousel-caption {
33 | display: none;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/examples/WindowsContainer/wwwroot/css/site.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 50px;
3 | padding-bottom: 20px;
4 | }
5 |
6 | /* Wrapping element */
7 | /* Set some basic padding to keep content from hitting the edges */
8 | .body-content {
9 | padding-left: 15px;
10 | padding-right: 15px;
11 | }
12 |
13 | /* Carousel */
14 | .carousel-caption p {
15 | font-size: 20px;
16 | line-height: 1.4;
17 | }
18 |
19 | /* Make .svg files in the carousel display properly in older browsers */
20 | .carousel-inner .item img[src$=".svg"] {
21 | width: 100%;
22 | }
23 |
24 | /* QR code generator */
25 | #qrCode {
26 | margin: 15px;
27 | }
28 |
29 | /* Hide/rearrange for smaller screens */
30 | @media screen and (max-width: 767px) {
31 | /* Hide captions */
32 | .carousel-caption {
33 | display: none;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/examples/WindowsContainer/AspNetCoreNano.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.0
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/examples/ZeroUserCodeLightup/wwwroot/css/site.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 50px;
3 | padding-bottom: 20px;
4 | }
5 |
6 | /* Wrapping element */
7 | /* Set some basic padding to keep content from hitting the edges */
8 | .body-content {
9 | padding-left: 15px;
10 | padding-right: 15px;
11 | }
12 |
13 | /* Carousel */
14 | .carousel-caption p {
15 | font-size: 20px;
16 | line-height: 1.4;
17 | }
18 |
19 | /* Make .svg files in the carousel display properly in older browsers */
20 | .carousel-inner .item img[src$=".svg"] {
21 | width: 100%;
22 | }
23 |
24 | /* QR code generator */
25 | #qrCode {
26 | margin: 15px;
27 | }
28 |
29 | /* Hide/rearrange for smaller screens */
30 | @media screen and (max-width: 767px) {
31 | /* Hide captions */
32 | .carousel-caption {
33 | display: none;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/examples/BasicUsage/k8s.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: extensions/v1beta1
2 | kind: Deployment
3 | metadata:
4 | name: ai-k8s-basic
5 | spec:
6 | replicas: 1
7 | template:
8 | metadata:
9 | labels:
10 | app: webapp
11 | spec:
12 | containers:
13 | - name: ai-k8s-basic-container
14 | image: dockeraccount/aik8sbasic:latest
15 | ports:
16 | - containerPort: 80
17 | env:
18 | - name: APPINSIGHTS_INSTRUMENTATIONKEY
19 | value: YOUR-APPINSIGHTS-INSTRUMENTATION-KEY
20 | ---
21 | apiVersion: v1
22 | kind: Service
23 | metadata:
24 | name: ai-k8s-basic
25 | annotations:
26 | service.beta.kubernetes.io/external-traffic: OnlyLocal
27 | spec:
28 | ports:
29 | - name: http-port
30 | port: 80
31 | targetPort: 80
32 | selector:
33 | app: webapp
34 | type: LoadBalancer
35 |
--------------------------------------------------------------------------------
/examples/BasicUsage_clr21_RBAC/k8s/k8s.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: extensions/v1beta1
2 | kind: Deployment
3 | metadata:
4 | name: ai-k8s-basic
5 | spec:
6 | replicas: 1
7 | template:
8 | metadata:
9 | labels:
10 | app: webapp
11 | spec:
12 | containers:
13 | - name: ai-k8s-basic-container
14 | image: dockeraccount/aik8sbasic_rbac:latest
15 | ports:
16 | - containerPort: 80
17 | env:
18 | - name: APPINSIGHTS_INSTRUMENTATIONKEY
19 | value: Your-Own-Application-Insights-Key
20 | ---
21 | apiVersion: v1
22 | kind: Service
23 | metadata:
24 | name: ai-k8s-basic
25 | annotations:
26 | service.beta.kubernetes.io/external-traffic: OnlyLocal
27 | spec:
28 | ports:
29 | - name: http-port
30 | port: 80
31 | targetPort: 80
32 | selector:
33 | app: webapp
34 | type: LoadBalancer
--------------------------------------------------------------------------------
/examples/MultipleIKeys/k8s.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: extensions/v1beta1
2 | kind: Deployment
3 | metadata:
4 | name: ai-k8s-multi-ikey
5 | spec:
6 | replicas: 1
7 | template:
8 | metadata:
9 | labels:
10 | app: webapp
11 | spec:
12 | containers:
13 | - name: ai-k8s-multi-ikey-container
14 | image: dockeraccount/aik8sbasic:latest
15 | ports:
16 | - containerPort: 80
17 | env:
18 | - name: APPINSIGHTS_INSTRUMENTATIONKEY
19 | value: 5789ad10-8b39-4f8a-88dc-632d1342d5e0
20 | ---
21 | apiVersion: v1
22 | kind: Service
23 | metadata:
24 | name: ai-k8s-multi-ikey
25 | annotations:
26 | service.beta.kubernetes.io/external-traffic: OnlyLocal
27 | spec:
28 | ports:
29 | - name: http-port
30 | port: 80
31 | targetPort: 80
32 | selector:
33 | app: webapp
34 | type: LoadBalancer
--------------------------------------------------------------------------------
/src/ApplicationInsights.Kubernetes/Debuggings/KubeDebuggingHttpClientSettings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Http;
3 |
4 | namespace Microsoft.ApplicationInsights.Kubernetes.Debugging
5 | {
6 | internal class KubeHttpDebuggingClientSettings : IKubeHttpClientSettingsProvider
7 | {
8 | public const string FakeContainerId = "F8E1C6FF-2217-4962-90FF-0D9195AF0785";
9 |
10 | public string ContainerId => FakeContainerId;
11 |
12 | public string QueryNamespace => "063A30B8-6A62-4519-8BFE-0DE144B009A1";
13 |
14 | public Uri ServiceBaseAddress => new Uri("http://localhost/stub");
15 |
16 | public HttpMessageHandler CreateMessageHandler()
17 | {
18 | return null;
19 | }
20 |
21 | public string GetToken()
22 | {
23 | return null;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/examples/WindowsContainer/k8s/k8s.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: extensions/v1beta1
2 | kind: Deployment
3 | metadata:
4 | name: iis
5 | spec:
6 | replicas: 1
7 | template:
8 | metadata:
9 | labels:
10 | app: iis
11 | spec:
12 | containers:
13 | - name: iis
14 | image: dockeraccount/aspnetcorenano:latest
15 | ports:
16 | - containerPort: 80
17 | - containerPort: 443
18 | env:
19 | - name: APPINSIGHTS_KUBERNETES_POD_NAME
20 | valueFrom:
21 | fieldRef:
22 | fieldPath: metadata.name
23 | nodeSelector:
24 | beta.kubernetes.io/os: windows
25 | ---
26 | apiVersion: v1
27 | kind: Service
28 | metadata:
29 | name: iis-svc
30 | spec:
31 | ports:
32 | - name: http-port
33 | port: 80
34 | targetPort: 80
35 | selector:
36 | app: iis
37 | type: LoadBalancer
38 |
--------------------------------------------------------------------------------
/dev/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": ".NET Core Launch - F5 WebApi",
9 | "type": "coreclr",
10 | "request": "launch",
11 | "preLaunchTask": "Build F5 WebApi",
12 | "program": "${workspaceFolder}/F5WebApi/bin/Debug/netcoreapp2.2/F5WebApi.dll",
13 | "args": [],
14 | "cwd": "${workspaceFolder}/F5WebApi",
15 | "stopAtEntry": false,
16 | "launchBrowser": {
17 | "enabled": true
18 | },
19 | "env": {
20 | "ASPNETCORE_ENVIRONMENT": "Development"
21 | }
22 | }
23 | ]
24 | }
--------------------------------------------------------------------------------
/dev/F5WebApi/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/launchsettings.json",
3 | "iisSettings": {
4 | "windowsAuthentication": false,
5 | "anonymousAuthentication": true,
6 | "iisExpress": {
7 | "applicationUrl": "http://localhost:31345",
8 | "sslPort": 44371
9 | }
10 | },
11 | "profiles": {
12 | "IIS Express": {
13 | "commandName": "IISExpress",
14 | "launchBrowser": true,
15 | "launchUrl": "api/values",
16 | "environmentVariables": {
17 | "ASPNETCORE_ENVIRONMENT": "Development"
18 | }
19 | },
20 | "F5WebApi": {
21 | "commandName": "Project",
22 | "launchBrowser": true,
23 | "launchUrl": "api/values",
24 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
25 | "environmentVariables": {
26 | "ASPNETCORE_ENVIRONMENT": "Development"
27 | }
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/src/ApplicationInsights.Kubernetes/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 |
3 | // Allow unit tests to access internal members
4 | [assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.Kubernetes.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
5 | [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
6 |
--------------------------------------------------------------------------------
/src/ApplicationInsights.Kubernetes.HostingStartup/K8sInjection.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Hosting;
2 | using Microsoft.Extensions.DependencyInjection;
3 |
4 | namespace ApplicationInsights.Kubernetes.HostingStartup
5 | {
6 | ///
7 | /// Hosting Startup point for Application Insights for Kubernetes.
8 | ///
9 | public class K8sInjection : IHostingStartup
10 | {
11 | ///
12 | /// Configures the Application Insights for Kubernetes.
13 | ///
14 | /// The web host builder.
15 | public void Configure(IWebHostBuilder builder)
16 | {
17 | builder.ConfigureServices((cxt, services) =>
18 | {
19 | services.AddApplicationInsightsKubernetesEnricher();
20 | services.AddApplicationInsightsTelemetry(cxt.Configuration);
21 | });
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/ApplicationInsights.Kubernetes/Utilities/StringUtils.cs:
--------------------------------------------------------------------------------
1 | namespace Microsoft.ApplicationInsights.Kubernetes
2 | {
3 | using System;
4 | using System.Globalization;
5 | internal static class StringUtils
6 | {
7 | public static string Invariant(FormattableString formattable)
8 | {
9 | return formattable.ToString(CultureInfo.InvariantCulture);
10 | }
11 |
12 | public static string GetReadableSize(this long numInBytes)
13 | {
14 | double doubleBytes = numInBytes;
15 | string[] sizes = { "B", "KB", "MB", "GB", "TB" };
16 | int order = 0;
17 | while (doubleBytes >= 1024 && order < sizes.Length - 1)
18 | {
19 | order++;
20 | doubleBytes /= 1024.0;
21 | }
22 |
23 | return String.Format(CultureInfo.InvariantCulture, "{0:0.#}{1}", doubleBytes, sizes[order]);
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/examples/BasicUsage/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @model ErrorViewModel
2 | @{
3 | ViewData["Title"] = "Error";
4 | }
5 |
6 | Error.
7 | An error occurred while processing your request.
8 |
9 | @if (Model.ShowRequestId)
10 | {
11 |
12 | Request ID: @Model.RequestId
13 |
14 | }
15 |
16 | Development Mode
17 |
18 | Swapping to Development environment will display more detailed information about the error that occurred.
19 |
20 |
21 | Development environment should not be enabled in deployed applications , as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development , and restarting the application.
22 |
23 |
--------------------------------------------------------------------------------
/examples/MultipleIKeys/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @model ErrorViewModel
2 | @{
3 | ViewData["Title"] = "Error";
4 | }
5 |
6 | Error.
7 | An error occurred while processing your request.
8 |
9 | @if (Model.ShowRequestId)
10 | {
11 |
12 | Request ID: @Model.RequestId
13 |
14 | }
15 |
16 | Development Mode
17 |
18 | Swapping to Development environment will display more detailed information about the error that occurred.
19 |
20 |
21 | Development environment should not be enabled in deployed applications , as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development , and restarting the application.
22 |
23 |
--------------------------------------------------------------------------------
/troubleshooting/AIK8sTroubleShooting/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/launchsettings.json",
3 | "iisSettings": {
4 | "windowsAuthentication": false,
5 | "anonymousAuthentication": true,
6 | "iisExpress": {
7 | "applicationUrl": "http://localhost:16373",
8 | "sslPort": 44324
9 | }
10 | },
11 | "profiles": {
12 | "IIS Express": {
13 | "commandName": "IISExpress",
14 | "launchBrowser": true,
15 | "launchUrl": "api/values",
16 | "environmentVariables": {
17 | "ASPNETCORE_ENVIRONMENT": "Development"
18 | }
19 | },
20 | "AIK8sTroubleShooting": {
21 | "commandName": "Project",
22 | "launchBrowser": true,
23 | "launchUrl": "api/values",
24 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
25 | "environmentVariables": {
26 | "ASPNETCORE_ENVIRONMENT": "Development"
27 | }
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/examples/WindowsContainer/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @model ErrorViewModel
2 | @{
3 | ViewData["Title"] = "Error";
4 | }
5 |
6 | Error.
7 | An error occurred while processing your request.
8 |
9 | @if (Model.ShowRequestId)
10 | {
11 |
12 | Request ID: @Model.RequestId
13 |
14 | }
15 |
16 | Development Mode
17 |
18 | Swapping to Development environment will display more detailed information about the error that occurred.
19 |
20 |
21 | Development environment should not be enabled in deployed applications , as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development , and restarting the application.
22 |
23 |
--------------------------------------------------------------------------------
/examples/ZeroUserCodeLightup/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @model ErrorViewModel
2 | @{
3 | ViewData["Title"] = "Error";
4 | }
5 |
6 | Error.
7 | An error occurred while processing your request.
8 |
9 | @if (Model.ShowRequestId)
10 | {
11 |
12 | Request ID: @Model.RequestId
13 |
14 | }
15 |
16 | Development Mode
17 |
18 | Swapping to Development environment will display more detailed information about the error that occurred.
19 |
20 |
21 | Development environment should not be enabled in deployed applications , as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development , and restarting the application.
22 |
23 |
--------------------------------------------------------------------------------
/examples/BasicUsage_clr21_RBAC/app/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @model ErrorViewModel
2 | @{
3 | ViewData["Title"] = "Error";
4 | }
5 |
6 | Error.
7 | An error occurred while processing your request.
8 |
9 | @if (Model.ShowRequestId)
10 | {
11 |
12 | Request ID: @Model.RequestId
13 |
14 | }
15 |
16 | Development Mode
17 |
18 | Swapping to Development environment will display more detailed information about the error that occurred.
19 |
20 |
21 | Development environment should not be enabled in deployed applications , as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development , and restarting the application.
22 |
23 |
--------------------------------------------------------------------------------
/src/ApplicationInsights.Kubernetes/EntityExtensions/ReplicaSetExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace Microsoft.ApplicationInsights.Kubernetes
2 | {
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using Microsoft.ApplicationInsights.Kubernetes.Entities;
6 |
7 | internal static class ReplicaSetExtensions
8 | {
9 | public static K8sDeployment GetMyDeployment(this K8sReplicaSet self, IEnumerable scope)
10 | {
11 | IDictionary replicaLabels = self.Metadata.Labels;
12 |
13 | foreach (K8sDeployment deployment in scope)
14 | {
15 | IDictionary matchRule = deployment.Spec.Selector.MatchLabels;
16 | if (matchRule.Intersect(replicaLabels).Count() == matchRule.Count)
17 | {
18 | // All labels are matched
19 | return deployment;
20 | }
21 | }
22 | return null;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/examples/BasicUsage/Controllers/HomeController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Mvc;
7 | using BasicUsage.Models;
8 |
9 | namespace BasicUsage.Controllers
10 | {
11 | public class HomeController : Controller
12 | {
13 | public IActionResult Index()
14 | {
15 | return View();
16 | }
17 |
18 | public IActionResult About()
19 | {
20 | ViewData["Message"] = "Your application description page.";
21 |
22 | return View();
23 | }
24 |
25 | public IActionResult Contact()
26 | {
27 | ViewData["Message"] = "Your contact page.";
28 |
29 | return View();
30 | }
31 |
32 | public IActionResult Error()
33 | {
34 | return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/examples/MultipleIKeys/Controllers/HomeController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Mvc;
7 | using MultipleIKeys.Models;
8 |
9 | namespace MultipleIKeys.Controllers
10 | {
11 | public class HomeController : Controller
12 | {
13 | public IActionResult Index()
14 | {
15 | return View();
16 | }
17 |
18 | public IActionResult About()
19 | {
20 | ViewData["Message"] = "Your application description page.";
21 |
22 | return View();
23 | }
24 |
25 | public IActionResult Contact()
26 | {
27 | ViewData["Message"] = "Your contact page.";
28 |
29 | return View();
30 | }
31 |
32 | public IActionResult Error()
33 | {
34 | return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/examples/BasicUsage_clr21_RBAC/app/wwwroot/css/site.css:
--------------------------------------------------------------------------------
1 | /* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification\
2 | for details on configuring this project to bundle and minify static web assets. */
3 | body {
4 | padding-top: 50px;
5 | padding-bottom: 20px;
6 | }
7 |
8 | /* Wrapping element */
9 | /* Set some basic padding to keep content from hitting the edges */
10 | .body-content {
11 | padding-left: 15px;
12 | padding-right: 15px;
13 | }
14 |
15 | /* Carousel */
16 | .carousel-caption p {
17 | font-size: 20px;
18 | line-height: 1.4;
19 | }
20 |
21 | /* Make .svg files in the carousel display properly in older browsers */
22 | .carousel-inner .item img[src$=".svg"] {
23 | width: 100%;
24 | }
25 |
26 | /* QR code generator */
27 | #qrCode {
28 | margin: 15px;
29 | }
30 |
31 | /* Hide/rearrange for smaller screens */
32 | @media screen and (max-width: 767px) {
33 | /* Hide captions */
34 | .carousel-caption {
35 | display: none;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/examples/WindowsContainer/Controllers/HomeController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Mvc;
7 | using AspNetCoreNano.Models;
8 |
9 | namespace AspNetCoreNano.Controllers
10 | {
11 | public class HomeController : Controller
12 | {
13 | public IActionResult Index()
14 | {
15 | return View();
16 | }
17 |
18 | public IActionResult About()
19 | {
20 | ViewData["Message"] = "Your application description page.";
21 |
22 | return View();
23 | }
24 |
25 | public IActionResult Contact()
26 | {
27 | ViewData["Message"] = "Your contact page.";
28 |
29 | return View();
30 | }
31 |
32 | public IActionResult Error()
33 | {
34 | return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/examples/ZeroUserCodeLightup/Controllers/HomeController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Mvc;
7 | using ZeroUserCodeLightup.Models;
8 |
9 | namespace ZeroUserCodeLightup.Controllers
10 | {
11 | public class HomeController : Controller
12 | {
13 | public IActionResult Index()
14 | {
15 | return View();
16 | }
17 |
18 | public IActionResult About()
19 | {
20 | ViewData["Message"] = "Your application description page.";
21 |
22 | return View();
23 | }
24 |
25 | public IActionResult Contact()
26 | {
27 | ViewData["Message"] = "Your contact page.";
28 |
29 | return View();
30 | }
31 |
32 | public IActionResult Error()
33 | {
34 | return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/examples/ZeroUserCodeLightup/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM microsoft/aspnetcore-build:2.0.5-2.1.4 AS build-env
2 | WORKDIR /app
3 |
4 | # Copy everything else and build
5 | COPY . ./
6 | # Adding a reference to hosting startup package
7 | RUN dotnet add package Microsoft.ApplicationInsights.Kubernetes.HostingStartup
8 | RUN dotnet publish -c Release -o out
9 |
10 | # Build runtime image
11 | FROM microsoft/aspnetcore:2.0.5
12 |
13 | # Create an argument to allow docker builder to passing in application insights key.
14 | # For example: docker build . --build-arg APPINSIGHTS_KEY=YOUR_APPLICATIONINSIGHTS_INSTRUMENTATION_KEY
15 | ARG APPINSIGHTS_KEY
16 | # Making sure the argument is set. Fail the build of the container otherwise.
17 | RUN test -n "$APPINSIGHTS_KEY"
18 |
19 | # Light up Application Insights for Kubernetes
20 | ENV APPINSIGHTS_INSTRUMENTATIONKEY $APPINSIGHTS_KEY
21 | ENV ASPNETCORE_HOSTINGSTARTUPASSEMBLIES Microsoft.ApplicationInsights.Kubernetes.HostingStartup
22 |
23 | WORKDIR /app
24 | COPY --from=build-env /app/out .
25 | ENTRYPOINT ["dotnet", "ZeroUserCodeLightup.dll"]
--------------------------------------------------------------------------------
/examples/BasicUsage/wwwroot/lib/jquery-validation/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery-validation",
3 | "homepage": "http://jqueryvalidation.org/",
4 | "repository": {
5 | "type": "git",
6 | "url": "git://github.com/jzaefferer/jquery-validation.git"
7 | },
8 | "authors": [
9 | "Jörn Zaefferer "
10 | ],
11 | "description": "Form validation made easy",
12 | "main": "dist/jquery.validate.js",
13 | "keywords": [
14 | "forms",
15 | "validation",
16 | "validate"
17 | ],
18 | "license": "MIT",
19 | "ignore": [
20 | "**/.*",
21 | "node_modules",
22 | "bower_components",
23 | "test",
24 | "demo",
25 | "lib"
26 | ],
27 | "dependencies": {
28 | "jquery": ">= 1.7.2"
29 | },
30 | "version": "1.14.0",
31 | "_release": "1.14.0",
32 | "_resolution": {
33 | "type": "version",
34 | "tag": "1.14.0",
35 | "commit": "c1343fb9823392aa9acbe1c3ffd337b8c92fed48"
36 | },
37 | "_source": "git://github.com/jzaefferer/jquery-validation.git",
38 | "_target": ">=1.8",
39 | "_originalSource": "jquery-validation"
40 | }
--------------------------------------------------------------------------------
/examples/MultipleIKeys/wwwroot/lib/jquery-validation/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery-validation",
3 | "homepage": "http://jqueryvalidation.org/",
4 | "repository": {
5 | "type": "git",
6 | "url": "git://github.com/jzaefferer/jquery-validation.git"
7 | },
8 | "authors": [
9 | "Jörn Zaefferer "
10 | ],
11 | "description": "Form validation made easy",
12 | "main": "dist/jquery.validate.js",
13 | "keywords": [
14 | "forms",
15 | "validation",
16 | "validate"
17 | ],
18 | "license": "MIT",
19 | "ignore": [
20 | "**/.*",
21 | "node_modules",
22 | "bower_components",
23 | "test",
24 | "demo",
25 | "lib"
26 | ],
27 | "dependencies": {
28 | "jquery": ">= 1.7.2"
29 | },
30 | "version": "1.14.0",
31 | "_release": "1.14.0",
32 | "_resolution": {
33 | "type": "version",
34 | "tag": "1.14.0",
35 | "commit": "c1343fb9823392aa9acbe1c3ffd337b8c92fed48"
36 | },
37 | "_source": "git://github.com/jzaefferer/jquery-validation.git",
38 | "_target": ">=1.8",
39 | "_originalSource": "jquery-validation"
40 | }
--------------------------------------------------------------------------------
/examples/WindowsContainer/wwwroot/lib/jquery-validation/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery-validation",
3 | "homepage": "http://jqueryvalidation.org/",
4 | "repository": {
5 | "type": "git",
6 | "url": "git://github.com/jzaefferer/jquery-validation.git"
7 | },
8 | "authors": [
9 | "Jörn Zaefferer "
10 | ],
11 | "description": "Form validation made easy",
12 | "main": "dist/jquery.validate.js",
13 | "keywords": [
14 | "forms",
15 | "validation",
16 | "validate"
17 | ],
18 | "license": "MIT",
19 | "ignore": [
20 | "**/.*",
21 | "node_modules",
22 | "bower_components",
23 | "test",
24 | "demo",
25 | "lib"
26 | ],
27 | "dependencies": {
28 | "jquery": ">= 1.7.2"
29 | },
30 | "version": "1.14.0",
31 | "_release": "1.14.0",
32 | "_resolution": {
33 | "type": "version",
34 | "tag": "1.14.0",
35 | "commit": "c1343fb9823392aa9acbe1c3ffd337b8c92fed48"
36 | },
37 | "_source": "git://github.com/jzaefferer/jquery-validation.git",
38 | "_target": ">=1.8",
39 | "_originalSource": "jquery-validation"
40 | }
--------------------------------------------------------------------------------
/examples/ZeroUserCodeLightup/wwwroot/lib/jquery-validation/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery-validation",
3 | "homepage": "http://jqueryvalidation.org/",
4 | "repository": {
5 | "type": "git",
6 | "url": "git://github.com/jzaefferer/jquery-validation.git"
7 | },
8 | "authors": [
9 | "Jörn Zaefferer "
10 | ],
11 | "description": "Form validation made easy",
12 | "main": "dist/jquery.validate.js",
13 | "keywords": [
14 | "forms",
15 | "validation",
16 | "validate"
17 | ],
18 | "license": "MIT",
19 | "ignore": [
20 | "**/.*",
21 | "node_modules",
22 | "bower_components",
23 | "test",
24 | "demo",
25 | "lib"
26 | ],
27 | "dependencies": {
28 | "jquery": ">= 1.7.2"
29 | },
30 | "version": "1.14.0",
31 | "_release": "1.14.0",
32 | "_resolution": {
33 | "type": "version",
34 | "tag": "1.14.0",
35 | "commit": "c1343fb9823392aa9acbe1c3ffd337b8c92fed48"
36 | },
37 | "_source": "git://github.com/jzaefferer/jquery-validation.git",
38 | "_target": ">=1.8",
39 | "_originalSource": "jquery-validation"
40 | }
--------------------------------------------------------------------------------
/examples/BasicUsage_clr21_RBAC/app/wwwroot/lib/jquery-validation/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery-validation",
3 | "homepage": "https://jqueryvalidation.org/",
4 | "repository": {
5 | "type": "git",
6 | "url": "git://github.com/jquery-validation/jquery-validation.git"
7 | },
8 | "authors": [
9 | "Jörn Zaefferer "
10 | ],
11 | "description": "Form validation made easy",
12 | "main": "dist/jquery.validate.js",
13 | "keywords": [
14 | "forms",
15 | "validation",
16 | "validate"
17 | ],
18 | "license": "MIT",
19 | "ignore": [
20 | "**/.*",
21 | "node_modules",
22 | "bower_components",
23 | "test",
24 | "demo",
25 | "lib"
26 | ],
27 | "dependencies": {
28 | "jquery": ">= 1.7.2"
29 | },
30 | "version": "1.17.0",
31 | "_release": "1.17.0",
32 | "_resolution": {
33 | "type": "version",
34 | "tag": "1.17.0",
35 | "commit": "fc9b12d3bfaa2d0c04605855b896edb2934c0772"
36 | },
37 | "_source": "https://github.com/jzaefferer/jquery-validation.git",
38 | "_target": "^1.17.0",
39 | "_originalSource": "jquery-validation",
40 | "_direct": true
41 | }
--------------------------------------------------------------------------------
/examples/BasicUsage/wwwroot/lib/bootstrap/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bootstrap",
3 | "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.",
4 | "keywords": [
5 | "css",
6 | "js",
7 | "less",
8 | "mobile-first",
9 | "responsive",
10 | "front-end",
11 | "framework",
12 | "web"
13 | ],
14 | "homepage": "http://getbootstrap.com",
15 | "license": "MIT",
16 | "moduleType": "globals",
17 | "main": [
18 | "less/bootstrap.less",
19 | "dist/js/bootstrap.js"
20 | ],
21 | "ignore": [
22 | "/.*",
23 | "_config.yml",
24 | "CNAME",
25 | "composer.json",
26 | "CONTRIBUTING.md",
27 | "docs",
28 | "js/tests",
29 | "test-infra"
30 | ],
31 | "dependencies": {
32 | "jquery": "1.9.1 - 3"
33 | },
34 | "version": "3.3.7",
35 | "_release": "3.3.7",
36 | "_resolution": {
37 | "type": "version",
38 | "tag": "v3.3.7",
39 | "commit": "0b9c4a4007c44201dce9a6cc1a38407005c26c86"
40 | },
41 | "_source": "https://github.com/twbs/bootstrap.git",
42 | "_target": "v3.3.7",
43 | "_originalSource": "bootstrap",
44 | "_direct": true
45 | }
--------------------------------------------------------------------------------
/examples/MultipleIKeys/wwwroot/lib/bootstrap/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bootstrap",
3 | "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.",
4 | "keywords": [
5 | "css",
6 | "js",
7 | "less",
8 | "mobile-first",
9 | "responsive",
10 | "front-end",
11 | "framework",
12 | "web"
13 | ],
14 | "homepage": "http://getbootstrap.com",
15 | "license": "MIT",
16 | "moduleType": "globals",
17 | "main": [
18 | "less/bootstrap.less",
19 | "dist/js/bootstrap.js"
20 | ],
21 | "ignore": [
22 | "/.*",
23 | "_config.yml",
24 | "CNAME",
25 | "composer.json",
26 | "CONTRIBUTING.md",
27 | "docs",
28 | "js/tests",
29 | "test-infra"
30 | ],
31 | "dependencies": {
32 | "jquery": "1.9.1 - 3"
33 | },
34 | "version": "3.3.7",
35 | "_release": "3.3.7",
36 | "_resolution": {
37 | "type": "version",
38 | "tag": "v3.3.7",
39 | "commit": "0b9c4a4007c44201dce9a6cc1a38407005c26c86"
40 | },
41 | "_source": "https://github.com/twbs/bootstrap.git",
42 | "_target": "v3.3.7",
43 | "_originalSource": "bootstrap",
44 | "_direct": true
45 | }
--------------------------------------------------------------------------------
/examples/WindowsContainer/wwwroot/lib/bootstrap/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bootstrap",
3 | "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.",
4 | "keywords": [
5 | "css",
6 | "js",
7 | "less",
8 | "mobile-first",
9 | "responsive",
10 | "front-end",
11 | "framework",
12 | "web"
13 | ],
14 | "homepage": "http://getbootstrap.com",
15 | "license": "MIT",
16 | "moduleType": "globals",
17 | "main": [
18 | "less/bootstrap.less",
19 | "dist/js/bootstrap.js"
20 | ],
21 | "ignore": [
22 | "/.*",
23 | "_config.yml",
24 | "CNAME",
25 | "composer.json",
26 | "CONTRIBUTING.md",
27 | "docs",
28 | "js/tests",
29 | "test-infra"
30 | ],
31 | "dependencies": {
32 | "jquery": "1.9.1 - 3"
33 | },
34 | "version": "3.3.7",
35 | "_release": "3.3.7",
36 | "_resolution": {
37 | "type": "version",
38 | "tag": "v3.3.7",
39 | "commit": "0b9c4a4007c44201dce9a6cc1a38407005c26c86"
40 | },
41 | "_source": "https://github.com/twbs/bootstrap.git",
42 | "_target": "v3.3.7",
43 | "_originalSource": "bootstrap",
44 | "_direct": true
45 | }
--------------------------------------------------------------------------------
/examples/ZeroUserCodeLightup/wwwroot/lib/bootstrap/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bootstrap",
3 | "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.",
4 | "keywords": [
5 | "css",
6 | "js",
7 | "less",
8 | "mobile-first",
9 | "responsive",
10 | "front-end",
11 | "framework",
12 | "web"
13 | ],
14 | "homepage": "http://getbootstrap.com",
15 | "license": "MIT",
16 | "moduleType": "globals",
17 | "main": [
18 | "less/bootstrap.less",
19 | "dist/js/bootstrap.js"
20 | ],
21 | "ignore": [
22 | "/.*",
23 | "_config.yml",
24 | "CNAME",
25 | "composer.json",
26 | "CONTRIBUTING.md",
27 | "docs",
28 | "js/tests",
29 | "test-infra"
30 | ],
31 | "dependencies": {
32 | "jquery": "1.9.1 - 3"
33 | },
34 | "version": "3.3.7",
35 | "_release": "3.3.7",
36 | "_resolution": {
37 | "type": "version",
38 | "tag": "v3.3.7",
39 | "commit": "0b9c4a4007c44201dce9a6cc1a38407005c26c86"
40 | },
41 | "_source": "https://github.com/twbs/bootstrap.git",
42 | "_target": "v3.3.7",
43 | "_originalSource": "bootstrap",
44 | "_direct": true
45 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Microsoft Application Insights - Kubernetes
2 |
3 | Copyright (c) Microsoft Corporation
4 |
5 | All rights reserved.
6 |
7 | MIT License
8 |
9 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 |
--------------------------------------------------------------------------------
/examples/BasicUsage_clr21_RBAC/app/wwwroot/lib/bootstrap/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bootstrap",
3 | "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.",
4 | "keywords": [
5 | "css",
6 | "js",
7 | "less",
8 | "mobile-first",
9 | "responsive",
10 | "front-end",
11 | "framework",
12 | "web"
13 | ],
14 | "homepage": "http://getbootstrap.com",
15 | "license": "MIT",
16 | "moduleType": "globals",
17 | "main": [
18 | "less/bootstrap.less",
19 | "dist/js/bootstrap.js"
20 | ],
21 | "ignore": [
22 | "/.*",
23 | "_config.yml",
24 | "CNAME",
25 | "composer.json",
26 | "CONTRIBUTING.md",
27 | "docs",
28 | "js/tests",
29 | "test-infra"
30 | ],
31 | "dependencies": {
32 | "jquery": "1.9.1 - 3"
33 | },
34 | "version": "3.3.7",
35 | "_release": "3.3.7",
36 | "_resolution": {
37 | "type": "version",
38 | "tag": "v3.3.7",
39 | "commit": "0b9c4a4007c44201dce9a6cc1a38407005c26c86"
40 | },
41 | "_source": "https://github.com/twbs/bootstrap.git",
42 | "_target": "v3.3.7",
43 | "_originalSource": "bootstrap",
44 | "_direct": true
45 | }
--------------------------------------------------------------------------------
/dev/F5WebApi/Controllers/ValuesController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc;
6 |
7 | namespace F5WebApi.Controllers
8 | {
9 | [Route("api/[controller]")]
10 | [ApiController]
11 | public class ValuesController : ControllerBase
12 | {
13 | // GET api/values
14 | [HttpGet]
15 | public ActionResult> Get()
16 | {
17 | return new string[] { "value1", "value2" };
18 | }
19 |
20 | // GET api/values/5
21 | [HttpGet("{id}")]
22 | public ActionResult Get(int id)
23 | {
24 | return "value";
25 | }
26 |
27 | // POST api/values
28 | [HttpPost]
29 | public void Post([FromBody] string value)
30 | {
31 | }
32 |
33 | // PUT api/values/5
34 | [HttpPut("{id}")]
35 | public void Put(int id, [FromBody] string value)
36 | {
37 | }
38 |
39 | // DELETE api/values/5
40 | [HttpDelete("{id}")]
41 | public void Delete(int id)
42 | {
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/examples/BasicUsage/wwwroot/lib/bootstrap/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2011-2016 Twitter, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/examples/MultipleIKeys/wwwroot/lib/bootstrap/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2011-2016 Twitter, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/examples/WindowsContainer/wwwroot/lib/bootstrap/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2011-2016 Twitter, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/examples/ZeroUserCodeLightup/wwwroot/lib/bootstrap/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2011-2016 Twitter, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/examples/BasicUsage_clr21_RBAC/app/wwwroot/lib/bootstrap/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2011-2016 Twitter, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/examples/BasicUsage/wwwroot/lib/jquery-validation/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | =====================
3 |
4 | Copyright Jörn Zaefferer
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/examples/MultipleIKeys/wwwroot/lib/jquery-validation/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | =====================
3 |
4 | Copyright Jörn Zaefferer
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/src/ApplicationInsights.Kubernetes/Debuggings/DiagnosticLogLevel.cs:
--------------------------------------------------------------------------------
1 | namespace Microsoft.ApplicationInsights.Kubernetes.Debugging
2 | {
3 | ///
4 | /// Diagnostic Source message levels
5 | ///
6 | public enum DiagnosticLogLevel
7 | {
8 | ///
9 | /// Gets the level of critical.
10 | ///
11 | ///
12 | Critical = 5,
13 | ///
14 | /// Gets the level of error.
15 | ///
16 | ///
17 | Error = 4,
18 | ///
19 | /// Gets the level of warning.
20 | ///
21 | ///
22 | Warning = 3,
23 | ///
24 | /// Gets the level of information.
25 | ///
26 | ///
27 | Information = 2,
28 | ///
29 | /// Gets the level of debug.
30 | ///
31 | ///
32 | Debug = 1,
33 | ///
34 | /// Gets the level of trace.
35 | ///
36 | ///
37 | Trace = 0,
38 | }
39 | }
--------------------------------------------------------------------------------
/examples/WindowsContainer/wwwroot/lib/jquery-validation/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | =====================
3 |
4 | Copyright Jörn Zaefferer
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/examples/BasicUsage_clr21_RBAC/app/Controllers/HomeController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Mvc;
7 | using app.Models;
8 |
9 | namespace app.Controllers
10 | {
11 | public class HomeController : Controller
12 | {
13 | public IActionResult Index()
14 | {
15 | return View();
16 | }
17 |
18 | public IActionResult About()
19 | {
20 | ViewData["Message"] = "Your application description page.";
21 |
22 | return View();
23 | }
24 |
25 | public IActionResult Contact()
26 | {
27 | ViewData["Message"] = "Your contact page.";
28 |
29 | return View();
30 | }
31 |
32 | public IActionResult Privacy()
33 | {
34 | return View();
35 | }
36 |
37 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
38 | public IActionResult Error()
39 | {
40 | return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/examples/ZeroUserCodeLightup/wwwroot/lib/jquery-validation/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | =====================
3 |
4 | Copyright Jörn Zaefferer
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/troubleshooting/AIK8sTroubleShooting/Controllers/ValuesController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc;
6 |
7 | namespace AIK8sTroubleShooting.Controllers
8 | {
9 | [Route("api/[controller]")]
10 | [ApiController]
11 | public class ValuesController : ControllerBase
12 | {
13 | // GET api/values
14 | [HttpGet]
15 | public ActionResult> Get()
16 | {
17 | return new string[] { "value1", "value2" };
18 | }
19 |
20 | // GET api/values/5
21 | [HttpGet("{id}")]
22 | public ActionResult Get(int id)
23 | {
24 | return "value";
25 | }
26 |
27 | // POST api/values
28 | [HttpPost]
29 | public void Post([FromBody] string value)
30 | {
31 | }
32 |
33 | // PUT api/values/5
34 | [HttpPut("{id}")]
35 | public void Put(int id, [FromBody] string value)
36 | {
37 | }
38 |
39 | // DELETE api/values/5
40 | [HttpDelete("{id}")]
41 | public void Delete(int id)
42 | {
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/examples/BasicUsage_clr21_RBAC/app/wwwroot/lib/jquery-validation/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | =====================
3 |
4 | Copyright Jörn Zaefferer
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/src/ApplicationInsights.Kubernetes.HostingStartup/ApplicationInsights.Kubernetes.HostingStartup.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | netstandard2.0
4 | Microsoft.ApplicationInsights.Kubernetes.HostingStartup
5 | true
6 |
7 | true
8 | Microsoft.ApplicationInsights.Kubernetes.HostingStartup
9 | Microsoft.ApplicationInsights.Kubernetes.HostingStartup
10 | Hosting Startup of Microsoft Application Insights for Kubernetes
11 | Analytics ApplicationInsights Telemetry AppInsights Kubernetes Hosting Startup
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/examples/BasicUsage/Views/Shared/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
12 |
18 |
19 |
--------------------------------------------------------------------------------
/examples/MultipleIKeys/Views/Shared/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
12 |
18 |
19 |
--------------------------------------------------------------------------------
/examples/WindowsContainer/Views/Shared/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
12 |
18 |
19 |
--------------------------------------------------------------------------------
/examples/ZeroUserCodeLightup/Views/Shared/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
12 |
18 |
19 |
--------------------------------------------------------------------------------
/examples/BasicUsage_clr21_RBAC/app/Views/Shared/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
12 |
18 |
19 |
--------------------------------------------------------------------------------
/src/ApplicationInsights.Kubernetes/Utilities/SDKVersionUtils.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 |
4 | namespace Microsoft.ApplicationInsights.Kubernetes.Utilities
5 | {
6 | internal sealed class SDKVersionUtils
7 | {
8 | #region Singleton
9 | private SDKVersionUtils() { }
10 | static SDKVersionUtils() { }
11 | private static readonly SDKVersionUtils _instance = new SDKVersionUtils();
12 | public static SDKVersionUtils Instance => _instance;
13 | #endregion
14 |
15 | public string CurrentSDKVersion
16 | {
17 | get
18 | {
19 | if (string.IsNullOrEmpty(_sdkVersion))
20 | {
21 | _sdkVersion = $"{SdkName}:{GetSDKVersion()}";
22 | }
23 | return _sdkVersion;
24 | }
25 | }
26 |
27 | #region private
28 | private static string GetSDKVersion()
29 | {
30 | Assembly assembly = typeof(SDKVersionUtils).GetTypeInfo().Assembly;
31 | Version version = assembly.GetName().Version;
32 | return version.ToString();
33 | }
34 |
35 | private const string SdkName = "ai-k8s";
36 | private string _sdkVersion;
37 | #endregion
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/tests/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to find out which attributes exist for C# debugging
3 | // Use hover for the description of the existing attributes
4 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": ".NET Core Launch (console)",
9 | "type": "coreclr",
10 | "request": "launch",
11 | "preLaunchTask": "build",
12 | // If you have changed target frameworks, make sure to update the program path.
13 | "program": "${workspaceFolder}/UnitTests/bin/Debug/netcoreapp2.0/Microsoft.ApplicationInsights.Kubernetes.UnitTests.dll",
14 | "args": [],
15 | "cwd": "${workspaceFolder}/UnitTests",
16 | // For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
17 | "console": "internalConsole",
18 | "stopAtEntry": false
19 | },
20 | {
21 | "name": ".NET Core Attach",
22 | "type": "coreclr",
23 | "request": "attach",
24 | "processId": "${command:pickProcess}"
25 | }
26 | ]
27 | }
--------------------------------------------------------------------------------
/src/ApplicationInsights.Kubernetes/Debuggings/KubernetesDebuggingServiceCollectionBuilder.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.DependencyInjection;
2 |
3 | namespace Microsoft.ApplicationInsights.Kubernetes.Debugging
4 | {
5 | ///
6 | /// Application Insights for Kubernetes service collection builder specifically for debugging purpose.
7 | ///
8 | public sealed class KubernetesDebuggingServiceCollectionBuilder : KubernetesServiceCollectionBuilder
9 | {
10 | ///
11 | /// Constructor for .
12 | ///
13 | public KubernetesDebuggingServiceCollectionBuilder() : base(() => true) { }
14 |
15 | ///
16 | /// Injects the Application Insights for Kubernetes debugging services.
17 | ///
18 | /// The service collection to inject the debugging services into.
19 | protected override void InjectChangableServices(IServiceCollection serviceCollection)
20 | {
21 | serviceCollection.AddSingleton();
22 | serviceCollection.AddSingleton();
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/examples/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to find out which attributes exist for C# debugging
3 | // Use hover for the description of the existing attributes
4 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": ".NET Core Launch - .NET Generic Host",
9 | "type": "coreclr",
10 | "request": "launch",
11 | "preLaunchTask": "Build Example - .NET Generic Host",
12 | // If you have changed target frameworks, make sure to update the program path.
13 | "program": "${workspaceFolder}/GenericHost/src/bin/Debug/netcoreapp2.2/AIK8sGenericHost.dll",
14 | "args": [],
15 | "cwd": "${workspaceFolder}/GenericHost/src",
16 | // For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
17 | "console": "internalConsole",
18 | "stopAtEntry": false
19 | },
20 | {
21 | "name": ".NET Core Attach",
22 | "type": "coreclr",
23 | "request": "attach",
24 | "processId": "${command:pickProcess}"
25 | }
26 | ]
27 | }
--------------------------------------------------------------------------------
/examples/GenericHost/src/SendAIEventService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using System.Threading.Tasks;
4 | using Microsoft.Extensions.Hosting;
5 | using Microsoft.Extensions.Logging;
6 |
7 | namespace AIK8sGenericHost
8 | {
9 | public class SendAIEventService : IHostedService
10 | {
11 | private readonly ILogger _logger;
12 |
13 | public SendAIEventService(ILogger logger)
14 | {
15 | _logger = logger ?? throw new ArgumentNullException(nameof(logger));
16 | }
17 | public Task StartAsync(CancellationToken cancellationToken)
18 | {
19 | Task _ = Task.Run(async () => await RunUntilCancelledAsync(cancellationToken));
20 | return Task.CompletedTask;
21 | }
22 |
23 | public Task StopAsync(CancellationToken cancellationToken)
24 | {
25 | return Task.CompletedTask;
26 | }
27 |
28 | public async Task RunUntilCancelledAsync(CancellationToken cancellationToken)
29 | {
30 | while (!cancellationToken.IsCancellationRequested)
31 | {
32 | _logger.LogInformation("Application Insights for Kubernetes is working . . .");
33 | await Task.Delay(5000).ConfigureAwait(false);
34 | }
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/examples/BasicConsoleAppILogger/README.md:
--------------------------------------------------------------------------------
1 | # Enable Application Insights for Kubernetes in .NET Core Console Application
2 |
3 | The following code shows a sample console application that's configured to send ILogger traces to Application Insights with Kubernetes enricher.
4 |
5 | * Create a console application
6 |
7 | ```shell
8 | dotnet new console
9 | ```
10 |
11 | * Add packages
12 |
13 | ```shell
14 | dotnet add package Microsoft.Extensions.DependencyInjection
15 | dotnet add package Microsoft.Extensions.Logging.ApplicationInsights
16 | dotnet add package Microsoft.ApplicationInsights.Kubernetes
17 | ```
18 |
19 | * Optionally, if you prefer to output the log to the console simultaneously, add the following package as well:
20 |
21 | ```shell
22 | dotnet add package Microsoft.Extensions.Logging.Console
23 | ```
24 |
25 | The project file will be updated, similar to [BasicConsoleAppILogger.csproj](./BasicConsoleAppILogger.csproj).
26 |
27 | * Replace the code in [Program.cs](Program.cs).
28 |
29 | * To build a docker image, refer to [Dockerfile](./Dockerfile).
30 |
31 | * To deploy the docker image to a Kubernetes cluster, refer to [k8s.yaml](./k8s.yaml).
32 |
33 | ## References
34 |
35 | * [ApplicationInsightsLoggerProvider](https://docs.microsoft.com/en-us/azure/azure-monitor/app/ilogger).
36 |
--------------------------------------------------------------------------------
/examples/BasicUsage/wwwroot/lib/jquery-validation-unobtrusive/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery-validation-unobtrusive",
3 | "version": "3.2.6",
4 | "homepage": "https://github.com/aspnet/jquery-validation-unobtrusive",
5 | "description": "Add-on to jQuery Validation to enable unobtrusive validation options in data-* attributes.",
6 | "main": [
7 | "jquery.validate.unobtrusive.js"
8 | ],
9 | "ignore": [
10 | "**/.*",
11 | "*.json",
12 | "*.md",
13 | "*.txt",
14 | "gulpfile.js"
15 | ],
16 | "keywords": [
17 | "jquery",
18 | "asp.net",
19 | "mvc",
20 | "validation",
21 | "unobtrusive"
22 | ],
23 | "authors": [
24 | "Microsoft"
25 | ],
26 | "license": "http://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm",
27 | "repository": {
28 | "type": "git",
29 | "url": "git://github.com/aspnet/jquery-validation-unobtrusive.git"
30 | },
31 | "dependencies": {
32 | "jquery-validation": ">=1.8",
33 | "jquery": ">=1.8"
34 | },
35 | "_release": "3.2.6",
36 | "_resolution": {
37 | "type": "version",
38 | "tag": "v3.2.6",
39 | "commit": "13386cd1b5947d8a5d23a12b531ce3960be1eba7"
40 | },
41 | "_source": "git://github.com/aspnet/jquery-validation-unobtrusive.git",
42 | "_target": "3.2.6",
43 | "_originalSource": "jquery-validation-unobtrusive"
44 | }
--------------------------------------------------------------------------------
/examples/MultipleIKeys/wwwroot/lib/jquery-validation-unobtrusive/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery-validation-unobtrusive",
3 | "version": "3.2.6",
4 | "homepage": "https://github.com/aspnet/jquery-validation-unobtrusive",
5 | "description": "Add-on to jQuery Validation to enable unobtrusive validation options in data-* attributes.",
6 | "main": [
7 | "jquery.validate.unobtrusive.js"
8 | ],
9 | "ignore": [
10 | "**/.*",
11 | "*.json",
12 | "*.md",
13 | "*.txt",
14 | "gulpfile.js"
15 | ],
16 | "keywords": [
17 | "jquery",
18 | "asp.net",
19 | "mvc",
20 | "validation",
21 | "unobtrusive"
22 | ],
23 | "authors": [
24 | "Microsoft"
25 | ],
26 | "license": "http://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm",
27 | "repository": {
28 | "type": "git",
29 | "url": "git://github.com/aspnet/jquery-validation-unobtrusive.git"
30 | },
31 | "dependencies": {
32 | "jquery-validation": ">=1.8",
33 | "jquery": ">=1.8"
34 | },
35 | "_release": "3.2.6",
36 | "_resolution": {
37 | "type": "version",
38 | "tag": "v3.2.6",
39 | "commit": "13386cd1b5947d8a5d23a12b531ce3960be1eba7"
40 | },
41 | "_source": "git://github.com/aspnet/jquery-validation-unobtrusive.git",
42 | "_target": "3.2.6",
43 | "_originalSource": "jquery-validation-unobtrusive"
44 | }
--------------------------------------------------------------------------------
/examples/WindowsContainer/wwwroot/lib/jquery-validation-unobtrusive/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery-validation-unobtrusive",
3 | "version": "3.2.6",
4 | "homepage": "https://github.com/aspnet/jquery-validation-unobtrusive",
5 | "description": "Add-on to jQuery Validation to enable unobtrusive validation options in data-* attributes.",
6 | "main": [
7 | "jquery.validate.unobtrusive.js"
8 | ],
9 | "ignore": [
10 | "**/.*",
11 | "*.json",
12 | "*.md",
13 | "*.txt",
14 | "gulpfile.js"
15 | ],
16 | "keywords": [
17 | "jquery",
18 | "asp.net",
19 | "mvc",
20 | "validation",
21 | "unobtrusive"
22 | ],
23 | "authors": [
24 | "Microsoft"
25 | ],
26 | "license": "http://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm",
27 | "repository": {
28 | "type": "git",
29 | "url": "git://github.com/aspnet/jquery-validation-unobtrusive.git"
30 | },
31 | "dependencies": {
32 | "jquery-validation": ">=1.8",
33 | "jquery": ">=1.8"
34 | },
35 | "_release": "3.2.6",
36 | "_resolution": {
37 | "type": "version",
38 | "tag": "v3.2.6",
39 | "commit": "13386cd1b5947d8a5d23a12b531ce3960be1eba7"
40 | },
41 | "_source": "git://github.com/aspnet/jquery-validation-unobtrusive.git",
42 | "_target": "3.2.6",
43 | "_originalSource": "jquery-validation-unobtrusive"
44 | }
--------------------------------------------------------------------------------
/examples/ZeroUserCodeLightup/wwwroot/lib/jquery-validation-unobtrusive/.bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jquery-validation-unobtrusive",
3 | "version": "3.2.6",
4 | "homepage": "https://github.com/aspnet/jquery-validation-unobtrusive",
5 | "description": "Add-on to jQuery Validation to enable unobtrusive validation options in data-* attributes.",
6 | "main": [
7 | "jquery.validate.unobtrusive.js"
8 | ],
9 | "ignore": [
10 | "**/.*",
11 | "*.json",
12 | "*.md",
13 | "*.txt",
14 | "gulpfile.js"
15 | ],
16 | "keywords": [
17 | "jquery",
18 | "asp.net",
19 | "mvc",
20 | "validation",
21 | "unobtrusive"
22 | ],
23 | "authors": [
24 | "Microsoft"
25 | ],
26 | "license": "http://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm",
27 | "repository": {
28 | "type": "git",
29 | "url": "git://github.com/aspnet/jquery-validation-unobtrusive.git"
30 | },
31 | "dependencies": {
32 | "jquery-validation": ">=1.8",
33 | "jquery": ">=1.8"
34 | },
35 | "_release": "3.2.6",
36 | "_resolution": {
37 | "type": "version",
38 | "tag": "v3.2.6",
39 | "commit": "13386cd1b5947d8a5d23a12b531ce3960be1eba7"
40 | },
41 | "_source": "git://github.com/aspnet/jquery-validation-unobtrusive.git",
42 | "_target": "3.2.6",
43 | "_originalSource": "jquery-validation-unobtrusive"
44 | }
--------------------------------------------------------------------------------
/src/ApplicationInsights.Kubernetes/K8sHttpClient/KubeHttpClient.cs:
--------------------------------------------------------------------------------
1 | using System.Net.Http;
2 | using System.Net.Http.Headers;
3 | using Microsoft.ApplicationInsights.Kubernetes.Debugging;
4 |
5 | namespace Microsoft.ApplicationInsights.Kubernetes
6 | {
7 | internal class KubeHttpClient : HttpClient, IKubeHttpClient
8 | {
9 | private readonly ApplicationInsightsKubernetesDiagnosticSource _logger = ApplicationInsightsKubernetesDiagnosticSource.Instance;
10 | public IKubeHttpClientSettingsProvider Settings { get; private set; }
11 |
12 | public KubeHttpClient(
13 | IKubeHttpClientSettingsProvider settingsProvider)
14 | : base(settingsProvider.CreateMessageHandler())
15 | {
16 | this.Settings = settingsProvider;
17 | string token = settingsProvider.GetToken();
18 |
19 | if (!string.IsNullOrEmpty(token))
20 | {
21 | _logger.LogDebug("Access token is not null. Set default request header.");
22 | this.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
23 | }
24 | else
25 | {
26 | _logger.LogWarning("Access token is null.");
27 | }
28 |
29 | this.BaseAddress = settingsProvider.ServiceBaseAddress;
30 | }
31 |
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/examples/BasicConsoleApp/src/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using Microsoft.ApplicationInsights;
4 | using Microsoft.ApplicationInsights.Extensibility;
5 | using Microsoft.Extensions.Configuration;
6 | using Microsoft.Extensions.DependencyInjection;
7 |
8 | namespace AiK8sConsole
9 | {
10 | class Program
11 | {
12 | static void Main(string[] args)
13 | {
14 | IConfiguration config = new ConfigurationBuilder().AddEnvironmentVariables().Build();
15 | string iKey = config["APPINSIGHTS_INSTRUMENTNATIONKEY"];
16 | if (string.IsNullOrEmpty(iKey))
17 | {
18 | Console.WriteLine("Can't do empty iKey.");
19 | }
20 |
21 | using (TelemetryConfiguration configuration = new TelemetryConfiguration(iKey))
22 | {
23 | configuration.AddApplicationInsightsKubernetesEnricher(applyOptions: null);
24 |
25 | TelemetryClient client = new TelemetryClient(configuration);
26 | Console.WriteLine("Sending trace telemetry once a while.");
27 | while (true)
28 | {
29 | client.TrackTrace("Hello from AI SDK");
30 | client.Flush();
31 | Thread.Sleep(30000);
32 | }
33 | }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "label": "Build Debug",
6 | "command": "${workspaceFolder}/../build/Build.cmd",
7 | "type": "shell",
8 | "group": "build",
9 | "problemMatcher": "$msCompile"
10 | },
11 | {
12 | "label": "Build Release",
13 | "command": "${workspaceFolder}/../build/Build.cmd",
14 | "type": "shell",
15 | "group": "build",
16 | "args": [
17 | "Release",
18 | ],
19 | "problemMatcher": "$msCompile",
20 | },
21 | {
22 | "label": "ReBuild Debug",
23 | "command": "${workspaceFolder}/../build/Build.cmd",
24 | "type": "shell",
25 | "group": "build",
26 | "args": [
27 | "Debug",
28 | "True",
29 | ],
30 | "problemMatcher": "$msCompile"
31 | },
32 | {
33 | "label": "ReBuild Release",
34 | "command": "${workspaceFolder}/../build/Build.cmd",
35 | "type": "shell",
36 | "group": "build",
37 | "args": [
38 | "Release",
39 | "True",
40 | ],
41 | "problemMatcher": "$msCompile",
42 | }
43 | ]
44 | }
--------------------------------------------------------------------------------
/examples/ZeroUserCodeLightup/k8s/deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: extensions/v1beta1
2 | kind: Deployment
3 | metadata:
4 | name: k8s-example
5 | spec:
6 | replicas: 2
7 | template:
8 | metadata:
9 | labels:
10 | app: webapp
11 | spec:
12 | containers:
13 | - name: k8s-web
14 | # Please update to use your own image in the container registry.
15 | image: dockeraccount/ai-k8s-app:0.0.1
16 | ports:
17 | - containerPort: 80
18 | env:
19 | # Uncomment the following lines to overwrite the Applicaiton Insights Instrumentation Key
20 | #- name: APPINSIGHTS_INSTRUMENTATIONKEY
21 | # value: APPLICATION INSIGHTS KEY OVERWRITE
22 | - name: ASPNETCORE_HOSTINGSTARTUPASSEMBLIES
23 | value: Microsoft.ApplicationInsights.Kubernetes.HostingStartup
24 | readinessProbe:
25 | httpGet:
26 | path: /Home/About
27 | port: 80
28 | initialDelaySeconds: 10 #(10 seconds more than the default timeout)
29 | periodSeconds: 10
30 | failureThreshold: 10
31 | timeoutSeconds: 10
32 | ---
33 | apiVersion: v1
34 | kind: Service
35 | metadata:
36 | name: k8s-example
37 | annotations:
38 | service.beta.kubernetes.io/external-traffic: OnlyLocal
39 | spec:
40 | ports:
41 | - name: http-port
42 | port: 80
43 | targetPort: 80
44 | selector:
45 | app: webapp
46 | type: LoadBalancer
47 |
--------------------------------------------------------------------------------
/tests/UnitTests/TestCGroup:
--------------------------------------------------------------------------------
1 | 12:memory:/kubepods/besteffort/pod3775c228-ceef-11e7-9bd3-0a58ac1f0867/b414a8fd62411213667643030d7ebf7264465df1b724fc6e7315106d0ed60553
2 | 11:freezer:/kubepods/besteffort/pod3775c228-ceef-11e7-9bd3-0a58ac1f0867/b414a8fd62411213667643030d7ebf7264465df1b724fc6e7315106d0ed60553
3 | 10:devices:/kubepods/besteffort/pod3775c228-ceef-11e7-9bd3-0a58ac1f0867/b414a8fd62411213667643030d7ebf7264465df1b724fc6e7315106d0ed60553
4 | 9:pids:/kubepods/besteffort/pod3775c228-ceef-11e7-9bd3-0a58ac1f0867/b414a8fd62411213667643030d7ebf7264465df1b724fc6e7315106d0ed60553
5 | 8:hugetlb:/kubepods/besteffort/pod3775c228-ceef-11e7-9bd3-0a58ac1f0867/b414a8fd62411213667643030d7ebf7264465df1b724fc6e7315106d0ed60553
6 | 7:net_cls,net_prio:/kubepods/besteffort/pod3775c228-ceef-11e7-9bd3-0a58ac1f0867/b414a8fd62411213667643030d7ebf7264465df1b724fc6e7315106d0ed60553
7 | 6:cpu,cpuacct:/kubepods/besteffort/pod3775c228-ceef-11e7-9bd3-0a58ac1f0867/b414a8fd62411213667643030d7ebf7264465df1b724fc6e7315106d0ed60553
8 | 5:perf_event:/kubepods/besteffort/pod3775c228-ceef-11e7-9bd3-0a58ac1f0867/b414a8fd62411213667643030d7ebf7264465df1b724fc6e7315106d0ed60553
9 | 4:blkio:/kubepods/besteffort/pod3775c228-ceef-11e7-9bd3-0a58ac1f0867/b414a8fd62411213667643030d7ebf7264465df1b724fc6e7315106d0ed60553
10 | 3:rdma:/
11 | 2:cpuset:/kubepods/besteffort/pod3775c228-ceef-11e7-9bd3-0a58ac1f0867/b414a8fd62411213667643030d7ebf7264465df1b724fc6e7315106d0ed60553
12 | 1:name=systemd:/kubepods/besteffort/pod3775c228-ceef-11e7-9bd3-0a58ac1f0867/b414a8fd62411213667643030d7ebf7264465df1b724fc6e7315106d0ed60553
13 |
--------------------------------------------------------------------------------
/src/ApplicationInsights.Kubernetes/Debuggings/KubernetesDebuggingServiceCollectionBuilderFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Microsoft.ApplicationInsights.Kubernetes.Debugging
4 | {
5 | ///
6 | /// Factory of Application Insights for Kubernetes debugging service collection builder.
7 | ///
8 | public sealed class KubernetesDebuggingServiceCollectionBuilderFactory
9 | {
10 | private KubernetesDebuggingServiceCollectionBuilderFactory() { }
11 | static KubernetesDebuggingServiceCollectionBuilderFactory() { }
12 |
13 | ///
14 | /// Singleton instance of the KubernetesDebuggingServiceCollectionBuilderFactory.
15 | ///
16 | public static KubernetesDebuggingServiceCollectionBuilderFactory Instance { get; } = new KubernetesDebuggingServiceCollectionBuilderFactory();
17 |
18 | ///
19 | /// Creates a debugging instance of the service collection builder for Application Insights for Kubernetes.
20 | ///
21 | /// Returns a debugging instace of the service collection builder for Application Insights for Kubernetes.
22 | [Obsolete("This instance is used only for debugging. Never use this in production!", false)]
23 | #pragma warning disable CA1822 // Mark members as static
24 | public KubernetesDebuggingServiceCollectionBuilder Create()
25 | #pragma warning restore CA1822 // Mark members as static
26 | {
27 | return new KubernetesDebuggingServiceCollectionBuilder();
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/examples/ZeroUserCodeLightup/Startup.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Builder;
6 | using Microsoft.AspNetCore.Hosting;
7 | using Microsoft.Extensions.Configuration;
8 | using Microsoft.Extensions.DependencyInjection;
9 |
10 | namespace ZeroUserCodeLightup
11 | {
12 | public class Startup
13 | {
14 | public Startup(IConfiguration configuration)
15 | {
16 | Configuration = configuration;
17 | }
18 |
19 | public IConfiguration Configuration { get; }
20 |
21 | // This method gets called by the runtime. Use this method to add services to the container.
22 | public void ConfigureServices(IServiceCollection services)
23 | {
24 | services.AddMvc();
25 | }
26 |
27 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
28 | public void Configure(IApplicationBuilder app, IHostingEnvironment env)
29 | {
30 | if (env.IsDevelopment())
31 | {
32 | app.UseBrowserLink();
33 | app.UseDeveloperExceptionPage();
34 | }
35 | else
36 | {
37 | app.UseExceptionHandler("/Home/Error");
38 | }
39 |
40 | app.UseStaticFiles();
41 |
42 | app.UseMvc(routes =>
43 | {
44 | routes.MapRoute(
45 | name: "default",
46 | template: "{controller=Home}/{action=Index}/{id?}");
47 | });
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/examples/WindowsContainer/Startup.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Builder;
6 | using Microsoft.AspNetCore.Hosting;
7 | using Microsoft.Extensions.Configuration;
8 | using Microsoft.Extensions.DependencyInjection;
9 |
10 | namespace AspNetCoreNano
11 | {
12 | public class Startup
13 | {
14 | public Startup(IConfiguration configuration)
15 | {
16 | Configuration = configuration;
17 | }
18 |
19 | public IConfiguration Configuration { get; }
20 |
21 | // This method gets called by the runtime. Use this method to add services to the container.
22 | public void ConfigureServices(IServiceCollection services)
23 | {
24 | services.AddApplicationInsightsKubernetesEnricher();
25 | services.AddMvc();
26 | }
27 |
28 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
29 | public void Configure(IApplicationBuilder app, IHostingEnvironment env)
30 | {
31 | if (env.IsDevelopment())
32 | {
33 | app.UseDeveloperExceptionPage();
34 | }
35 | else
36 | {
37 | app.UseExceptionHandler("/Home/Error");
38 | }
39 |
40 | app.UseStaticFiles();
41 |
42 | app.UseMvc(routes =>
43 | {
44 | routes.MapRoute(
45 | name: "default",
46 | template: "{controller=Home}/{action=Index}/{id?}");
47 | });
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/tests/UnitTests/UnitTests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.0
5 | Microsoft.ApplicationInsights.Kubernetes.UnitTests
6 | Microsoft.ApplicationInsights.Kubernetes
7 | True
8 | ..\..\src\PublicKey.snk
9 | True
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | PreserveNewest
32 |
33 |
34 | Always
35 |
36 |
37 | PreserveNewest
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/troubleshooting/AIK8sTroubleShooting/Startup.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Builder;
6 | using Microsoft.AspNetCore.Hosting;
7 | using Microsoft.AspNetCore.HttpsPolicy;
8 | using Microsoft.AspNetCore.Mvc;
9 | using Microsoft.Extensions.Configuration;
10 | using Microsoft.Extensions.DependencyInjection;
11 | using Microsoft.Extensions.Logging;
12 | using Microsoft.Extensions.Options;
13 |
14 | namespace AIK8sTroubleShooting
15 | {
16 | public class Startup
17 | {
18 | public Startup(IConfiguration configuration)
19 | {
20 | Configuration = configuration;
21 | }
22 |
23 | public IConfiguration Configuration { get; }
24 |
25 | // This method gets called by the runtime. Use this method to add services to the container.
26 | public void ConfigureServices(IServiceCollection services)
27 | {
28 | services.AddApplicationInsightsKubernetesEnricher(TimeSpan.FromSeconds(5));
29 | services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
30 | }
31 |
32 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
33 | public void Configure(IApplicationBuilder app, IHostingEnvironment env)
34 | {
35 | if (env.IsDevelopment())
36 | {
37 | app.UseDeveloperExceptionPage();
38 | }
39 | else
40 | {
41 | app.UseHsts();
42 | }
43 |
44 | app.UseHttpsRedirection();
45 | app.UseMvc();
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/examples/BasicUsage/Startup.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Builder;
6 | using Microsoft.AspNetCore.Hosting;
7 | using Microsoft.Extensions.Configuration;
8 | using Microsoft.Extensions.DependencyInjection;
9 |
10 | namespace BasicUsage
11 | {
12 | public class Startup
13 | {
14 | public Startup(IConfiguration configuration)
15 | {
16 | Configuration = configuration;
17 | }
18 |
19 | public IConfiguration Configuration { get; }
20 |
21 | // This method gets called by the runtime. Use this method to add services to the container.
22 | public void ConfigureServices(IServiceCollection services)
23 | {
24 | services.AddApplicationInsightsTelemetry();
25 | services.AddApplicationInsightsKubernetesEnricher();
26 | services.AddMvc();
27 | }
28 |
29 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
30 | public void Configure(IApplicationBuilder app, IHostingEnvironment env)
31 | {
32 | if (env.IsDevelopment())
33 | {
34 | app.UseDeveloperExceptionPage();
35 | }
36 | else
37 | {
38 | app.UseExceptionHandler("/Home/Error");
39 | }
40 |
41 | app.UseStaticFiles();
42 |
43 | app.UseMvc(routes =>
44 | {
45 | routes.MapRoute(
46 | name: "default",
47 | template: "{controller=Home}/{action=Index}/{id?}");
48 | });
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/examples/BasicUsage/wwwroot/lib/jquery/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright jQuery Foundation and other contributors, https://jquery.org/
2 |
3 | This software consists of voluntary contributions made by many
4 | individuals. For exact contribution history, see the revision history
5 | available at https://github.com/jquery/jquery
6 |
7 | The following license applies to all parts of this software except as
8 | documented below:
9 |
10 | ====
11 |
12 | Permission is hereby granted, free of charge, to any person obtaining
13 | a copy of this software and associated documentation files (the
14 | "Software"), to deal in the Software without restriction, including
15 | without limitation the rights to use, copy, modify, merge, publish,
16 | distribute, sublicense, and/or sell copies of the Software, and to
17 | permit persons to whom the Software is furnished to do so, subject to
18 | the following conditions:
19 |
20 | The above copyright notice and this permission notice shall be
21 | included in all copies or substantial portions of the Software.
22 |
23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 |
31 | ====
32 |
33 | All files located in the node_modules and external directories are
34 | externally maintained libraries used by this software which have their
35 | own licenses; we recommend you read them, as their terms may differ from
36 | the terms above.
37 |
--------------------------------------------------------------------------------
/examples/MultipleIKeys/wwwroot/lib/jquery/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright jQuery Foundation and other contributors, https://jquery.org/
2 |
3 | This software consists of voluntary contributions made by many
4 | individuals. For exact contribution history, see the revision history
5 | available at https://github.com/jquery/jquery
6 |
7 | The following license applies to all parts of this software except as
8 | documented below:
9 |
10 | ====
11 |
12 | Permission is hereby granted, free of charge, to any person obtaining
13 | a copy of this software and associated documentation files (the
14 | "Software"), to deal in the Software without restriction, including
15 | without limitation the rights to use, copy, modify, merge, publish,
16 | distribute, sublicense, and/or sell copies of the Software, and to
17 | permit persons to whom the Software is furnished to do so, subject to
18 | the following conditions:
19 |
20 | The above copyright notice and this permission notice shall be
21 | included in all copies or substantial portions of the Software.
22 |
23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 |
31 | ====
32 |
33 | All files located in the node_modules and external directories are
34 | externally maintained libraries used by this software which have their
35 | own licenses; we recommend you read them, as their terms may differ from
36 | the terms above.
37 |
--------------------------------------------------------------------------------
/examples/WindowsContainer/wwwroot/lib/jquery/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright jQuery Foundation and other contributors, https://jquery.org/
2 |
3 | This software consists of voluntary contributions made by many
4 | individuals. For exact contribution history, see the revision history
5 | available at https://github.com/jquery/jquery
6 |
7 | The following license applies to all parts of this software except as
8 | documented below:
9 |
10 | ====
11 |
12 | Permission is hereby granted, free of charge, to any person obtaining
13 | a copy of this software and associated documentation files (the
14 | "Software"), to deal in the Software without restriction, including
15 | without limitation the rights to use, copy, modify, merge, publish,
16 | distribute, sublicense, and/or sell copies of the Software, and to
17 | permit persons to whom the Software is furnished to do so, subject to
18 | the following conditions:
19 |
20 | The above copyright notice and this permission notice shall be
21 | included in all copies or substantial portions of the Software.
22 |
23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 |
31 | ====
32 |
33 | All files located in the node_modules and external directories are
34 | externally maintained libraries used by this software which have their
35 | own licenses; we recommend you read them, as their terms may differ from
36 | the terms above.
37 |
--------------------------------------------------------------------------------
/examples/ZeroUserCodeLightup/wwwroot/lib/jquery/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright jQuery Foundation and other contributors, https://jquery.org/
2 |
3 | This software consists of voluntary contributions made by many
4 | individuals. For exact contribution history, see the revision history
5 | available at https://github.com/jquery/jquery
6 |
7 | The following license applies to all parts of this software except as
8 | documented below:
9 |
10 | ====
11 |
12 | Permission is hereby granted, free of charge, to any person obtaining
13 | a copy of this software and associated documentation files (the
14 | "Software"), to deal in the Software without restriction, including
15 | without limitation the rights to use, copy, modify, merge, publish,
16 | distribute, sublicense, and/or sell copies of the Software, and to
17 | permit persons to whom the Software is furnished to do so, subject to
18 | the following conditions:
19 |
20 | The above copyright notice and this permission notice shall be
21 | included in all copies or substantial portions of the Software.
22 |
23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 |
31 | ====
32 |
33 | All files located in the node_modules and external directories are
34 | externally maintained libraries used by this software which have their
35 | own licenses; we recommend you read them, as their terms may differ from
36 | the terms above.
37 |
--------------------------------------------------------------------------------
/examples/BasicUsage_clr21_RBAC/app/wwwroot/lib/jquery/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright JS Foundation and other contributors, https://js.foundation/
2 |
3 | This software consists of voluntary contributions made by many
4 | individuals. For exact contribution history, see the revision history
5 | available at https://github.com/jquery/jquery
6 |
7 | The following license applies to all parts of this software except as
8 | documented below:
9 |
10 | ====
11 |
12 | Permission is hereby granted, free of charge, to any person obtaining
13 | a copy of this software and associated documentation files (the
14 | "Software"), to deal in the Software without restriction, including
15 | without limitation the rights to use, copy, modify, merge, publish,
16 | distribute, sublicense, and/or sell copies of the Software, and to
17 | permit persons to whom the Software is furnished to do so, subject to
18 | the following conditions:
19 |
20 | The above copyright notice and this permission notice shall be
21 | included in all copies or substantial portions of the Software.
22 |
23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 |
31 | ====
32 |
33 | All files located in the node_modules and external directories are
34 | externally maintained libraries used by this software which have their
35 | own licenses; we recommend you read them, as their terms may differ from
36 | the terms above.
37 |
--------------------------------------------------------------------------------
/examples/BasicUsage/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to find out which attributes exist for C# debugging
3 | // Use hover for the description of the existing attributes
4 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": ".NET Core Launch (web)",
9 | "type": "coreclr",
10 | "request": "launch",
11 | "preLaunchTask": "build",
12 | // If you have changed target frameworks, make sure to update the program path.
13 | "program": "${workspaceFolder}/bin/Debug/netcoreapp2.0/BasicUsage.dll",
14 | "args": [],
15 | "cwd": "${workspaceFolder}",
16 | "stopAtEntry": false,
17 | "internalConsoleOptions": "openOnSessionStart",
18 | "launchBrowser": {
19 | "enabled": true,
20 | "args": "${auto-detect-url}",
21 | "windows": {
22 | "command": "cmd.exe",
23 | "args": "/C start ${auto-detect-url}"
24 | },
25 | "osx": {
26 | "command": "open"
27 | },
28 | "linux": {
29 | "command": "xdg-open"
30 | }
31 | },
32 | "env": {
33 | "ASPNETCORE_ENVIRONMENT": "Development"
34 | },
35 | "sourceFileMap": {
36 | "/Views": "${workspaceFolder}/Views"
37 | }
38 | },
39 | {
40 | "name": ".NET Core Attach",
41 | "type": "coreclr",
42 | "request": "attach",
43 | "processId": "${command:pickProcess}"
44 | }
45 | ,]
46 | }
--------------------------------------------------------------------------------
/src/ApplicationInsights.Kubernetes/EntityExtensions/PodExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace Microsoft.ApplicationInsights.Kubernetes
2 | {
3 | using System;
4 | using System.Linq;
5 | using System.Collections.Generic;
6 | using Microsoft.ApplicationInsights.Kubernetes.Entities;
7 |
8 | // Extension methods for Pod
9 | internal static class PodExtensions
10 | {
11 | public static ContainerStatus GetContainerStatus(this K8sPod self, string containerId)
12 | {
13 | ContainerStatus result = self.Status.ContainerStatuses?.FirstOrDefault(
14 | cs => !string.IsNullOrEmpty(cs.ContainerID) && cs.ContainerID.EndsWith(containerId, StringComparison.Ordinal));
15 | return result;
16 | }
17 |
18 | ///
19 | /// Gets the ReplicaSet for the current pod.
20 | ///
21 | /// The target pod.
22 | /// List of replicas to search from.
23 | /// Returns the replicaSet of the pod. Returns null when the data doens't exist.
24 | public static K8sReplicaSet GetMyReplicaSet(this K8sPod self, IEnumerable scope)
25 | {
26 | OwnerReference replicaRef = self.Metadata?.OwnerReferences?.FirstOrDefault(owner => owner.GetKind() != null && owner.GetKind() == typeof(K8sReplicaSet));
27 | if (replicaRef != null)
28 | {
29 | K8sReplicaSet replica = scope?.FirstOrDefault(
30 | r => r.Metadata != null &&
31 | r.Metadata.Uid != null &&
32 | r.Metadata.Uid.Equals(replicaRef.Uid, StringComparison.OrdinalIgnoreCase));
33 | return replica;
34 | }
35 | return null;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/examples/BasicUsage_clr21_RBAC/app/Views/Shared/_CookieConsentPartial.cshtml:
--------------------------------------------------------------------------------
1 | @using Microsoft.AspNetCore.Http.Features
2 |
3 | @{
4 | var consentFeature = Context.Features.Get();
5 | var showBanner = !consentFeature?.CanTrack ?? false;
6 | var cookieString = consentFeature?.CreateConsentCookie();
7 | }
8 |
9 | @if (showBanner)
10 | {
11 |
12 |
13 |
22 |
23 |
24 | Use this space to summarize your privacy and cookie use policy.
25 |
26 |
30 |
31 |
32 |
33 |
41 | }
--------------------------------------------------------------------------------
/tests/UnitTests/KubeHttpClientTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Http;
3 | using Moq;
4 | using Xunit;
5 |
6 | namespace Microsoft.ApplicationInsights.Kubernetes
7 | {
8 | public class KubeHttpClientTests
9 | {
10 | [Fact(DisplayName = "KueHttpClient ctor should set Settings property")]
11 | public void CtorShouldSetSettingsProperty()
12 | {
13 | var settingsMock = new Mock();
14 | settingsMock.Setup(p => p.CreateMessageHandler()).Returns(new HttpClientHandler());
15 | KubeHttpClient client = new KubeHttpClient(settingsMock.Object);
16 |
17 | Assert.NotNull(client.Settings);
18 | Assert.Equal(settingsMock.Object, client.Settings);
19 | }
20 |
21 | [Fact(DisplayName = "KubeHttpClient create message handler should not return null")]
22 | public void CreateMessageHandlerShouldNotReturnNull()
23 | {
24 | var settingsMock = new Mock();
25 | settingsMock.Setup(p => p.CreateMessageHandler()).Returns(() => null);
26 |
27 | Exception ex = Assert.Throws(() =>
28 | {
29 | KubeHttpClient client = new KubeHttpClient(settingsMock.Object);
30 | });
31 |
32 | Assert.Equal("Value cannot be null.\r\nParameter name: handler", ex.Message);
33 | }
34 |
35 | [Fact(DisplayName = "KubeHttpClient ctor should set the BaseAddress property")]
36 | public void CtorShouldSetTheBaseAddress()
37 | {
38 |
39 | var settingsMock = new Mock();
40 | settingsMock.Setup(p => p.CreateMessageHandler()).Returns(new HttpClientHandler());
41 | Uri targetBaseUri = new Uri("https://k8stest/");
42 | settingsMock.Setup(p => p.ServiceBaseAddress).Returns(targetBaseUri);
43 |
44 | KubeHttpClient client = new KubeHttpClient(settingsMock.Object);
45 |
46 | Assert.NotNull(client.BaseAddress);
47 | Assert.Equal(targetBaseUri, client.BaseAddress);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/examples/BasicUsage_clr21_RBAC/app/Startup.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Builder;
6 | using Microsoft.AspNetCore.Hosting;
7 | using Microsoft.AspNetCore.Http;
8 | using Microsoft.AspNetCore.HttpsPolicy;
9 | using Microsoft.AspNetCore.Mvc;
10 | using Microsoft.Extensions.Configuration;
11 | using Microsoft.Extensions.DependencyInjection;
12 |
13 | namespace app
14 | {
15 | public class Startup
16 | {
17 | public Startup(IConfiguration configuration)
18 | {
19 | Configuration = configuration;
20 | }
21 |
22 | public IConfiguration Configuration { get; }
23 |
24 | // This method gets called by the runtime. Use this method to add services to the container.
25 | public void ConfigureServices(IServiceCollection services)
26 | {
27 | services.Configure(options =>
28 | {
29 | // This lambda determines whether user consent for non-essential cookies is needed for a given request.
30 | options.CheckConsentNeeded = context => true;
31 | options.MinimumSameSitePolicy = SameSiteMode.None;
32 | });
33 |
34 | services.AddApplicationInsightsTelemetry();
35 | services.AddApplicationInsightsKubernetesEnricher();
36 | services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
37 | }
38 |
39 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
40 | public void Configure(IApplicationBuilder app, IHostingEnvironment env)
41 | {
42 | if (env.IsDevelopment())
43 | {
44 | app.UseDeveloperExceptionPage();
45 | }
46 | else
47 | {
48 | app.UseExceptionHandler("/Home/Error");
49 | app.UseHsts();
50 | }
51 |
52 | app.UseHttpsRedirection();
53 | app.UseStaticFiles();
54 | app.UseCookiePolicy();
55 |
56 | app.UseMvc(routes =>
57 | {
58 | routes.MapRoute(
59 | name: "default",
60 | template: "{controller=Home}/{action=Index}/{id?}");
61 | });
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/examples/BasicUsage/README.md:
--------------------------------------------------------------------------------
1 | # Walk-through
2 |
3 | ## Deprecated
4 |
5 | This example is deprecated and won't be updated anymore. Please refer the [walk-through for ASP.NET Core 2.1](../BasicUsage_clr21_RBAC/Readme.md) instead.
6 |
7 | ## Description
8 |
9 | This example walks through the necessary steps to deploy an ASP.NET Core 2.0 MVC application to Kubernetes cluster with `Application Insights for Kubernetes` on.
10 |
11 | _Note:_ This is a simple example that does not follow all best practices, including security-related best practices. E.g. Application Insights instrumentation key is not adequately protected (it should be deployed as a secret).
12 |
13 | * Let's start by creating an ASP.NET Core MVC application:
14 |
15 | ```shell
16 | dotnet new mvc
17 | ```
18 |
19 | * Add the NuGet Packages:
20 |
21 | ```shell
22 | dotnet add package Microsoft.ApplicationInsights.AspNetCore
23 | dotnet add package Microsoft.ApplicationInsights.Kubernetes
24 | ```
25 |
26 | * Edit the project file, add the following property:
27 |
28 | ```xml
29 | false
30 | ```
31 |
32 | Reference [ASP.NET Core implicit store](https://docs.microsoft.com/en-us/dotnet/core/deploying/runtime-store#aspnet-core-implicit-store) for more details with regarding this property.
33 |
34 | * Enable Application Insights for Kubernetes in Startup.cs:
35 |
36 | ```csharp
37 | public void ConfigureServices(IServiceCollection services)
38 | {
39 | ...
40 | services.AddApplicationInsightsTelemetry();
41 | services.AddApplicationInsightsKubernetesEnricher();
42 | ...
43 | }
44 | ```
45 |
46 | * Optionally, update the base images:
47 |
48 | ```shell
49 | docker pull microsoft/aspnetcore-build:2.0
50 | docker pull microsoft/aspnetcore:2.0
51 | ```
52 |
53 | * Add [Dockerfile](Dockerfile) to the project folder. Build the docker container (dockeraccount/aik8sbasic, for example) using [Dockerfile](Dockerfile) and upload it to an image registry.
54 |
55 | ```shell
56 | docker build . -t dockeraccount/aik8sbasic:latest
57 | docker push dockeraccount/aik8sbasic:latest
58 | ```
59 |
60 | * Create the Kubernetes spec for the deployment and the service. Referencing [k8s.yaml](k8s.yaml). Please update the variable of `APPINSIGHTS_INSTRUMENTATIONKEY` to your own application insights instrumentation key.
61 |
62 | Deploy it:
63 |
64 | ```shell
65 | kubectl create -f k8s.yaml
66 | ```
67 |
--------------------------------------------------------------------------------
/dev/F5WebApi/Startup.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using Microsoft.ApplicationInsights.Kubernetes.Debugging;
3 | using Microsoft.AspNetCore.Builder;
4 | using Microsoft.AspNetCore.Hosting;
5 | using Microsoft.AspNetCore.Mvc;
6 | using Microsoft.Extensions.Configuration;
7 | using Microsoft.Extensions.DependencyInjection;
8 |
9 | namespace F5WebApi
10 | {
11 | public class Startup
12 | {
13 | public Startup(IConfiguration configuration)
14 | {
15 | Configuration = configuration;
16 | }
17 |
18 | public IConfiguration Configuration { get; }
19 |
20 | // This method gets called by the runtime. Use this method to add services to the container.
21 | public void ConfigureServices(IServiceCollection services)
22 | {
23 | // To use this project for F5 debugging, follow these steps:
24 |
25 | // Output the diagnostic source logs to the console.
26 | var observer = new ApplicationInsightsKubernetesDiagnosticObserver(DiagnosticLogLevel.Trace);
27 | ApplicationInsightsKubernetesDiagnosticSource.Instance.Observable.SubscribeWithAdapter(observer);
28 |
29 | // Step 1. Set iKey in the parameter below.
30 | services.AddApplicationInsightsTelemetry("your-instrumentation-key");
31 |
32 | // Step 2. Call proper overloads of AddApplicationInsightsKubernetesEnricher.
33 | services.AddApplicationInsightsKubernetesEnricher(applyOptions: null,
34 | kubernetesServiceCollectionBuilder: KubernetesDebuggingServiceCollectionBuilderFactory.Instance.Create(),
35 | detectKubernetes: () => true);
36 | // Step 3. Set a break point and press F5.
37 | // ~
38 |
39 | services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
40 | }
41 |
42 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
43 | public void Configure(IApplicationBuilder app, IHostingEnvironment env)
44 | {
45 | if (env.IsDevelopment())
46 | {
47 | app.UseDeveloperExceptionPage();
48 | }
49 | else
50 | {
51 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
52 | app.UseHsts();
53 | }
54 |
55 | app.UseHttpsRedirection();
56 | app.UseMvc();
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | $(MSBuildThisFileDirectory)..\bin\Debug\
6 |
7 |
8 | $(MSBuildThisFileDirectory)..\bin\Release\
9 | True
10 |
11 |
12 |
13 | True
14 | True
15 | $(MSBuildThisFileDirectory)PublicKey.snk
16 |
17 | $([System.DateTime]::Now.ToString(yyyyMMddHHmm))
18 | 1.1.0-private-$(VersionSuffix)
19 | 1.1.0.0
20 | Microsoft
21 | Microsoft
22 | True
23 |
24 | LICENSE
25 | https://github.com/Microsoft/ApplicationInsights-Kubernetes/
26 | http://appanacdn.blob.core.windows.net/cdn/icons/aic.png
27 | © Microsoft Corporation. All rights reserved.
28 | https://github.com/Microsoft/ApplicationInsights-Kubernetes/
29 |
30 |
31 |
32 |
33 | all
34 |
35 |
36 |
37 |
38 | Microsoft400
39 | StrongName
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------