<commit_before>﻿namespace DevOpsFlex.Telemetry.Processors
{
    using System;
    using JetBrains.Annotations;
    using Microsoft.ApplicationInsights.Channel;
    using Microsoft.ApplicationInsights.Extensibility;

    /// <summary>
    /// Sets the 'cloud_RoleName' role name attribute on a AI telemetry item
    /// </summary>
    /// <remarks>See https://docs.microsoft.com/en-us/azure/application-insights/app-insights-monitor-multi-role-apps </remarks>
    /// <example>
    /// &lt;TelemetryProcessors&gt;
    /// &lt;!-- Insert this in ApplicationInsights.config --&gt;
    ///     &lt;Add Type="DevOpsFlex.Telemetry.RoleNameSetter, DevOpsFlex.Telemetry"&gt;
    ///         &lt;RoleName>MyApplication&lt;/RoleName&gt;
    ///     &lt;/Add&gt;
    /// &lt;/TelemetryProcessors&gt;
    /// 
    /// // OR 
    /// // alternatively, you can initialize the filter in code. In an initialization class (Global.asax.cs) - insert the processor into the chain:
    /// 
    /// var builder = TelemetryConfiguration.Active.TelemetryProcessorChainBuilder;
    /// builder.Use((next) => new RoleNameSetter(next) { RoleName = "MyApplication" });
    /// builder.Build();
    /// </example>
    public class RoleNameSetter : ITelemetryProcessor
    {
        public static string RoleName { get; set; }

        private ITelemetryProcessor Next { get; }

        public RoleNameSetter([NotNull] ITelemetryProcessor next)
        {
#if DEBUG
            Next = next ?? throw new ArgumentNullException(nameof(next));
#endif
            RoleName = System.Reflection.Assembly.GetEntryAssembly()?.FullName; // this will not resolve for an ASP.NET application.
        }

        public void Process(ITelemetry item)
        {
            if (item?.Context != null)
            {
                if (string.IsNullOrWhiteSpace(item.Context.Cloud.RoleName)) item.Context.Cloud.RoleName = RoleName;
            }

            Next.Process(item);
        }
    }
}<commit_msg>resolve correct name for RoleNameSetter<commit_after>﻿namespace DevOpsFlex.Telemetry.Processors
{
    using System;
    using JetBrains.Annotations;
    using Microsoft.ApplicationInsights.Channel;
    using Microsoft.ApplicationInsights.Extensibility;

    /// <summary>
    /// Sets the 'cloud_RoleName' role name attribute on a AI telemetry item
    /// </summary>
    /// <remarks>See https://docs.microsoft.com/en-us/azure/application-insights/app-insights-monitor-multi-role-apps </remarks>
    /// <example>
    /// &lt;TelemetryProcessors&gt;
    /// &lt;!-- Insert this in ApplicationInsights.config --&gt;
    ///     &lt;Add Type="DevOpsFlex.Telemetry.RoleNameSetter, DevOpsFlex.Telemetry"&gt;
    ///         &lt;RoleName>MyApplication&lt;/RoleName&gt;
    ///     &lt;/Add&gt;
    /// &lt;/TelemetryProcessors&gt;
    /// 
    /// // OR 
    /// // alternatively, you can initialize the filter in code. In an initialization class (Global.asax.cs) - insert the processor into the chain:
    /// 
    /// var builder = TelemetryConfiguration.Active.TelemetryProcessorChainBuilder;
    /// builder.Use((next) => new RoleNameSetter(next) { RoleName = "MyApplication" });
    /// builder.Build();
    /// </example>
    public class RoleNameSetter : ITelemetryProcessor
    {
        public static string RoleName { get; set; }

        private ITelemetryProcessor Next { get; }

        public RoleNameSetter([NotNull] ITelemetryProcessor next)
        {
#if DEBUG
            Next = next ?? throw new ArgumentNullException(nameof(next));
#endif
            RoleName = System.Reflection.Assembly.GetEntryAssembly()?.GetName().Name; // this will not resolve for an ASP.NET application.
        }

        public void Process(ITelemetry item)
        {
            if (item?.Context != null)
            {
                if (string.IsNullOrWhiteSpace(item.Context.Cloud.RoleName)) item.Context.Cloud.RoleName = RoleName;
            }

            Next.Process(item);
        }
    }
}
{'fraction_non_alphanumeric': 0.1287303995953465, 'fraction_numerical': 0.0, 'mean_word_length': 2.469298245614035, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5826834', 'n_tokens_mistral': 1132, 'n_tokens_neox': 1097, 'n_words': 240}