tldr: I'm afraid full framework self hosting won't be supported out of the box for auto instrumentation.
So, what the marked line with
Agent.Setup() do is that they will set everything up for the agent to work - so the agent will know where to send data (which is the url of the APM Server), how to log things and that kind of stuff. But that's it, nothing more. So with that you are good to go, but nothing is captured at that point. Only thing which may happen is that it also sets up metrics collection and it'll start capturing metrics.
But the agent won't capture traces at that point. Trace capturing happens when one of the 2 things happen:
- there is auto instrumentation for the app you use. Typically this would be something like an incoming HTTP request. So once a request comes in, then the agent will capture a trace for it.
- you captured a transaction/span manually with the public agent API. Docs here.
Now, ideally, for a web app we'd do this automatically. We have this for ASP.NET Core (and 5 and 6) and for apps hosted in IIS.. The
Elastic.Apm.AspNetFullFramework contains an IIS module which you can register for IIS based apps (docs here). I think the issue in your case is that this is a self hosted app and that's why nothing happens.
In that case the only thing you can do (other than hosting in IIS) is that you manually capture the traces with the API (docs linked above), but that'll be some manual work.