Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaomi7732 committed Jan 18, 2019
2 parents 93d60c5 + 68922e6 commit 0e5b10a
Show file tree
Hide file tree
Showing 14 changed files with 607 additions and 151 deletions.
38 changes: 33 additions & 5 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,44 @@
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"label": "Build Debug",
"command": "${workspaceFolder}/build/Build.cmd",
"type": "shell",
"group": "build",
"problemMatcher": "$msCompile"
},
{
"label": "Build Release",
"command": "${workspaceFolder}/build/Build.cmd",
"type": "shell",
"group": "build",
"args": [
"Release",
],
"problemMatcher": "$msCompile",
},
{
"label": "ReBuild Debug",
"command": "${workspaceFolder}/build/Build.cmd",
"type": "shell",
"group": "build",
"args": [
"build",
"${workspaceFolder}/ApplicationInsights.Kubernetes.sln"
"Debug",
"True",
],
"problemMatcher": "$msCompile"
},
{
"label": "ReBuild Release",
"command": "${workspaceFolder}/build/Build.cmd",
"type": "shell",
"group": "build",
"args": [
"Release",
"True",
],
"problemMatcher": "$msCompile",
},
{
"label": "Run Unit Tests",
"command": "dotnet",
Expand Down
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,42 @@ We support **ASP.NET Core** application as well as **.NET Core** application.

* Follow [this example](examples/BasicUsage_clr21_RBAC) for Role-based access control (RBAC) enabled Kubernetes clusters.

### Configuration Details

Customize configurations are supported for `v1.0.2+`. There are several ways to customize the settings. For example:

1. By the code:
```csharp
services.AddApplicationInsightsKubernetesEnricher(option=> {
option.InitializationTimeout = TimeSpan.FromSeconds(15);
});
```

2. By `appsettings.json`:
```jsonc
{
"Logging": {
// ...
},
// Adding the following section to set the timeout to 15 seconds
"AppInsightsForKubernetes": {
"InitializationTimeout": "00:00:15"
}
}
```
3. By environment varialbe:
```
AppInsightsForKubernetes__InitializationTimeout=3.1:12:15.34
```

All the related configurations have to be put in a section named `AppInsightsForKubernetes`. The supported keys/values are listed below:

| Key | Value/Types | Default Value | Description |
|-----------------------|-------------|---------------|--------------------------------------------------------------------------------------------------------|
| InitializationTimeout | TimeSpan | 00:02:00 | Maximum time to wait for spinning up the container. Accepted format: [d.]hh:mm:ss[.fffffff]. |

The configuration uses with the conventions in ASP.NET Core. Refer [Configuration in ASP.NET Core](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-2.1) for more information.
### Verify the cluster configuration
Use the [troubleshooting image](https://github.com/Microsoft/ApplicationInsights-Kubernetes/tree/develop/troubleshooting) to verify the cluster is properly configured.
Expand Down
5 changes: 4 additions & 1 deletion build/Build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ SETLOCAL
SET CONFIG=%1
SET REBUILD=%2
IF '%CONFIG%' == '' SET CONFIG=Debug
SET REBUILD_PARAM=--no-incremental
IF '%REBUILD%' == '' SET REBUILD_PARAM=


ECHO Target Configuration: %CONFIG%.
FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B
Expand All @@ -13,7 +16,7 @@ FOR /F "TOKENS=1-2 delims=/:" %%a in ("%TIME%") DO SET mytime=%%a%%b
SET CURRENT_DATE_TIME=%yyyy%%mm%%dd%%mytime%
ECHO Version:%CURRENT_DATE_TIME%

dotnet build %~dp0\..\ApplicationInsights.Kubernetes.sln
dotnet build -c %CONFIG% %REBUILD_PARAM% %~dp0\..\ApplicationInsights.Kubernetes.sln

:HELP
GOTO :EXIT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,23 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='netstandard1.3'">
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.2" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='netstandard1.6'">
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="1.1.1" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.2" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.0" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using Newtonsoft.Json;

namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
/// Object model of configuration for Application Insights for Kubernetes.
/// </summary>
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public class AppInsightsForKubernetesOptions
{
/// <summary>
/// Maximum time to wait for spinning up the container.
/// </summary>
/// <value></value>
[JsonProperty("InitializationTimeout")]
public TimeSpan InitializationTimeout { get; set; } = TimeSpan.FromMinutes(2);
}
}
Loading

0 comments on commit 0e5b10a

Please sign in to comment.