Skip to content

People tracking is not compatible with RollbarMiddleware #651

@srmagura

Description

@srmagura

Describe the bug
I would like to use the People Tracking feature of Rollbar with the RollbarMiddleware in ASP.NET Core.

The problem is, there does not seem to be any way to tell the RollbarMiddleware who the current user is.

To Reproduce
N/A

Expected behavior

When using an IRollbar instance directly, I can provide information about the current user like this:

var payloadAdditionOptions = new RollbarPayloadAdditionOptions();

if (_auth.CurrentUser != null)
{
    payloadAdditionOptions.Person = new Person()
    {
        Id = _auth.CurrentUser.Id.Value.ToString(),
        Email = _auth.CurrentUser.Email.Value,
        UserName = _auth.CurrentUser.Name?.ToString(),
    };
}

_rollbar.Config.RollbarPayloadAdditionOptions.Reconfigure(payloadAdditionOptions);

Here, _auth is an "auth context" that provides information about the current user by reading their claims (auth cookie).

I would like to be able to do something similar using RollbarMiddleware.

Rollbar Client - Rollbar.NET Hosting Environment (please complete the following information):

  • Rollbar.NET Host type: ASP.NET Core
  • OS and its version: Windows 11
  • .NET flavor and its version: .NET 8
  • Application framework and its version: ASP.NET Core
  • Rollbar.NET Version: 5.2.0
  • Applicable Rollbar Plug-in (if any):
  • Applicable custom third party logging library/framework integration (if any):
  • Applicable Browser (if any):

Additional context
I know I can copy the RollbarMiddleware source code into my code to fix this, but ideally that would not be necessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions