ApplicationInsights-Java
ApplicationInsights-Java copied to clipboard
Issue when Connection string configured at runtime
Hey guys, i have an application in java 11, application insights jar 3.4.8 and pom core-version 3.4.10 and trying this configuration:
The idea is to turn on/off the application insights logging in runtime. When i tested it and set the key false means that i will set an empty key ConnectionString.configure(""); and logs will not sent to application insights. That worked fine. When i change de key set to true with my real connection string, now my requests will send to application insights. That worked aswell.
Ok. But now when i back the configuration false and reconfigure de connection String to an empty string, the logs keep sending to application insights and i get the warning that connection is already set:
Everytime i do a request i create a new telemetry client like this and tried to flush but still cant override the previous connection string configuration:
Looks like i can only change de connection if i rebuild the application every request to changes take effect. Is there another way to implement this idea? Turn on/off the aplication insights injestion while in runtime application?
The following configuration would be very simple to use, but i cant access the client configuration neither enable/disable telemetry client:
@RenancoGitHub we'll fix the following in 3.4.11
Ok. But now when i back the configuration false and reconfigure de connection String to an empty string, the logs keep sending to application insights and i get the warning that connection is already set
.
Additionally, can you elaborate a bit more on why you would need to turn Application Insights Ingestion on/off frequently?
@RenancoGitHub we'll fix the following in 3.4.11
Ok. But now when i back the configuration false and reconfigure de connection String to an empty string, the logs keep sending to application insights and i get the warning that connection is already set
.Additionally, can you elaborate a bit more on why you would need to turn Application Insights Ingestion on/off frequently?
Thank you for the reply! Sure. Basically i need to reduce unnecessary costs. Our applications get millions of requests every month and We will turn off the application insights Ingestion while the application is stable. However we often need to analyze some incidents/errors that are reported. For that, I need to turn on the Application Insights Ingestion frequently without restarting the pods and shutting down the application for a period of time. I will wait for the fix in 3.4.11
Thank you again!
Basically i need to reduce unnecessary costs. Our applications get millions of requests every month and We will turn off the application insights Ingestion while the application is stable. However we often need to analyze some incidents/errors that are reported. For that, I need to turn on the Application Insights Ingestion frequently without restarting the pods and shutting down the application for a period of time.
@RenancoGitHub thanks for the feedback!
would it be better for you if you could set the sampling percentage dynamically? so you could still capture say 1% (or even much less) of transactions all the time, and still benefit from application map and pre-aggregated standard metrics, and then you could ramp up the sampling percentage when needed?
would it be better for you if you could set the sampling percentage dynamically? so you could still capture say 1% (or even much less) of transactions all the time, and still benefit from application map and pre-aggregated standard metrics, and then you could ramp up the sampling percentage when needed?
@trask It would be better, for sure! The problem is that i would need to set the sampling percentage for each endpoint of the application separately and change it whenever i need in runtime. It would be very cool to work with the sampling that way.
Thanks!
The problem is that i would need to set the sampling percentage for each endpoint of the application separately and change it whenever i need in runtime.
I didn't quite follow if this would be more than what you are trying to do already with changing the connection string at runtime? Thx
I didn't quite follow if this would be more than what you are trying to do already with changing the connection string at runtime? Thx
Would not be more, because we built an interface that is mapping each endpoint with a key saved on Redis to turn on/off the connection of the application insights specifically for each endpoint request. That means if a report of an incident appers in a specific endpoint, i dont need to turn on the others to start checking the problem.
Thanks!