Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when Connection string configured at runtime #2952

Open
RenancoGitHub opened this issue Mar 8, 2023 · 7 comments
Open

Issue when Connection string configured at runtime #2952

RenancoGitHub opened this issue Mar 8, 2023 · 7 comments
Assignees

Comments

@RenancoGitHub
Copy link

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:

image

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.

image

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:

image

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:

image

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?

@RenancoGitHub
Copy link
Author

RenancoGitHub commented Mar 8, 2023

The following configuration would be very simple to use, but i cant access the client configuration neither enable/disable telemetry client:

image

image

@heyams
Copy link
Contributor

heyams commented Mar 9, 2023

@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
Copy link
Author

@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!

@trask
Copy link
Member

trask commented Mar 9, 2023

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?

@RenancoGitHub
Copy link
Author

RenancoGitHub commented Mar 9, 2023

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!

@trask
Copy link
Member

trask commented Mar 10, 2023

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

@RenancoGitHub
Copy link
Author

RenancoGitHub commented Mar 10, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants