This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

AppOptics .NET Core SDK - Custom Spans Question

First thread! I'm hoping this is the right place for questions like this...

We have a web application written in .NET 4.5.2. We integrated AppOptics and it worked beautifully. We got distinct spans in our traces that follow the request through our .NET code, into the API we're using that also uses AppOptics, and down to the SQL layer. It's provided us with very beneficial information to help us target areas that needed performance boosting.

We're rewriting our application in .NET Core 2.2. We tried integrating AppOptics by following the instructions here (https://docs.appoptics.com/kb/apm_tracing/dotnet/install-core/), but all we got out of the box was one span for IIS activity. No more following the request through the APIs and into the SQL code.

I've tried everything from here (https://docs.appoptics.com/kb/apm_tracing/dotnet/sdk/) to create custom spans, but none of the approaches seem to work. I can see all my requests are making it in to AppOptics, but none of them have any of my custom spans.

Here's a bit of code that tries manually adding entry and exit events, called within an MVC Controller method:

var traceEntryEvent = Trace.CreateEntryEvent("singletondashboard");

traceEntryEvent.AddInfo("Action", "GetDashboard");

traceEntryEvent.AddBackTrace();

traceEntryEvent.Report();

var apiRequest = this.CreateGetRequest();

var dashboard = await this.reportApiService.GetDashboard(apiRequest);

var result = this.Mapper.Map<DashboardGetResponseModel>(dashboard);

var traceExitEvent = Trace.CreateExitEvent("singletondashboard");

traceExitEvent.AddBackTrace();

traceExitEvent.Report();

return await new Response<DashboardGetResponseModel>().ResultAsync(result);

I tried adding these calls to an IActionFilter so they'd be called for every MVC action, that didn't work. I tried adding the Trace attribute to an action, that didn't work

[Trace("Get", Backtrace = true, ReturnValue = true)]

Is this all because .NET Core 2.2 is not a supported version or am I doing something wrong?

  • Hey lordjoe, the code actually looks good, and it should be working as expected. This code should create a custom span that measures how long it takes for this code to complete:

    var apiRequest = this.CreateGetRequest();

    var dashboard = await this.reportApiService.GetDashboard(apiRequest);

    var result = this.Mapper.Map<DashboardGetResponseModel>(dashboard);

    I saw that you have a support ticket about this as well, happy to set up a call and walk through it together. We can post the solution back here to help others.