Activities of "carlosfm"

  • ABP Framework version: 7.4.4
  • UI Type: Blazor WASM
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Hello,

I have a problem connecting Application Insights with the app server. I can successfully connect the application and am able to exploit the data and make queries from Application Insights. Currently, in the requests table, I obtain all these data except for the session_Id and user_Id. When debugging the application, I see that the httpcontext of the application's session is null and it cannot assign to telemetry either. This would be the initializer that correctly has the user but within the context, the session is null.

public class CustomTelemetryInitializer : ITelemetryInitializer
{

    private readonly IHttpContextAccessor _httpContextAccessor;
    private readonly ICurrentUser _currentUser;

    public CustomTelemetryInitializer(IHttpContextAccessor httpContextAccessor, ICurrentUser currentUser)
    {
        _currentUser = currentUser;
        _httpContextAccessor = httpContextAccessor;
    }

    public void Initialize(ITelemetry telemetry)
    {
        var httpContext = _httpContextAccessor.HttpContext;
        if (httpContext == null) return;

        if (_currentUser.IsAuthenticated)
        {
            telemetry.Context.User.AuthenticatedUserId = _currentUser.Email;
            telemetry.Context.GlobalProperties["TenantId"] = _currentUser.TenantId.ToString();
        }
    }
}

As information, on the client side, I have the session without problems.

Thanks,

Showing 1 to 1 of 1 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09