.NET Agent Public API question: user.name?

Greetings All

I have a Desktop Win32 application that I added Elastic APM logging to a few months back, using the Public API of the .NET Agent.

At the time, I added the creation of a Transaction.Labels["username"] to record the actual username of the user who was performing the action that was being traced. However, somebody who's a bit more familiar with actually searching Elastic for details on a regular basis recently suggested to me that this information should really be placed in the "user.name" property.

I'm not finding anything in the Public API docs that shows how to set this property? I'm guessing that it's just not possible to do that using the Public API?

Ah, crap... wouldn't you know it? Five minutes after I ask, I figure it out:

            transaction.Context.User = new User();
            transaction.Context.User.UserName = Environment.UserName;

Oh well, maybe somebody else will find this post via a search and it'll help them out.

1 Like