Ability to programmatically control config settings
See original GitHub issueMy environment in aspnetcore is set to staging, but I want to change it to something more specific for Elastic APM. I know that I can control it via environment variables, but I need to set it programmatically based on other settings. It appears that you do not allow just passing a configuration object into UseElasticApm
and force me to pass an IConfiguration
object. Seems like it would be very useful to be able to read settings from IConfiguration
and then be able to additionally change something programmatically before I give it to the UseElasticApm
method and start the instrumentation process.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Modify Remote Config programmatically - Firebase
This document describes how you can programatically read and modify the set of JSON-formatted parameters and conditions known as the Remote ...
Read more >Introducing Control API: provision & configure ...
Control API is a REST API that allows you to manage Ably's configuration programmatically, from your configuration and orchestration tools.
Read more >Programmatically Initializing the Control System Designer
Configure Control System Designer from the command line and create functions to customize the startup of a Control System Designer session.
Read more >How to programmatically configure the settings of a CLion ...
Specifically, the settings (File > Settings) I would like to be able to set via a command or script are: those found under...
Read more >Frequently Asked Questions - Zebra Technologies TechDocs
Using DataWedge APIs to control the scanner - Provides the ability to programmatically control, modify and query the DataWedge configuration settings and ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello guys, I would like to share my experience and how I solved this type of problem, it’s nothing special, but it helped me to configure APM programmatically
First, I created a class with all the APM constants, I really don’t know if the agent already provides something like this.
And I have created an extension method that receives IConfiguration and a dictionary with my settings defined on the fly.
In my Configure method, I call my own extension by passing my list of settings, so I override the IConfiguration and send it to APM, of course, I have to use the properties in ElasticApmConstants as keys in my dictionary.
Just wanna chime in and say that some way to inject a custom IConfigurationProvider (or whatever form it takes in the future) would be a very, very welcome change.
In our scenario, we’re on a long journey from old to new on a distributed system, where we have components that are ASPNET Full Framework, ASPNET Core and Windows Services (both hosted inside an NServicebus process and as separate generic hosts, the “modern way”). Some of the Windows services host ASPNET Core APIs on top of that. So for the Windows Services I need to do manual setup (which is fine), and then duplicate that same configuration into the ASPNETCore config files that are deployed along side it, which cannot be used in any standard way from the service as of now (NServiceBus hosted process, so no
appsettings.json
support out of the box).I would like to use the auto instrumentation where possible (so for example let it hook up to HTTP requests honoring all config etc that is set), but at the same time be able to provide my own configuration implementation once, and only once. As of now, this doesn’t seem possible, since for example
app.UseElasticApm()
doesn’t accept any way to inject the static config, and the PayloadSenderV2 then ends up with a convention based configuration even if you’ve set the config on theAgent
earlier.It claims to be a singleton and stopping subsequent setup-attempts (It even reports
The singleton APM agent has already been instantiated and can no longer be configured. Reusing existing instance.
), which it does, but that doesn’t protect from misconfiguration if AgentComponents are newed up with a separate configuration set inapp.UseElasticApm()
.