/// <summary> /// Enables Application Insights Kubernetes for a given TelemetryConfiguration. /// </summary> /// <param name="telemetryConfiguration">Sets the telemetry configuration to add the telemetry initializer to.</param> /// <param name="applyOptions">Sets a delegate to apply the configuration for the telemetry initializer.</param> /// <param name="kubernetesServiceCollectionBuilder">Sets a service collection builder.</param> /// <param name="detectKubernetes">Sets a delegate to detect if the current application is running in Kubernetes hosted container.</param> public static void AddApplicationInsightsKubernetesEnricher( this TelemetryConfiguration telemetryConfiguration, Action <AppInsightsForKubernetesOptions> applyOptions = null, IKubernetesServiceCollectionBuilder kubernetesServiceCollectionBuilder = null, Func <bool> detectKubernetes = null) { IServiceCollection standaloneServiceCollection = new ServiceCollection(); ConfigureKubernetesTelemetryInitializer(standaloneServiceCollection, detectKubernetes, kubernetesServiceCollectionBuilder, applyOptions); telemetryConfiguration.AddKubernetesTelemetryInitializer(standaloneServiceCollection); }