[APM] ASP.Net Agent no span data captured in Elasticsearch

If you are asking about a problem you are experiencing, please use the following template, as it will help us help you. If you have a different problem, please delete all of this text :slight_smile:

Kibana version: 7.5.2

Elasticsearch version:7.5.2

APM Server version:7.5

APM Agent language and version: APM .Net Agent, ASP.net

Browser version:Chrome (79.0.3945)

Original install method (e.g. download page, yum, deb, from source, etc.) and version: RPM / YUM

Fresh install or upgraded from other version? Fresh install

Is there anything special in your setup? For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):
We have configured .net agent and enabled asp.net(framework) in the .net application (deployed in IIS). the agent directly send data to ElasticSearch. We can see transations. but there is no span data received by Elasticsearch.


image

APM options in web.config:
add key="ElasticApm:ServerUrls" value="http://172.16.98.224:8200"
add key="ElasticApm:StackTraceLimit" value="-1"
add key="ElasticApm:SpanFramesMinDuration" value="-1ms"
add key="ElasticApm:LogLevel" value="info"

Steps to reproduce:
1.
2.
3.

Errors in browser console (if relevant):

Provide logs and/or server output (if relevant):

Hi @ryan.xu,

I see the transaction name ends with .html - what kind of HTTP request is this? What span do you expect there?

If there is not database call or outgoing HTTP call and you don't capture a span manually, then for a static html you won't see more than the transaction itself.

Hi GregKalapos,

Thank you for you reply! In fact the page is dynamic content and get data from database. the suffix is changed from aspx to html for kind of SEO purpose. I also checked other type of request with no lucky.

regards!
Ryan

Hi Ryan,

What library do you use to communicate to the database?

We have Entity Framework support, here is a doc. about how to turn it on.

We currently work on direct SqlClient support (without Entity Framework) - that's not yet released.

Greg

Hi Greg,

Tried with no lucky, I'm not sure if something with my code, although I switched from 4.5.x .net framework to 4.6.2.
Would the .net agent report spans other than entity framework, as I see from the docs, the picture shows spans like strace trace of .net itself, as well as sql spans.
In my deployment, there's not even 1 record in span index.

Thank you!
Ryan

I switched from 4.5.x .net framework to 4.6.2.

That's good, 4.6.1 is the latest we support, so that was a needed step.

Would the .net agent report spans other than entity framework

For database we currently only support Entity Framework and Entity Framework core - plus there is an effort to support SqlClient as said above.

Could you maybe place the code here from the controller - or at least some part of is, especially the one that calls into the database - If I see it I'll be probably able to tell if there is anything for it.

Hi Greg,

I tried with a brand new project with only 1 web form, to submit data to server and DB, with .net framework 4.6.1 and entityframework. still no span captured.
Configured as guide, included below config item in web.config

<appSettings>
<add key="ElasticApm:ServerUrls" value="http://172.16.98.224:8200" />
<add key="ElasticApm:StackTraceLimit" value="-1" />
</appSettings>
<system.webServer>
<modules>
<add name="ElasticApmModule" type="Elastic.Apm.AspNetFullFramework.ElasticApmModule, Elastic.Apm.AspNetFullFramework" />
</modules>
</system.webServer>

    \<interceptors\>
      \<interceptor type="Elastic.Apm.EntityFramework6.Ef6Interceptor, Elastic.Apm.EntityFramework6" /\>
    \</interceptors\>

there's only one controller, which is homecontroller

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TripStats.Models;
using TripStats.Services;
using System.IO;
using TripStats.Domain;

namespace TripStats.Controllers
{
    public class HomeController : Controller
    {
        public ConfigService configService { get; set; } = new ConfigService();
        public TripInfoService tripInfoService { get; set; } = new TripInfoService();
        public IWordService wordService { get; set; } = new WordService();

        // GET: Home
        [HttpGet]
        public ActionResult Index()
        {
            BindData();
            return View();
        }

        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Index(IndexViewModel model)
        {
            if (ModelState.IsValid)
            {
                TripInfo info = new Domain.TripInfo()
                {
                    CName = model.CName,
                    Number = model.Number,
                    Department = model.Department,
                    FactoryArea = model.FactoryArea,
                    OriginalIDNumber = model.IDNumber,
                    IDNumber = MD5Helper.GetMd5(model.IDNumber),
                    OriginalPhoneNumber = model.PhoneNumber,
                    PhoneNumber = MD5Helper.GetMd5(model.PhoneNumber),
                    HujiProvince = model.HujiProvince,
                    HujiCity = model.HujiCity,
                    ScreenShotFilePath = configService.ImageSavePath + "\\" + $"{model.FactoryArea}-{model.Department}-{model.CName}-{model.Number}-{Path.GetFileName(model.ScreenShot.FileName)}",
                    WordFilePath = configService.WordSavePath + "\\" + $"{model.FactoryArea}-{model.Department}-{model.CName}-{model.Number}-{model.RecordTime.ToString("yyyyMMddHHmmss")}.docx",
                    IsAgree = model.IsAgree,
                    Signature = model.Signature,
                    RecordTime = model.RecordTime,
                };

                if (!string.IsNullOrEmpty(info.ScreenShotFilePath))
                {
                    if (System.IO.File.Exists(info.ScreenShotFilePath))
                    {
                        System.IO.File.Delete(info.ScreenShotFilePath);
                    }
                    if (model.ScreenShot != null)
                    {
                        model.ScreenShot.SaveAs(info.ScreenShotFilePath);
                    }
                }

                tripInfoService.SaveTripInfo(info);
                wordService.SaveWord(info);
                tripInfoService.DeleteScreenShotFile(info);

                return RedirectToAction("Success");
            }
            BindData();
            return View(model);
        }

        public ActionResult Success()
        {
            return View();
        }

        [HttpGet]
        public ActionResult Test()
        {
            return View();
        }

        public void BindData()
        {
            List<SelectListItem> Departments = new List<SelectListItem>();
            Departments.Add(new SelectListItem() { Text = "生产", Value = "生产" });
            Departments.Add(new SelectListItem() { Text = "生产-启询员工", Value = "生产-启询员工" });
            Departments.Add(new SelectListItem() { Text = "质量", Value = "质量" });
            Departments.Add(new SelectListItem() { Text = "供应链", Value = "供应链" });
            Departments.Add(new SelectListItem() { Text = "客户服务", Value = "客户服务" });
            Departments.Add(new SelectListItem() { Text = "EHSS", Value = "EHSS" });
            Departments.Add(new SelectListItem() { Text = "财务", Value = "财务" });
            Departments.Add(new SelectListItem() { Text = "IT", Value = "IT" });
            Departments.Add(new SelectListItem() { Text = "人力资源和行政", Value = "人力资源和行政" });
            Departments.Add(new SelectListItem() { Text = "工程", Value = "工程" });
            Departments.Add(new SelectListItem() { Text = "技术支持及研发", Value = "技术支持及研发" });
            Departments.Add(new SelectListItem() { Text = "卓越运营", Value = "卓越运营" });
            Departments.Add(new SelectListItem() { Text = "总经办", Value = "总经办" });
            ViewData["Departments"] = Departments;
        }
    }
}

Is there anything we missed.

Thank you!
Ryan

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.