ElasticAPM .NET Framework Help

APM Agent language and version: C# 0.0.2

Original install method (e.g. download page, yum, deb, from source, etc.) and version: Nuget 0.0.2

Fresh install or upgraded from other version? Fresh install

Is there anything special in your setup?

Description of the problem:

Hello, I have been working with the new ElasticAPM Nuget package for .NET Core for the past few weeks and have been adapting it to .NET Framework using Mvc/WebApi filters and the manual approach to using the ElasticAPM package. I was wondering while the original implementation does fill in data for ElasticAPM automatically if it is .NET Core (such as header information, etc.) Is there anyway to do this manually so that there is more information in the APM such as header, url, response, etc.

Hi @mattwein7013,

Welcome on discuss!

Yes, you can fill those through the Public Agent API.

Those things are stored on the Context property. For example, in order to fill the request headers on the currently active transaction, here is what you need to do:

Agent.Tracer.CurrentTransaction.Context.Request = new Request("Get real method...", new Url()
	//fill Url data
	Headers = new Dictionary<string, string>
		//add headers here

It basically works the same if you started the transaction with Agent.Tracer.StartTransaction or Agent.Tracer.CaptureTransaction... just use the Context property of the corresponding object.

I think we pretty much expose already everything though the Agent API in v. 0.0.2 that the agent fills internally. If you run into something that is not there, just let us know.

Btw. we recently merged an IHttpModule implementation to master that does this work automatically. It’s not released yet, but you can see how we do these things in an ASP.NET classic app here - probably very similar to what you do manually. This part fills the request related things and here we fill Context.Response.

Thank you, I noticed this shortly after making this post. I was use to 0.0.1 not having anything really exposed last time I checked so I wasn't sure if there was a way to store the information.

Thank you for the tip on the IHttpModule, I'll take a look at it and take notes.

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