How to set a custom configuration reader?

In the APM dotnet agent 1.1.2 implementation, attempting to set a custom configuration reader using Agent.Setup() results in the following:

"The singleton APM agent has already been instantiated and can no longer be configured"

The full framework implementation is initialised via the ElasticApmModule Init() method which then then locks the configuration. I'm at a bit of a loss. Please explain how to set a custom configuration reader.

Hi @alex_w - welcome to the forum!

At the moment there are only two ways to configure .NET Agent when monitoring ASP.NET applications (i.e., ElasticApmModule of .NET Agent):

  1. Using Web.config.
  2. Using environment variables (you can find environment variable name in the description of each configuration option).

Will either of these methods work in your use case?

In case the answer to the question above is no and you would like to use a custom source of configuration unfortunately at the moment there's no way to provide custom configuration reader to ElasticApmModule although it can be implemented in the future. I would like to better understand your use case to make sure that custom configuration reader is indeed the best solution for it - what is the actual configuration source for which you would like to provide custom configuration reader?