mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.2 KiB
36 lines
1.2 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using Microsoft.ApplicationInsights.Channel;
|
|
using Microsoft.ApplicationInsights.Extensibility;
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
namespace Squidex.Extensions.APM.ApplicationInsights
|
|
{
|
|
public sealed class RoleNameTelemetryInitializer : ITelemetryInitializer
|
|
{
|
|
private readonly string roleName;
|
|
|
|
public RoleNameTelemetryInitializer(IConfiguration configuration)
|
|
{
|
|
roleName = configuration.GetValue<string>("logging:roleName");
|
|
|
|
if (string.IsNullOrWhiteSpace(roleName))
|
|
{
|
|
roleName = "Squidex";
|
|
}
|
|
}
|
|
|
|
public void Initialize(ITelemetry telemetry)
|
|
{
|
|
if (string.IsNullOrEmpty(telemetry.Context.Cloud.RoleName))
|
|
{
|
|
telemetry.Context.Cloud.RoleName = roleName;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|