Skip to content
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
3 changes: 2 additions & 1 deletion src/Bss.Platform.Kubernetes/DependencyInjection.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Bss.Platform.Kubernetes.Services;
using Bss.Platform.Kubernetes.Services;

using Microsoft.ApplicationInsights.DependencyCollector;
using Microsoft.ApplicationInsights.Extensibility;
Expand Down Expand Up @@ -36,6 +36,7 @@ public static IServiceCollection AddPlatformKubernetesInsights(this IServiceColl
}

services.AddSingleton<ITelemetryInitializer, TelemetryDataEnrichInitializer>();
services.AddSingleton<ITelemetryInitializer, CloudRoleNameTelemetryInitializer>();

return services
.AddApplicationInsightsTelemetry(configuration)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Microsoft.ApplicationInsights.Channel;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.Extensions.Options;

namespace Bss.Platform.Kubernetes.Services;

internal class CloudRoleNameTelemetryInitializer(IOptions<KubernetesInsightsOptions> options) : ITelemetryInitializer
{
public void Initialize(ITelemetry telemetry)
{
if (string.IsNullOrEmpty(telemetry.Context.Cloud.RoleName))
{
telemetry.Context.Cloud.RoleName = options.Value.RoleName;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System.Reflection;

using Microsoft.ApplicationInsights.AspNetCore.TelemetryInitializers;
using Microsoft.ApplicationInsights.Channel;
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Options;

Expand All @@ -19,10 +16,5 @@ protected override void OnInitializeTelemetry(HttpContext platformContext, Reque
{
telemetry.Context.User.AuthenticatedUserId = username;
}

if (string.IsNullOrEmpty(telemetry.Context.Cloud.RoleName))
{
telemetry.Context.Cloud.RoleName = options.Value.RoleName;
}
}
}
6 changes: 3 additions & 3 deletions src/__SolutionItems/CommonAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
[assembly: AssemblyCompany("Luxoft")]
[assembly: AssemblyCopyright("Copyright © Luxoft 2025")]

[assembly: AssemblyVersion("1.6.0.0")]
[assembly: AssemblyFileVersion("1.6.0.0")]
[assembly: AssemblyInformationalVersion("1.6.0.0")]
[assembly: AssemblyVersion("1.6.1.0")]
[assembly: AssemblyFileVersion("1.6.1.0")]
[assembly: AssemblyInformationalVersion("1.6.1.0")]

#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
Expand Down