Repository: dotnet/aspnetcore
File: src/Components/Components/src/ComponentsActivitySource.cs (C#)

Code before:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics;
using Microsoft.AspNetCore.Components.Infrastructure;

namespace Microsoft.AspNetCore.Components;

/// <summary>
/// This is instance scoped per renderer
/// </summary>
internal class ComponentsActivitySource
{
    internal const string Name = "Microsoft.AspNetCore.Components";
    internal const string OnRouteName = $"{Name}.RouteChange";
    internal const string OnEventName = $"{Name}.HandleEvent";

    private static ActivitySource ActivitySource { get; } = new ActivitySource(Name);
    private ComponentsActivityLinkStore? _componentsActivityLinkStore;

    public void Init(ComponentsActivityLinkStore store)
    {
        _componentsActivityLinkStore = store;
    }

    public ComponentsActivityHandle StartRouteActivity(string componentType, string route)
    {
        var activity = ActivitySource.CreateActivity(OnRouteName, ActivityKind.Internal, parentId: null, null, null);
        if (activity is not null)
        {
            var httpActivity = Activity.Current;
            activity.DisplayName = $"Route {route ?? "[unknown path]"} -> {componentType ?? "[unknown component]"}";
            Activity.Current = null; // do not inherit the parent activity
            activity.Start();

            if (activity.IsAllDataRequested)
            {
                if (componentType != null)
                {
                    activity.SetTag("aspnetcore.components.type", componentType);
                }

Review comment (suggestion):
Did we not decide to also change `HandleEvent`? (Just asking, I don't remember 100%)

Code after:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics;
using Microsoft.AspNetCore.Components.Infrastructure;

namespace Microsoft.AspNetCore.Components;

/// <summary>
/// This is instance scoped per renderer
/// </summary>
internal class ComponentsActivitySource
{
    internal const string Name = "Microsoft.AspNetCore.Components";
    internal const string OnRouteName = $"{Name}.Navigate";
    internal const string OnEventName = $"{Name}.HandleEvent";

    private static ActivitySource ActivitySource { get; } = new ActivitySource(Name);
    private ComponentsActivityLinkStore? _componentsActivityLinkStore;

    public void Init(ComponentsActivityLinkStore store)
    {
        _componentsActivityLinkStore = store;
    }

    public ComponentsActivityHandle StartNavigateActivity(string componentType, string route)
    {
        var activity = ActivitySource.CreateActivity(OnRouteName, ActivityKind.Internal, parentId: null, null, null);
        if (activity is not null)
        {
            var httpActivity = Activity.Current;
            activity.DisplayName = $"Route {route ?? "[unknown path]"} -> {componentType ?? "[unknown component]"}";
            Activity.Current = null; // do not inherit the parent activity
            activity.Start();

            if (activity.IsAllDataRequested)
            {
                if (componentType != null)
                {
                    activity.SetTag("aspnetcore.components.type", componentType);
                }