├── tests ├── UnitTests │ ├── token │ ├── namespace │ ├── StringUtilsTest.cs │ ├── KubernetesTestServiceCollectionBuilder.cs │ ├── TestCGroup │ ├── UnitTests.csproj │ └── KubeHttpClientTests.cs └── .vscode │ ├── tasks.json │ └── launch.json ├── examples ├── BasicUsage │ ├── wwwroot │ │ ├── js │ │ │ ├── site.min.js │ │ │ └── site.js │ │ ├── favicon.ico │ │ ├── lib │ │ │ ├── bootstrap │ │ │ │ ├── dist │ │ │ │ │ ├── fonts │ │ │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ │ │ │ └── glyphicons-halflings-regular.woff2 │ │ │ │ │ └── js │ │ │ │ │ │ └── npm.js │ │ │ │ ├── .bower.json │ │ │ │ └── LICENSE │ │ │ ├── jquery │ │ │ │ ├── .bower.json │ │ │ │ └── LICENSE.txt │ │ │ ├── jquery-validation │ │ │ │ ├── .bower.json │ │ │ │ └── LICENSE.md │ │ │ └── jquery-validation-unobtrusive │ │ │ │ └── .bower.json │ │ └── css │ │ │ ├── site.min.css │ │ │ └── site.css │ ├── .gitignore │ ├── Views │ │ ├── _ViewStart.cshtml │ │ ├── _ViewImports.cshtml │ │ ├── Home │ │ │ ├── About.cshtml │ │ │ └── Contact.cshtml │ │ └── Shared │ │ │ ├── Error.cshtml │ │ │ └── _ValidationScriptsPartial.cshtml │ ├── appsettings.json │ ├── appsettings.Development.json │ ├── Models │ │ └── ErrorViewModel.cs │ ├── .vscode │ │ ├── tasks.json │ │ └── launch.json │ ├── Dockerfile │ ├── Program.cs │ ├── bundleconfig.json │ ├── BasicUsage.csproj │ ├── k8s.yaml │ ├── Controllers │ │ └── HomeController.cs │ ├── Startup.cs │ └── README.md ├── MultipleIKeys │ ├── wwwroot │ │ ├── js │ │ │ ├── site.min.js │ │ │ └── site.js │ │ ├── favicon.ico │ │ ├── lib │ │ │ ├── bootstrap │ │ │ │ ├── dist │ │ │ │ │ ├── fonts │ │ │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ │ │ │ └── glyphicons-halflings-regular.woff2 │ │ │ │ │ └── js │ │ │ │ │ │ └── npm.js │ │ │ │ ├── .bower.json │ │ │ │ └── LICENSE │ │ │ ├── jquery │ │ │ │ ├── .bower.json │ │ │ │ └── LICENSE.txt │ │ │ ├── jquery-validation │ │ │ │ ├── .bower.json │ │ │ │ └── LICENSE.md │ │ │ └── jquery-validation-unobtrusive │ │ │ │ └── .bower.json │ │ └── css │ │ │ ├── site.min.css │ │ │ └── site.css │ ├── Views │ │ ├── _ViewStart.cshtml │ │ ├── _ViewImports.cshtml │ │ ├── Home │ │ │ ├── About.cshtml │ │ │ └── Contact.cshtml │ │ └── Shared │ │ │ ├── Error.cshtml │ │ │ └── _ValidationScriptsPartial.cshtml │ ├── Media │ │ └── screenshot1.png │ ├── appsettings.json │ ├── appsettings.Development.json │ ├── Models │ │ └── ErrorViewModel.cs │ ├── dockerfile │ ├── bundleconfig.json │ ├── MultipleIKeys.csproj │ ├── Program.cs │ ├── k8s.yaml │ └── Controllers │ │ └── HomeController.cs ├── WindowsContainer │ ├── wwwroot │ │ ├── js │ │ │ ├── site.min.js │ │ │ └── site.js │ │ ├── favicon.ico │ │ ├── lib │ │ │ ├── bootstrap │ │ │ │ ├── dist │ │ │ │ │ ├── fonts │ │ │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ │ │ │ └── glyphicons-halflings-regular.woff2 │ │ │ │ │ └── js │ │ │ │ │ │ └── npm.js │ │ │ │ ├── .bower.json │ │ │ │ └── LICENSE │ │ │ ├── jquery │ │ │ │ ├── .bower.json │ │ │ │ └── LICENSE.txt │ │ │ ├── jquery-validation │ │ │ │ ├── .bower.json │ │ │ │ └── LICENSE.md │ │ │ └── jquery-validation-unobtrusive │ │ │ │ └── .bower.json │ │ └── css │ │ │ ├── site.min.css │ │ │ └── site.css │ ├── Views │ │ ├── _ViewStart.cshtml │ │ ├── _ViewImports.cshtml │ │ ├── Home │ │ │ ├── About.cshtml │ │ │ └── Contact.cshtml │ │ └── Shared │ │ │ ├── Error.cshtml │ │ │ └── _ValidationScriptsPartial.cshtml │ ├── appsettings.Development.json │ ├── Models │ │ └── ErrorViewModel.cs │ ├── appsettings.json │ ├── Dockerfile │ ├── bundleconfig.json │ ├── Program.cs │ ├── k8s │ │ ├── saRole.yaml │ │ └── k8s.yaml │ ├── AspNetCoreNano.csproj │ ├── Controllers │ │ └── HomeController.cs │ └── Startup.cs ├── ZeroUserCodeLightup │ ├── wwwroot │ │ ├── js │ │ │ ├── site.min.js │ │ │ └── site.js │ │ ├── favicon.ico │ │ ├── lib │ │ │ ├── bootstrap │ │ │ │ ├── dist │ │ │ │ │ ├── fonts │ │ │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ │ │ │ └── glyphicons-halflings-regular.woff2 │ │ │ │ │ └── js │ │ │ │ │ │ └── npm.js │ │ │ │ ├── .bower.json │ │ │ │ └── LICENSE │ │ │ ├── jquery │ │ │ │ ├── .bower.json │ │ │ │ └── LICENSE.txt │ │ │ ├── jquery-validation │ │ │ │ ├── .bower.json │ │ │ │ └── LICENSE.md │ │ │ └── jquery-validation-unobtrusive │ │ │ │ └── .bower.json │ │ └── css │ │ │ ├── site.min.css │ │ │ └── site.css │ ├── .dockerignore │ ├── Views │ │ ├── _ViewStart.cshtml │ │ ├── _ViewImports.cshtml │ │ ├── Home │ │ │ ├── About.cshtml │ │ │ └── Contact.cshtml │ │ └── Shared │ │ │ ├── Error.cshtml │ │ │ └── _ValidationScriptsPartial.cshtml │ ├── appsettings.json │ ├── .media │ │ └── AI_K8s_Properties.png │ ├── appsettings.Development.json │ ├── Models │ │ └── ErrorViewModel.cs │ ├── ZeroUserCodeLightup.csproj │ ├── bundleconfig.json │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Controllers │ │ └── HomeController.cs │ ├── Dockerfile │ ├── k8s │ │ └── deployment.yaml │ └── Startup.cs ├── BasicUsage_clr21_RBAC │ ├── app │ │ ├── wwwroot │ │ │ ├── js │ │ │ │ ├── site.min.js │ │ │ │ └── site.js │ │ │ ├── favicon.ico │ │ │ ├── lib │ │ │ │ ├── bootstrap │ │ │ │ │ ├── dist │ │ │ │ │ │ ├── fonts │ │ │ │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ │ │ │ │ └── glyphicons-halflings-regular.woff2 │ │ │ │ │ │ └── js │ │ │ │ │ │ │ └── npm.js │ │ │ │ │ ├── .bower.json │ │ │ │ │ └── LICENSE │ │ │ │ ├── jquery-validation-unobtrusive │ │ │ │ │ ├── .bower.json │ │ │ │ │ └── LICENSE.txt │ │ │ │ ├── jquery │ │ │ │ │ ├── .bower.json │ │ │ │ │ └── LICENSE.txt │ │ │ │ └── jquery-validation │ │ │ │ │ ├── .bower.json │ │ │ │ │ └── LICENSE.md │ │ │ └── css │ │ │ │ ├── site.min.css │ │ │ │ └── site.css │ │ ├── Views │ │ │ ├── _ViewStart.cshtml │ │ │ ├── _ViewImports.cshtml │ │ │ ├── Home │ │ │ │ ├── Privacy.cshtml │ │ │ │ ├── About.cshtml │ │ │ │ └── Contact.cshtml │ │ │ └── Shared │ │ │ │ ├── Error.cshtml │ │ │ │ ├── _ValidationScriptsPartial.cshtml │ │ │ │ └── _CookieConsentPartial.cshtml │ │ ├── appsettings.json │ │ ├── appsettings.Development.json │ │ ├── Models │ │ │ └── ErrorViewModel.cs │ │ ├── Dockerfile │ │ ├── app.csproj │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── Controllers │ │ │ └── HomeController.cs │ │ └── Startup.cs │ ├── .gitignore │ ├── media │ │ └── Result.png │ └── k8s │ │ ├── saRole.yaml │ │ └── k8s.yaml ├── GenericHost │ ├── media │ │ └── result.png │ └── src │ │ ├── K8s.yaml │ │ ├── Dockerfile │ │ ├── AIK8sGenericHost.csproj │ │ └── SendAIEventService.cs ├── BasicConsoleApp │ ├── .media │ │ └── TraceResultQuery.png │ └── src │ │ ├── Dockerfile │ │ ├── k8s.yaml │ │ ├── AiK8sConsole.csproj │ │ ├── saRole.yaml │ │ └── Program.cs ├── BasicConsoleAppILogger │ ├── k8s.yaml │ ├── Dockerfile │ ├── BasicConsoleAppILogger.csproj │ └── README.md └── .vscode │ └── launch.json ├── src ├── PublicKey.snk ├── ApplicationInsights.Kubernetes.HostingStartup │ ├── AssemblyInfo.cs │ ├── K8sInjection.cs │ └── ApplicationInsights.Kubernetes.HostingStartup.csproj ├── ApplicationInsights.Kubernetes │ ├── Interfaces │ │ ├── IK8sEnvironmentFactory.cs │ │ ├── IKubeHttpClientSettingsProvider.cs │ │ ├── IHttpClientSettingsProvider.cs │ │ ├── ICertificateVerifier.cs │ │ ├── IKubeHttpClient.cs │ │ └── IK8sEnvironment.cs │ ├── Entities │ │ ├── K8sNodeMetaData.cs │ │ ├── K8sReplicaSetMetadata.cs │ │ ├── K8sDeploymentMetadata.cs │ │ ├── K8sPodSpec.cs │ │ ├── K8sDeploymentSpec.cs │ │ ├── K8sObject.cs │ │ ├── K8sReplicaSet.cs │ │ ├── K8sNodeStatus.cs │ │ ├── Selector.cs │ │ ├── OwnerReference.cs │ │ ├── K8sNode.cs │ │ ├── K8sPodMetadata.cs │ │ ├── K8sDeployment.cs │ │ ├── K8sNodeImage.cs │ │ ├── K8sPodStatus.cs │ │ ├── K8sPod.cs │ │ ├── K8sObjectMetadata.cs │ │ ├── ContainerStatus.cs │ │ └── K8sEntityList.cs │ ├── K8sQueryClientFactory.cs │ ├── EntityExtensions │ │ ├── OwnerReferenceExtensions.cs │ │ ├── ReplicaSetExtensions.cs │ │ └── PodExtensions.cs │ ├── IK8sQueryClient.cs │ ├── K8sHttpClient │ │ ├── KubeHttpClientFactory.cs │ │ ├── CertificateVerifier.cs │ │ └── KubeHttpClient.cs │ ├── Extensions │ │ ├── AppInsightsForKubernetesOptions.cs │ │ └── IKubernetesServiceCollectionBuilder.cs │ ├── Utilities │ │ ├── Arguments.cs │ │ ├── StringUtils.cs │ │ └── SDKVersionUtils.cs │ ├── Debuggings │ │ ├── KubeDebuggingHttpClientSettings.cs │ │ ├── DiagnosticLogLevel.cs │ │ ├── KubernetesDebuggingServiceCollectionBuilder.cs │ │ └── KubernetesDebuggingServiceCollectionBuilderFactory.cs │ └── AssemblyInfo.cs ├── .vscode │ └── tasks.json └── Directory.Build.props ├── dev ├── F5WebApi │ ├── appsettings.json │ ├── appsettings.Development.json │ ├── Program.cs │ ├── F5WebApi.csproj │ ├── Properties │ │ └── launchSettings.json │ ├── Controllers │ │ └── ValuesController.cs │ └── Startup.cs └── .vscode │ ├── tasks.json │ └── launch.json ├── troubleshooting └── AIK8sTroubleShooting │ ├── appsettings.Development.json │ ├── appsettings.json │ ├── Dockerfile │ ├── .vscode │ └── tasks.json │ ├── Program.cs │ ├── k8s │ └── k8s.yaml │ ├── AIK8sTroubleShooting.csproj │ ├── Properties │ └── launchSettings.json │ ├── Controllers │ └── ValuesController.cs │ └── Startup.cs ├── NuGet.config ├── solution.code-workspace └── LICENSE /tests/UnitTests/token: -------------------------------------------------------------------------------- 1 | Test-token -------------------------------------------------------------------------------- /tests/UnitTests/namespace: -------------------------------------------------------------------------------- 1 | testdefault -------------------------------------------------------------------------------- /examples/BasicUsage/wwwroot/js/site.min.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/BasicUsage/.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | obj/ 3 | -------------------------------------------------------------------------------- /examples/MultipleIKeys/wwwroot/js/site.min.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/WindowsContainer/wwwroot/js/site.min.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/wwwroot/js/site.min.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/wwwroot/js/site.min.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/.gitignore: -------------------------------------------------------------------------------- 1 | obj/ 2 | bin/ 3 | -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/.dockerignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | obj/ 3 | -------------------------------------------------------------------------------- /examples/BasicUsage/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | // Write your JavaScript code. 2 | -------------------------------------------------------------------------------- /examples/MultipleIKeys/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | // Write your JavaScript code. 2 | -------------------------------------------------------------------------------- /examples/WindowsContainer/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | // Write your JavaScript code. 2 | -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | // Write your JavaScript code. 2 | -------------------------------------------------------------------------------- /examples/BasicUsage/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /examples/MultipleIKeys/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /examples/WindowsContainer/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /src/PublicKey.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/src/PublicKey.snk -------------------------------------------------------------------------------- /examples/BasicUsage/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using BasicUsage 2 | @using BasicUsage.Models 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /examples/GenericHost/media/result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/GenericHost/media/result.png -------------------------------------------------------------------------------- /examples/BasicUsage/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/BasicUsage/wwwroot/favicon.ico -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using app 2 | @using app.Models 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /examples/MultipleIKeys/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using MultipleIKeys 2 | @using MultipleIKeys.Models 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /examples/MultipleIKeys/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/MultipleIKeys/wwwroot/favicon.ico -------------------------------------------------------------------------------- /examples/MultipleIKeys/Media/screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/MultipleIKeys/Media/screenshot1.png -------------------------------------------------------------------------------- /examples/WindowsContainer/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using AspNetCoreNano 2 | @using AspNetCoreNano.Models 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /examples/WindowsContainer/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/WindowsContainer/wwwroot/favicon.ico -------------------------------------------------------------------------------- /examples/BasicUsage/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/media/Result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/BasicUsage_clr21_RBAC/media/Result.png -------------------------------------------------------------------------------- /examples/MultipleIKeys/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/ZeroUserCodeLightup/wwwroot/favicon.ico -------------------------------------------------------------------------------- /examples/BasicConsoleApp/.media/TraceResultQuery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/BasicConsoleApp/.media/TraceResultQuery.png -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Warning" 5 | } 6 | }, 7 | "AllowedHosts": "*" 8 | } 9 | -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using ZeroUserCodeLightup 2 | @using ZeroUserCodeLightup.Models 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/BasicUsage_clr21_RBAC/app/wwwroot/favicon.ico -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/.media/AI_K8s_Properties.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/ZeroUserCodeLightup/.media/AI_K8s_Properties.png -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes.HostingStartup/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using ApplicationInsights.Kubernetes.HostingStartup; 2 | using Microsoft.AspNetCore.Hosting; 3 | 4 | [assembly: HostingStartup(typeof(K8sInjection))] -------------------------------------------------------------------------------- /dev/F5WebApi/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Warning", 5 | "Microsoft.Hosting.Lifetime": "Information" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/Views/Home/Privacy.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Privacy Policy"; 3 | } 4 |

@ViewData["Title"]

5 | 6 |

Use this page to detail your site's privacy policy.

7 | -------------------------------------------------------------------------------- /dev/F5WebApi/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/BasicUsage/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "About"; 3 | } 4 |

@ViewData["Title"]

5 |

@ViewData["Message"]

6 | 7 |

Use this area to provide additional information.

8 | -------------------------------------------------------------------------------- /examples/MultipleIKeys/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "About"; 3 | } 4 |

@ViewData["Title"]

5 |

@ViewData["Message"]

6 | 7 |

Use this area to provide additional information.

8 | -------------------------------------------------------------------------------- /examples/WindowsContainer/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "About"; 3 | } 4 |

@ViewData["Title"]

5 |

@ViewData["Message"]

6 | 7 |

Use this area to provide additional information.

8 | -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "About"; 3 | } 4 |

@ViewData["Title"]

5 |

@ViewData["Message"]

6 | 7 |

Use this area to provide additional information.

8 | -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "About"; 3 | } 4 |

@ViewData["Title"]

5 |

@ViewData["Message"]

6 | 7 |

Use this area to provide additional information.

8 | -------------------------------------------------------------------------------- /examples/BasicUsage/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/BasicUsage/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /examples/BasicUsage/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/BasicUsage/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /examples/BasicUsage/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/BasicUsage/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /troubleshooting/AIK8sTroubleShooting/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/BasicUsage/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/BasicUsage/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /examples/MultipleIKeys/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/MultipleIKeys/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /examples/MultipleIKeys/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/MultipleIKeys/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /examples/MultipleIKeys/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/MultipleIKeys/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /examples/MultipleIKeys/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/MultipleIKeys/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /examples/WindowsContainer/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/WindowsContainer/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /examples/WindowsContainer/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/WindowsContainer/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /troubleshooting/AIK8sTroubleShooting/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Warning", 5 | "Microsoft.ApplicationInsights.Kubernetes": "Trace" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /examples/WindowsContainer/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/WindowsContainer/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /examples/WindowsContainer/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/WindowsContainer/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /examples/BasicUsage/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/MultipleIKeys/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/ZeroUserCodeLightup/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/ZeroUserCodeLightup/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/ZeroUserCodeLightup/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/ZeroUserCodeLightup/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /examples/WindowsContainer/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/BasicUsage_clr21_RBAC/app/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/BasicUsage_clr21_RBAC/app/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/BasicUsage_clr21_RBAC/app/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/altinn/ApplicationInsights-Kubernetes/develop/examples/BasicUsage_clr21_RBAC/app/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/wwwroot/js/site.js: -------------------------------------------------------------------------------- 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 | 4 | // Write your JavaScript code. 5 | -------------------------------------------------------------------------------- /examples/BasicUsage/Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BasicUsage.Models 4 | { 5 | public class ErrorViewModel 6 | { 7 | public string RequestId { get; set; } 8 | 9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 10 | } 11 | } -------------------------------------------------------------------------------- /NuGet.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace app.Models 4 | { 5 | public class ErrorViewModel 6 | { 7 | public string RequestId { get; set; } 8 | 9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 10 | } 11 | } -------------------------------------------------------------------------------- /examples/MultipleIKeys/Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MultipleIKeys.Models 4 | { 5 | public class ErrorViewModel 6 | { 7 | public string RequestId { get; set; } 8 | 9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 10 | } 11 | } -------------------------------------------------------------------------------- /examples/WindowsContainer/Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AspNetCoreNano.Models 4 | { 5 | public class ErrorViewModel 6 | { 7 | public string RequestId { get; set; } 8 | 9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 10 | } 11 | } -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ZeroUserCodeLightup.Models 4 | { 5 | public class ErrorViewModel 6 | { 7 | public string RequestId { get; set; } 8 | 9 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 10 | } 11 | } -------------------------------------------------------------------------------- /examples/BasicUsage/wwwroot/css/site.min.css: -------------------------------------------------------------------------------- 1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}#qrCode{margin:15px}@media screen and (max-width:767px){.carousel-caption{display:none}} -------------------------------------------------------------------------------- /examples/MultipleIKeys/wwwroot/css/site.min.css: -------------------------------------------------------------------------------- 1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}#qrCode{margin:15px}@media screen and (max-width:767px){.carousel-caption{display:none}} -------------------------------------------------------------------------------- /examples/WindowsContainer/wwwroot/css/site.min.css: -------------------------------------------------------------------------------- 1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}#qrCode{margin:15px}@media screen and (max-width:767px){.carousel-caption{display:none}} -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/wwwroot/css/site.min.css: -------------------------------------------------------------------------------- 1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}#qrCode{margin:15px}@media screen and (max-width:767px){.carousel-caption{display:none}} -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Interfaces/IK8sEnvironmentFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace Microsoft.ApplicationInsights.Kubernetes 5 | { 6 | internal interface IK8sEnvironmentFactory 7 | { 8 | Task CreateAsync(DateTime timeoutAt); 9 | } 10 | } -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/wwwroot/css/site.min.css: -------------------------------------------------------------------------------- 1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}#qrCode{margin:15px}@media screen and (max-width:767px){.carousel-caption{display:none}} -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Entities/K8sNodeMetaData.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes.Entities 2 | { 3 | using Newtonsoft.Json; 4 | 5 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 6 | internal class K8sNodeMetadata : K8sObjectMetadata 7 | { 8 | 9 | } 10 | } -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Interfaces/IKubeHttpClientSettingsProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes 2 | { 3 | internal interface IKubeHttpClientSettingsProvider : IHttpClientSettingsProvider 4 | { 5 | string ContainerId { get; } 6 | string QueryNamespace { get; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/WindowsContainer/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Warning", 6 | "Microsoft.ApplicationInsights.Kubernetes": "Debug" 7 | } 8 | }, 9 | "ApplicationInsights": { 10 | "InstrumentationKey": "your app insights instrumentation key" 11 | } 12 | } -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Entities/K8sReplicaSetMetadata.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace Microsoft.ApplicationInsights.Kubernetes.Entities 4 | { 5 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 6 | internal class K8sReplicaSetMetadata : K8sObjectMetadata 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Entities/K8sDeploymentMetadata.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes.Entities 2 | { 3 | using Newtonsoft.Json; 4 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 5 | internal class K8sDeploymentMetadata : K8sObjectMetadata 6 | { 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Entities/K8sPodSpec.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes.Entities 2 | { 3 | using Newtonsoft.Json; 4 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 5 | internal class K8sPodSpec 6 | { 7 | [JsonProperty("nodeName")] 8 | public string NodeName { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/GenericHost/src/K8s.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Deployment 3 | metadata: 4 | name: ai-k8s-generic-host 5 | spec: 6 | replicas: 1 7 | template: 8 | metadata: 9 | labels: 10 | app: consoleapp 11 | spec: 12 | containers: 13 | - name: ai-k8s-generic-host-container 14 | image: dockeraccount/aik8sgenerichost:latest -------------------------------------------------------------------------------- /examples/BasicConsoleAppILogger/k8s.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Deployment 3 | metadata: 4 | name: ai-k8s-basic-console 5 | spec: 6 | replicas: 1 7 | template: 8 | metadata: 9 | labels: 10 | app: consoleapp 11 | spec: 12 | containers: 13 | - name: ai-k8s-basic-container 14 | image: dockeraccount/basicconsole:latest 15 | -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Entities/K8sDeploymentSpec.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes.Entities 2 | { 3 | using Newtonsoft.Json; 4 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 5 | internal class K8sDeploymentSpec 6 | { 7 | [JsonProperty("selector")] 8 | public Selector Selector { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Entities/K8sObject.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes.Entities 2 | { 3 | using Newtonsoft.Json; 4 | internal class K8sObject 5 | { 6 | [JsonProperty("kind")] 7 | public string Kind { get; set; } 8 | 9 | [JsonProperty("apiVersion")] 10 | public string ApiVersion { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Entities/K8sReplicaSet.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Microsoft.ApplicationInsights.Kubernetes.Entities 3 | { 4 | using Newtonsoft.Json; 5 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 6 | internal class K8sReplicaSet : K8sObject 7 | { 8 | [JsonProperty("metadata")] 9 | public K8sReplicaSetMetadata Metadata { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Interfaces/IHttpClientSettingsProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes 2 | { 3 | using System; 4 | using System.Net.Http; 5 | 6 | internal interface IHttpClientSettingsProvider 7 | { 8 | Uri ServiceBaseAddress { get; } 9 | 10 | HttpMessageHandler CreateMessageHandler(); 11 | 12 | string GetToken(); 13 | } 14 | } -------------------------------------------------------------------------------- /examples/BasicUsage/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "command": "dotnet", 7 | "type": "process", 8 | "args": [ 9 | "build", 10 | "${workspaceFolder}/BasicUsage.csproj" 11 | ], 12 | "problemMatcher": "$msCompile" 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Entities/K8sNodeStatus.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes.Entities 2 | { 3 | using System.Collections.Generic; 4 | using Newtonsoft.Json; 5 | 6 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 7 | internal class K8sNodeStatus 8 | { 9 | [JsonProperty("images")] 10 | public IEnumerable Images { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Entities/Selector.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes.Entities 2 | { 3 | using System.Collections.Generic; 4 | using Newtonsoft.Json; 5 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 6 | internal class Selector 7 | { 8 | [JsonProperty("matchLabels")] 9 | public IDictionary MatchLabels { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /examples/BasicUsage/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM microsoft/aspnetcore-build:2.0 AS build-env 2 | WORKDIR /app 3 | 4 | # Copy csproj and restore as distinct layers 5 | COPY *.csproj ./ 6 | RUN dotnet restore 7 | 8 | # Copy everything else and build 9 | COPY . ./ 10 | RUN dotnet publish -c Release -o out 11 | 12 | # Build runtime image 13 | FROM microsoft/aspnetcore:2.0 14 | WORKDIR /app 15 | COPY --from=build-env /app/out . 16 | ENTRYPOINT ["dotnet", "BasicUsage.dll"] -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Interfaces/ICertificateVerifier.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes 2 | { 3 | using System; 4 | using System.Security.Cryptography.X509Certificates; 5 | 6 | internal interface ICertificateVerifier 7 | { 8 | X509Certificate2 Certificate { get; } 9 | string Issuer { get; } 10 | DateTime NotBefore { get; } 11 | DateTime NotAfter { get; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Entities/OwnerReference.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes.Entities 2 | { 3 | using Newtonsoft.Json; 4 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 5 | 6 | internal class OwnerReference : K8sObject 7 | { 8 | [JsonProperty("name")] 9 | public string Name { get; set; } 10 | [JsonProperty("uid")] 11 | public string Uid { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Entities/K8sNode.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes.Entities 2 | { 3 | using Newtonsoft.Json; 4 | 5 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 6 | internal class K8sNode 7 | { 8 | [JsonProperty("metadata")] 9 | public K8sNodeMetadata Metadata { get; set; } 10 | 11 | [JsonProperty("status")] 12 | public K8sNodeStatus Status { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/core/sdk:2.1 AS build-env 2 | WORKDIR /app 3 | 4 | # Copy csproj and restore as distinct layers 5 | COPY *.csproj ./ 6 | RUN dotnet restore 7 | 8 | # Copy everything else and build 9 | COPY . ./ 10 | RUN dotnet publish -c Release -o out 11 | 12 | # Build runtime image 13 | FROM mcr.microsoft.com/dotnet/core/aspnet:2.1 14 | WORKDIR /app 15 | COPY --from=build-env /app/out . 16 | ENTRYPOINT ["dotnet", "app.dll"] -------------------------------------------------------------------------------- /examples/MultipleIKeys/dockerfile: -------------------------------------------------------------------------------- 1 | FROM microsoft/aspnetcore-build:2.0 AS build-env 2 | WORKDIR /app 3 | 4 | # Copy csproj and restore as distinct layers 5 | COPY *.csproj ./ 6 | COPY NuGet.config ./ 7 | RUN dotnet restore 8 | 9 | # Copy everything else and build 10 | COPY . ./ 11 | RUN dotnet publish -c Release -o out 12 | 13 | # Build runtime image 14 | FROM microsoft/aspnetcore:2.0 15 | WORKDIR /app 16 | COPY --from=build-env /app/out . 17 | ENTRYPOINT ["dotnet", "K8sBasic.dll"] 18 | -------------------------------------------------------------------------------- /examples/BasicConsoleApp/src/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build-env 2 | WORKDIR /app 3 | 4 | # Copy csproj and restore as distinct layers 5 | COPY *.csproj ./ 6 | RUN dotnet restore 7 | 8 | # Copy everything else and build 9 | COPY . ./ 10 | RUN dotnet publish -c Release -o out 11 | 12 | # Build runtime image 13 | FROM mcr.microsoft.com/dotnet/core/runtime:2.2 14 | WORKDIR /app 15 | COPY --from=build-env /app/out . 16 | ENTRYPOINT ["dotnet", "AiK8sConsole.dll"] -------------------------------------------------------------------------------- /examples/GenericHost/src/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build-env 2 | WORKDIR /app 3 | 4 | # Copy csproj and restore as distinct layers 5 | COPY *.csproj ./ 6 | RUN dotnet restore 7 | 8 | # Copy everything else and build 9 | COPY . ./ 10 | RUN dotnet publish -c Release -o out 11 | 12 | # Build runtime image 13 | FROM mcr.microsoft.com/dotnet/core/runtime:2.2 14 | WORKDIR /app 15 | COPY --from=build-env /app/out . 16 | ENTRYPOINT ["dotnet", "AIK8sGenericHost.dll"] -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Entities/K8sPodMetadata.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes.Entities 2 | { 3 | using System.Collections.Generic; 4 | using Newtonsoft.Json; 5 | 6 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 7 | internal class K8sPodMetadata : K8sObjectMetadata 8 | { 9 | [JsonProperty("ownerReferences")] 10 | public IEnumerable OwnerReferences { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /troubleshooting/AIK8sTroubleShooting/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM microsoft/dotnet:2.1-sdk AS build-env 2 | WORKDIR /app 3 | 4 | # Copy csproj and restore as distinct layers 5 | COPY *.csproj ./ 6 | RUN dotnet restore 7 | 8 | # Copy everything else and build 9 | COPY . ./ 10 | RUN dotnet publish -c Release -o out 11 | 12 | # Build runtime image 13 | FROM microsoft/dotnet:2.1-aspnetcore-runtime 14 | WORKDIR /app 15 | COPY --from=build-env /app/out . 16 | ENTRYPOINT ["dotnet", "AIK8sTroubleShooting.dll"] -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/ZeroUserCodeLightup.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /dev/F5WebApi/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore; 2 | using Microsoft.AspNetCore.Hosting; 3 | 4 | namespace F5WebApi 5 | { 6 | public class Program 7 | { 8 | public static void Main(string[] args) 9 | { 10 | CreateHostBuilder(args).Build().Run(); 11 | } 12 | 13 | public static IWebHostBuilder CreateHostBuilder(string[] args) => 14 | WebHost.CreateDefaultBuilder(args) 15 | .UseStartup(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/BasicConsoleAppILogger/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build-env 2 | WORKDIR /app 3 | 4 | # Copy csproj and restore as distinct layers 5 | COPY *.csproj ./ 6 | RUN dotnet restore 7 | 8 | # Copy everything else and build 9 | COPY . ./ 10 | RUN dotnet publish -c Release -o out 11 | 12 | # Build runtime image 13 | FROM mcr.microsoft.com/dotnet/core/runtime:2.2 14 | WORKDIR /app 15 | COPY --from=build-env /app/out . 16 | ENTRYPOINT ["dotnet", "BasicConsoleAppILogger.dll"] -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Entities/K8sDeployment.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes.Entities 2 | { 3 | using Newtonsoft.Json; 4 | 5 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 6 | internal class K8sDeployment 7 | { 8 | [JsonProperty("metadata")] 9 | public K8sDeploymentMetadata Metadata { get; set; } 10 | 11 | [JsonProperty("spec")] 12 | public K8sDeploymentSpec Spec { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/app.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Entities/K8sNodeImage.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes.Entities 2 | { 3 | using System.Collections.Generic; 4 | using Newtonsoft.Json; 5 | 6 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 7 | internal class K8sNodeImage 8 | { 9 | [JsonProperty("names")] 10 | public IList Names { get; set; } 11 | 12 | [JsonProperty("sizeBytes")] 13 | public long SizeBytes { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /examples/BasicConsoleApp/src/k8s.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Deployment 3 | metadata: 4 | name: ai-k8s-console 5 | spec: 6 | replicas: 1 7 | template: 8 | metadata: 9 | labels: 10 | app: webapp 11 | spec: 12 | containers: 13 | - name: aik8sconsole 14 | image: dockeraccount/aik8sconsole:latest 15 | ports: 16 | - containerPort: 80 17 | env: 18 | - name: APPINSIGHTS_INSTRUMENTATIONKEY 19 | value: your-application-instrumentation-key 20 | -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Entities/K8sPodStatus.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes.Entities 2 | { 3 | using System.Collections.Generic; 4 | using Newtonsoft.Json; 5 | 6 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 7 | internal class K8sPodStatus 8 | { 9 | [JsonProperty("phase")] 10 | public string Phase { get; set; } 11 | 12 | [JsonProperty("containerStatuses")] 13 | public IEnumerable ContainerStatuses { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /troubleshooting/AIK8sTroubleShooting/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "build", 8 | "command": "dotnet build", 9 | "type": "shell", 10 | "group": "build", 11 | "presentation": { 12 | "reveal": "silent" 13 | }, 14 | "problemMatcher": "$msCompile" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /examples/BasicUsage/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Contact"; 3 | } 4 |

@ViewData["Title"]

5 |

@ViewData["Message"]

6 | 7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P: 11 | 425.555.0100 12 |
13 | 14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com 17 |
18 | -------------------------------------------------------------------------------- /examples/MultipleIKeys/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Contact"; 3 | } 4 |

@ViewData["Title"]

5 |

@ViewData["Message"]

6 | 7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P: 11 | 425.555.0100 12 |
13 | 14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com 17 |
18 | -------------------------------------------------------------------------------- /examples/WindowsContainer/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Contact"; 3 | } 4 |

@ViewData["Title"]

5 |

@ViewData["Message"]

6 | 7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P: 11 | 425.555.0100 12 |
13 | 14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com 17 |
18 | -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Contact"; 3 | } 4 |

@ViewData["Title"]

5 |

@ViewData["Message"]

6 | 7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P: 11 | 425.555.0100 12 |
13 | 14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com 17 |
18 | -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Contact"; 3 | } 4 |

@ViewData["Title"]

5 |

@ViewData["Message"]

6 | 7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P: 11 | 425.555.0100 12 |
13 | 14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com 17 |
18 | -------------------------------------------------------------------------------- /examples/BasicConsoleApp/src/AiK8sConsole.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp2.2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/BasicUsage/wwwroot/lib/bootstrap/dist/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /examples/WindowsContainer/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM microsoft/aspnetcore:2.0.3-nanoserver-1709 AS base 2 | WORKDIR /app 3 | EXPOSE 80 443 4 | 5 | FROM microsoft/aspnetcore-build:2.0.3-nanoserver-1709 AS build 6 | WORKDIR /src 7 | COPY AspNetCoreNano.csproj . 8 | COPY NuGet.config . 9 | RUN dotnet restore -nowarn:msb3202,nu1503 10 | COPY . . 11 | RUN dotnet build -c Release -o /app 12 | 13 | FROM build AS publish 14 | RUN dotnet publish -c Release -o /app 15 | 16 | FROM base AS final 17 | WORKDIR /app 18 | 19 | COPY --from=publish /app . 20 | ENTRYPOINT ["dotnet", "AspNetCoreNano.dll"] 21 | -------------------------------------------------------------------------------- /troubleshooting/AIK8sTroubleShooting/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore; 2 | using Microsoft.AspNetCore.Hosting; 3 | 4 | namespace AIK8sTroubleShooting 5 | { 6 | public class Program 7 | { 8 | public static void Main(string[] args) 9 | { 10 | CreateWebHostBuilder(args).Build().Run(); 11 | } 12 | 13 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 14 | WebHost.CreateDefaultBuilder(args) 15 | .UseApplicationInsights() 16 | .UseStartup(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /examples/MultipleIKeys/wwwroot/lib/bootstrap/dist/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /examples/WindowsContainer/wwwroot/lib/bootstrap/dist/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /troubleshooting/AIK8sTroubleShooting/k8s/k8s.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Deployment 3 | metadata: 4 | name: ai-k8s-troubleshooting 5 | spec: 6 | replicas: 1 7 | template: 8 | metadata: 9 | labels: 10 | app: webapp 11 | spec: 12 | containers: 13 | - name: ai-k8s-troubleshooting-container 14 | image: appinsightskubernetes/aik8s_troubleshoot:1.0.1 15 | ports: 16 | - containerPort: 80 17 | env: 18 | - name: APPINSIGHTS_INSTRUMENTATIONKEY 19 | value: Your-Own-Application-Insights-Key 20 | -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/wwwroot/lib/bootstrap/dist/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Interfaces/IKubeHttpClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net.Http; 3 | using System.Net.Http.Headers; 4 | using System.Threading.Tasks; 5 | 6 | namespace Microsoft.ApplicationInsights.Kubernetes 7 | { 8 | internal interface IKubeHttpClient : IDisposable 9 | { 10 | IKubeHttpClientSettingsProvider Settings { get; } 11 | 12 | Task GetStringAsync(Uri requestUri); 13 | 14 | Task SendAsync(HttpRequestMessage request); 15 | 16 | HttpRequestHeaders DefaultRequestHeaders { get; } 17 | } 18 | } -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/wwwroot/lib/bootstrap/dist/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/wwwroot/lib/jquery-validation-unobtrusive/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-validation-unobtrusive", 3 | "homepage": "https://github.com/aspnet/jquery-validation-unobtrusive", 4 | "version": "3.2.9", 5 | "_release": "3.2.9", 6 | "_resolution": { 7 | "type": "version", 8 | "tag": "v3.2.9", 9 | "commit": "a91f5401898e125f10771c5f5f0909d8c4c82396" 10 | }, 11 | "_source": "https://github.com/aspnet/jquery-validation-unobtrusive.git", 12 | "_target": "^3.2.9", 13 | "_originalSource": "jquery-validation-unobtrusive", 14 | "_direct": true 15 | } -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Entities/K8sPod.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes.Entities 2 | { 3 | using System.Collections.Generic; 4 | using Newtonsoft.Json; 5 | 6 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 7 | internal class K8sPod : K8sObject 8 | { 9 | [JsonProperty("metadata")] 10 | public K8sPodMetadata Metadata { get; set; } 11 | 12 | [JsonProperty("status")] 13 | public K8sPodStatus Status { get; set; } 14 | 15 | [JsonProperty("spec")] 16 | public K8sPodSpec Spec { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /troubleshooting/AIK8sTroubleShooting/AIK8sTroubleShooting.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Interfaces/IK8sEnvironment.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes 2 | { 3 | internal interface IK8sEnvironment 4 | { 5 | string ContainerID { get; } 6 | string ContainerName { get; } 7 | string DeploymentUid { get; } 8 | string DeploymentName { get; } 9 | string NodeName { get; } 10 | string NodeUid { get; } 11 | string PodID { get; } 12 | string PodLabels { get; } 13 | string PodName { get; } 14 | string ReplicaSetUid { get; } 15 | string ReplicaSetName { get; } 16 | } 17 | } -------------------------------------------------------------------------------- /dev/F5WebApi/F5WebApi.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.2 5 | InProcess 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/K8sQueryClientFactory.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.ApplicationInsights.Kubernetes.Debugging; 2 | 3 | namespace Microsoft.ApplicationInsights.Kubernetes 4 | { 5 | internal class K8sQueryClientFactory 6 | { 7 | private readonly ApplicationInsightsKubernetesDiagnosticSource _logger = ApplicationInsightsKubernetesDiagnosticSource.Instance; 8 | 9 | public K8sQueryClient Create(IKubeHttpClient httpClient) 10 | { 11 | _logger.LogTrace("Creating {0}", nameof(K8sQueryClient)); 12 | return new K8sQueryClient(httpClient); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /dev/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "Build F5 WebApi", 8 | "command": "dotnet build", 9 | "type": "shell", 10 | "group": "build", 11 | "presentation": { 12 | "reveal": "always" 13 | }, 14 | "options": { 15 | "cwd": "${workspaceFolder}/F5WebApi" 16 | }, 17 | "problemMatcher": "$msCompile" 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Entities/K8sObjectMetadata.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes.Entities 2 | { 3 | using System.Collections.Generic; 4 | using Newtonsoft.Json; 5 | 6 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 7 | 8 | internal class K8sObjectMetadata 9 | { 10 | [JsonProperty("name")] 11 | public string Name { get; set; } 12 | 13 | [JsonProperty("uid")] 14 | public string Uid { get; set; } 15 | 16 | [JsonProperty("labels")] 17 | public IDictionary Labels { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/EntityExtensions/OwnerReferenceExtensions.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Microsoft.ApplicationInsights.Kubernetes 3 | { 4 | using System; 5 | using Microsoft.ApplicationInsights.Kubernetes.Entities; 6 | internal static class OwnerReferenceExtensions 7 | { 8 | public static Type GetKind(this OwnerReference self) 9 | { 10 | switch (self.Kind) 11 | { 12 | case "ReplicaSet": 13 | return typeof(K8sReplicaSet); 14 | default: 15 | return null; 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /solution.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | // Source code for Application Insights for Kubernetes 5 | "name": "Product", 6 | "path": "./src", 7 | }, 8 | { 9 | // Enables F5 to debug the code 10 | "name": "Debugging", 11 | "path": "./dev", 12 | }, 13 | { 14 | // Tests 15 | "name": "Tests", 16 | "path": "./tests", 17 | }, 18 | { 19 | // Examples 20 | "name": "Examples", 21 | "path": "./examples", 22 | }, 23 | ], 24 | "settings": { 25 | "files.exclude": { 26 | "**/.classpath": true, 27 | "**/.project": true, 28 | "**/.settings": true, 29 | "**/.factorypath": true 30 | }, 31 | } 32 | } -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/IK8sQueryClient.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | using Microsoft.ApplicationInsights.Kubernetes.Entities; 4 | 5 | namespace Microsoft.ApplicationInsights.Kubernetes 6 | { 7 | internal interface IK8sQueryClient 8 | { 9 | Task> GetDeploymentsAsync(); 10 | Task GetMyContainerStatusAsync(); 11 | Task GetMyPodAsync(); 12 | Task> GetNodesAsync(); 13 | Task> GetPodsAsync(); 14 | Task> GetReplicasAsync(); 15 | } 16 | } -------------------------------------------------------------------------------- /examples/BasicUsage/wwwroot/lib/jquery/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery", 3 | "main": "dist/jquery.js", 4 | "license": "MIT", 5 | "ignore": [ 6 | "package.json" 7 | ], 8 | "keywords": [ 9 | "jquery", 10 | "javascript", 11 | "browser", 12 | "library" 13 | ], 14 | "homepage": "https://github.com/jquery/jquery-dist", 15 | "version": "2.2.0", 16 | "_release": "2.2.0", 17 | "_resolution": { 18 | "type": "version", 19 | "tag": "2.2.0", 20 | "commit": "6fc01e29bdad0964f62ef56d01297039cdcadbe5" 21 | }, 22 | "_source": "git://github.com/jquery/jquery-dist.git", 23 | "_target": "2.2.0", 24 | "_originalSource": "jquery" 25 | } -------------------------------------------------------------------------------- /examples/MultipleIKeys/wwwroot/lib/jquery/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery", 3 | "main": "dist/jquery.js", 4 | "license": "MIT", 5 | "ignore": [ 6 | "package.json" 7 | ], 8 | "keywords": [ 9 | "jquery", 10 | "javascript", 11 | "browser", 12 | "library" 13 | ], 14 | "homepage": "https://github.com/jquery/jquery-dist", 15 | "version": "2.2.0", 16 | "_release": "2.2.0", 17 | "_resolution": { 18 | "type": "version", 19 | "tag": "2.2.0", 20 | "commit": "6fc01e29bdad0964f62ef56d01297039cdcadbe5" 21 | }, 22 | "_source": "git://github.com/jquery/jquery-dist.git", 23 | "_target": "2.2.0", 24 | "_originalSource": "jquery" 25 | } -------------------------------------------------------------------------------- /examples/WindowsContainer/wwwroot/lib/jquery/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery", 3 | "main": "dist/jquery.js", 4 | "license": "MIT", 5 | "ignore": [ 6 | "package.json" 7 | ], 8 | "keywords": [ 9 | "jquery", 10 | "javascript", 11 | "browser", 12 | "library" 13 | ], 14 | "homepage": "https://github.com/jquery/jquery-dist", 15 | "version": "2.2.0", 16 | "_release": "2.2.0", 17 | "_resolution": { 18 | "type": "version", 19 | "tag": "2.2.0", 20 | "commit": "6fc01e29bdad0964f62ef56d01297039cdcadbe5" 21 | }, 22 | "_source": "git://github.com/jquery/jquery-dist.git", 23 | "_target": "2.2.0", 24 | "_originalSource": "jquery" 25 | } -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/wwwroot/lib/jquery/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery", 3 | "main": "dist/jquery.js", 4 | "license": "MIT", 5 | "ignore": [ 6 | "package.json" 7 | ], 8 | "keywords": [ 9 | "jquery", 10 | "javascript", 11 | "browser", 12 | "library" 13 | ], 14 | "homepage": "https://github.com/jquery/jquery-dist", 15 | "version": "2.2.0", 16 | "_release": "2.2.0", 17 | "_resolution": { 18 | "type": "version", 19 | "tag": "2.2.0", 20 | "commit": "6fc01e29bdad0964f62ef56d01297039cdcadbe5" 21 | }, 22 | "_source": "git://github.com/jquery/jquery-dist.git", 23 | "_target": "2.2.0", 24 | "_originalSource": "jquery" 25 | } -------------------------------------------------------------------------------- /examples/BasicConsoleAppILogger/BasicConsoleAppILogger.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp2.2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) .NET Foundation. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use 4 | these files except in compliance with the License. You may obtain a copy of the 5 | License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software distributed 10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the 12 | specific language governing permissions and limitations under the License. 13 | -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/wwwroot/lib/jquery/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery", 3 | "main": "dist/jquery.js", 4 | "license": "MIT", 5 | "ignore": [ 6 | "package.json" 7 | ], 8 | "keywords": [ 9 | "jquery", 10 | "javascript", 11 | "browser", 12 | "library" 13 | ], 14 | "homepage": "https://github.com/jquery/jquery-dist", 15 | "version": "3.3.1", 16 | "_release": "3.3.1", 17 | "_resolution": { 18 | "type": "version", 19 | "tag": "3.3.1", 20 | "commit": "9e8ec3d10fad04748176144f108d7355662ae75e" 21 | }, 22 | "_source": "https://github.com/jquery/jquery-dist.git", 23 | "_target": "^3.3.1", 24 | "_originalSource": "jquery", 25 | "_direct": true 26 | } -------------------------------------------------------------------------------- /examples/BasicUsage/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace BasicUsage 12 | { 13 | public class Program 14 | { 15 | public static void Main(string[] args) 16 | { 17 | BuildWebHost(args).Run(); 18 | } 19 | 20 | public static IWebHost BuildWebHost(string[] args) => 21 | WebHost.CreateDefaultBuilder(args) 22 | .UseStartup() 23 | .Build(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /examples/BasicUsage/bundleconfig.json: -------------------------------------------------------------------------------- 1 | // Configure bundling and minification for the project. 2 | // More info at https://go.microsoft.com/fwlink/?LinkId=808241 3 | [ 4 | { 5 | "outputFileName": "wwwroot/css/site.min.css", 6 | // An array of relative input file paths. Globbing patterns supported 7 | "inputFiles": [ 8 | "wwwroot/css/site.css" 9 | ] 10 | }, 11 | { 12 | "outputFileName": "wwwroot/js/site.min.js", 13 | "inputFiles": [ 14 | "wwwroot/js/site.js" 15 | ], 16 | // Optionally specify minification options 17 | "minify": { 18 | "enabled": true, 19 | "renameLocals": true 20 | }, 21 | // Optionally generate .map file 22 | "sourceMap": false 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /examples/MultipleIKeys/bundleconfig.json: -------------------------------------------------------------------------------- 1 | // Configure bundling and minification for the project. 2 | // More info at https://go.microsoft.com/fwlink/?LinkId=808241 3 | [ 4 | { 5 | "outputFileName": "wwwroot/css/site.min.css", 6 | // An array of relative input file paths. Globbing patterns supported 7 | "inputFiles": [ 8 | "wwwroot/css/site.css" 9 | ] 10 | }, 11 | { 12 | "outputFileName": "wwwroot/js/site.min.js", 13 | "inputFiles": [ 14 | "wwwroot/js/site.js" 15 | ], 16 | // Optionally specify minification options 17 | "minify": { 18 | "enabled": true, 19 | "renameLocals": true 20 | }, 21 | // Optionally generate .map file 22 | "sourceMap": false 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace app 12 | { 13 | public class Program 14 | { 15 | public static void Main(string[] args) 16 | { 17 | CreateWebHostBuilder(args).Build().Run(); 18 | } 19 | 20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 21 | WebHost.CreateDefaultBuilder(args) 22 | .UseStartup(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /examples/WindowsContainer/bundleconfig.json: -------------------------------------------------------------------------------- 1 | // Configure bundling and minification for the project. 2 | // More info at https://go.microsoft.com/fwlink/?LinkId=808241 3 | [ 4 | { 5 | "outputFileName": "wwwroot/css/site.min.css", 6 | // An array of relative input file paths. Globbing patterns supported 7 | "inputFiles": [ 8 | "wwwroot/css/site.css" 9 | ] 10 | }, 11 | { 12 | "outputFileName": "wwwroot/js/site.min.js", 13 | "inputFiles": [ 14 | "wwwroot/js/site.js" 15 | ], 16 | // Optionally specify minification options 17 | "minify": { 18 | "enabled": true, 19 | "renameLocals": true 20 | }, 21 | // Optionally generate .map file 22 | "sourceMap": false 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/bundleconfig.json: -------------------------------------------------------------------------------- 1 | // Configure bundling and minification for the project. 2 | // More info at https://go.microsoft.com/fwlink/?LinkId=808241 3 | [ 4 | { 5 | "outputFileName": "wwwroot/css/site.min.css", 6 | // An array of relative input file paths. Globbing patterns supported 7 | "inputFiles": [ 8 | "wwwroot/css/site.css" 9 | ] 10 | }, 11 | { 12 | "outputFileName": "wwwroot/js/site.min.js", 13 | "inputFiles": [ 14 | "wwwroot/js/site.js" 15 | ], 16 | // Optionally specify minification options 17 | "minify": { 18 | "enabled": true, 19 | "renameLocals": true 20 | }, 21 | // Optionally generate .map file 22 | "sourceMap": false 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace ZeroUserCodeLightup 12 | { 13 | public class Program 14 | { 15 | public static void Main(string[] args) 16 | { 17 | BuildWebHost(args).Run(); 18 | } 19 | 20 | public static IWebHost BuildWebHost(string[] args) => 21 | WebHost.CreateDefaultBuilder(args) 22 | .UseStartup() 23 | .Build(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Entities/ContainerStatus.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes.Entities 2 | { 3 | using Newtonsoft.Json; 4 | 5 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 6 | internal class ContainerStatus 7 | { 8 | [JsonProperty("name")] 9 | public string Name { get; set; } 10 | 11 | [JsonProperty("image")] 12 | public string Image { get; set; } 13 | 14 | [JsonProperty("imageID")] 15 | public string ImageID { get; set; } 16 | 17 | [JsonProperty("containerID")] 18 | public string ContainerID { get; set; } 19 | 20 | [JsonProperty("ready")] 21 | public bool Ready { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/K8sHttpClient/KubeHttpClientFactory.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.ApplicationInsights.Kubernetes.Debugging; 2 | 3 | namespace Microsoft.ApplicationInsights.Kubernetes 4 | { 5 | internal class KubeHttpClientFactory 6 | { 7 | private readonly ApplicationInsightsKubernetesDiagnosticSource _logger = ApplicationInsightsKubernetesDiagnosticSource.Instance; 8 | 9 | public KubeHttpClientFactory() 10 | { 11 | } 12 | 13 | public IKubeHttpClient Create(IKubeHttpClientSettingsProvider settingsProvider) 14 | { 15 | _logger.LogTrace("Creating {0}", nameof(KubeHttpClient)); 16 | return new KubeHttpClient(settingsProvider); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Extensions/AppInsightsForKubernetesOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | 4 | namespace Microsoft.Extensions.DependencyInjection 5 | { 6 | /// 7 | /// Object model of configuration for Application Insights for Kubernetes. 8 | /// 9 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 10 | public class AppInsightsForKubernetesOptions 11 | { 12 | /// 13 | /// Maximum time to wait for spinning up the container. 14 | /// 15 | /// 16 | [JsonProperty("InitializationTimeout")] 17 | public TimeSpan InitializationTimeout { get; set; } = TimeSpan.FromMinutes(2); 18 | } 19 | } -------------------------------------------------------------------------------- /examples/GenericHost/src/AIK8sGenericHost.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp2.2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Entities/K8sEntityList.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using Newtonsoft.Json; 4 | 5 | namespace Microsoft.ApplicationInsights.Kubernetes.Entities 6 | { 7 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 8 | internal class K8sEntityList : IEnumerable 9 | { 10 | [JsonProperty("items")] 11 | public IEnumerable Items { get; set; } 12 | 13 | public IEnumerator GetEnumerator() 14 | { 15 | return Items.GetEnumerator(); 16 | } 17 | 18 | IEnumerator IEnumerable.GetEnumerator() 19 | { 20 | return Items.GetEnumerator(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/MultipleIKeys/MultipleIKeys.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.0 5 | false 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Extensions/IKubernetesServiceCollectionBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Microsoft.Extensions.DependencyInjection 4 | { 5 | /// 6 | /// Kubernetes service collection builder. 7 | /// 8 | public interface IKubernetesServiceCollectionBuilder 9 | { 10 | /// 11 | /// Injects Application Insights for Kubernetes services into the service collection. 12 | /// 13 | /// The collection of service descriptors. 14 | /// The collection of services descriptors we injected into. 15 | IServiceCollection InjectServices(IServiceCollection serviceCollection); 16 | } 17 | } -------------------------------------------------------------------------------- /tests/UnitTests/StringUtilsTest.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | namespace Microsoft.ApplicationInsights.Kubernetes 3 | { 4 | public class StringUtilsTest 5 | { 6 | [Theory(DisplayName = "Verify proper output of size")] 7 | [InlineData(25, "25B")] 8 | [InlineData(1023, "1023B")] 9 | [InlineData(1024, "1KB")] 10 | [InlineData(1025, "1KB")] 11 | [InlineData(2097152, "2MB")] 12 | [InlineData(3758096384, "3.5GB")] 13 | [InlineData(3848290697216, "3.5TB")] 14 | 15 | public void VerifyServerCertificateShouldVerifyIssuer(long input, string expected) 16 | { 17 | string actual = input.GetReadableSize(); 18 | Assert.Equal(expected, actual); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /examples/MultipleIKeys/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace MultipleIKeys 12 | { 13 | public class Program 14 | { 15 | public static void Main(string[] args) 16 | { 17 | BuildWebHost(args).Run(); 18 | } 19 | 20 | public static IWebHost BuildWebHost(string[] args) => 21 | WebHost.CreateDefaultBuilder(args) 22 | .UseApplicationInsights() 23 | .UseStartup() 24 | .Build(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/Utilities/Arguments.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Microsoft.ApplicationInsights.Kubernetes 3 | { 4 | internal static class Arguments 5 | { 6 | public static T IsNotNull(T subject, string argumentName) 7 | { 8 | if (subject == null) 9 | { 10 | throw new ArgumentNullException(argumentName); 11 | } 12 | return subject; 13 | } 14 | 15 | public static string IsNotNullOrEmpty(string subject, string argumentName) 16 | { 17 | if (string.IsNullOrEmpty(subject)) 18 | { 19 | throw new ArgumentNullException(argumentName); 20 | } 21 | return subject; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /examples/BasicConsoleApp/src/saRole.yaml: -------------------------------------------------------------------------------- 1 | kind: ClusterRole 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | metadata: 4 | # "namespace" omitted since ClusterRoles are not namespaced 5 | name: appinsights-k8s-property-reader 6 | rules: 7 | - apiGroups: ["","extensions"] 8 | resources: ["pods","nodes", "replicasets","deployments"] 9 | verbs: ["get", "watch", "list"] 10 | --- 11 | # actual binding to the role 12 | kind: ClusterRoleBinding 13 | apiVersion: rbac.authorization.k8s.io/v1beta1 14 | metadata: 15 | name: appinsights-k8s-property-reader-binding 16 | subjects: 17 | - kind: ServiceAccount 18 | name: default 19 | namespace: YOUR-NAMESPACE 20 | roleRef: 21 | kind: ClusterRole 22 | name: appinsights-k8s-property-reader 23 | apiGroup: rbac.authorization.k8s.io 24 | 25 | -------------------------------------------------------------------------------- /examples/WindowsContainer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using Microsoft.AspNetCore; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.Extensions.Configuration; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace AspNetCoreNano 12 | { 13 | public class Program 14 | { 15 | public static void Main(string[] args) 16 | { 17 | BuildWebHost(args).Run(); 18 | } 19 | 20 | public static IWebHost BuildWebHost(string[] args) => 21 | WebHost.CreateDefaultBuilder(args) 22 | .UseApplicationInsights() 23 | .UseStartup() 24 | .Build(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/WindowsContainer/k8s/saRole.yaml: -------------------------------------------------------------------------------- 1 | kind: ClusterRole 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | metadata: 4 | # "namespace" omitted since ClusterRoles are not namespaced 5 | name: appinsights-k8s-property-reader 6 | rules: 7 | - apiGroups: ["","extensions"] 8 | resources: ["pods","nodes", "replicasets","deployments"] 9 | verbs: ["get", "watch", "list"] 10 | --- 11 | # actual binding to the role 12 | kind: ClusterRoleBinding 13 | apiVersion: rbac.authorization.k8s.io/v1beta1 14 | metadata: 15 | name: appinsights-k8s-property-reader-binding 16 | subjects: 17 | - kind: ServiceAccount 18 | name: default 19 | namespace: YOUR-NAMESPACE 20 | roleRef: 21 | kind: ClusterRole 22 | name: appinsights-k8s-property-reader 23 | apiGroup: rbac.authorization.k8s.io 24 | 25 | -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/k8s/saRole.yaml: -------------------------------------------------------------------------------- 1 | kind: ClusterRole 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | metadata: 4 | # "namespace" omitted since ClusterRoles are not namespaced 5 | name: appinsights-k8s-property-reader 6 | rules: 7 | - apiGroups: ["","extensions"] 8 | resources: ["pods","nodes", "replicasets","deployments"] 9 | verbs: ["get", "watch", "list"] 10 | --- 11 | # actual binding to the role 12 | kind: ClusterRoleBinding 13 | apiVersion: rbac.authorization.k8s.io/v1beta1 14 | metadata: 15 | name: appinsights-k8s-property-reader-binding 16 | subjects: 17 | - kind: ServiceAccount 18 | name: default 19 | namespace: YOUR-NAMESPACE 20 | roleRef: 21 | kind: ClusterRole 22 | name: appinsights-k8s-property-reader 23 | apiGroup: rbac.authorization.k8s.io 24 | 25 | -------------------------------------------------------------------------------- /examples/ZeroUserCodeLightup/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:52288/", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "ZeroUserCodeLightup": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "environmentVariables": { 22 | "ASPNETCORE_ENVIRONMENT": "Development" 23 | }, 24 | "applicationUrl": "http://localhost:52289/" 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/BasicUsage_clr21_RBAC/app/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:12997", 7 | "sslPort": 44301 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "app": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 22 | "environmentVariables": { 23 | "ASPNETCORE_ENVIRONMENT": "Development" 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/ApplicationInsights.Kubernetes/K8sHttpClient/CertificateVerifier.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.ApplicationInsights.Kubernetes 2 | { 3 | using System; 4 | using System.Security.Cryptography.X509Certificates; 5 | internal class CertificateVerifier : ICertificateVerifier 6 | { 7 | readonly X509Certificate2 _certificate; 8 | public CertificateVerifier(X509Certificate2 certificate) 9 | { 10 | _certificate = Arguments.IsNotNull(certificate, nameof(certificate)); 11 | } 12 | 13 | public X509Certificate2 Certificate => _certificate; 14 | 15 | public string Issuer => _certificate.Issuer; 16 | 17 | public DateTime NotBefore => _certificate.NotBefore; 18 | 19 | public DateTime NotAfter => _certificate.NotAfter; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/UnitTests/KubernetesTestServiceCollectionBuilder.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.ApplicationInsights.Kubernetes.Debugging; 2 | using Microsoft.Extensions.DependencyInjection; 3 | 4 | namespace Microsoft.ApplicationInsights.Kubernetes 5 | { 6 | internal class KubernetesTestServiceCollectionBuilder : KubernetesServiceCollectionBuilder 7 | { 8 | public KubernetesTestServiceCollectionBuilder() : base(() => true) 9 | { 10 | } 11 | 12 | protected override void InjectChangableServices(IServiceCollection serviceCollection) 13 | { 14 | serviceCollection.AddSingleton(); 15 | serviceCollection.AddSingleton(); 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 | 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 | --------------------------------------------------------------------------------