Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support keyed service collection #360

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DiagnosticAdapter" Version="3.1.27" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.4" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static void StartApplicationInsightsKubernetesEnricher(this IServiceProvi
/// </summary>
/// <param name="serviceCollection">The service collection.</param>
private static bool KubernetesTelemetryInitializerExists(IServiceCollection serviceCollection)
=> serviceCollection.Any<ServiceDescriptor>(t => t.ImplementationType == typeof(KubernetesTelemetryInitializer));
=> serviceCollection.Any(t => !t.IsKeyedService && t.ImplementationType == typeof(KubernetesTelemetryInitializer));

/// <summary>
/// Configure the KubernetesTelemetryInitializer and its dependencies.
Expand Down
2 changes: 1 addition & 1 deletion src/ApplicationInsights.Kubernetes/K8sInfoBootstrap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal class K8sInfoBootstrap : IK8sInfoBootstrap

private readonly AppInsightsForKubernetesOptions _options;

private readonly object _locker = new object();
private readonly object _locker = new();
private readonly IServiceScopeFactory _serviceScopeFactory;
private bool _hasExecuted = false;
private readonly ExponentialDelaySource _exponentialDelaySource;
Expand Down
Loading