-
Notifications
You must be signed in to change notification settings - Fork 32
Implementation if no instrumentation key provided #35
Comments
As a reminder, another best practice about using different environments is to use different AppInsights resources (thus, different instrumentation keys), as explained here. (I'll keep this open until we document this practice better and write some tests in the upcoming v3, which supports the new AppInsights SDK) |
@pviotti Is there a recommended way to pass the instrumentation key to the client initialization? As you mentioned, it's good practice to have a different key per environment, so it would need to be passed to dynamically provided in some form or another. |
I did it with
And then pass that variable into the initialise function |
There's no recommended way of storing and retrieving the instrumentation key: it depends on where you decide to store such information. I'd say environment variables are good enough for this. This blog post gives an overview of how to use them in React. |
Hello,
This is more a question than an issue.
We have (as I'm sure others will) the situation where our product will be deployed to various SDLC environments and for some of these environments (e.g. localhost or load testing) we do not wish App Insights to be recorded....or more correctly, we won't assign an instrumentation key (IK) in the environment variables.
What is the best way to handle this? Simply not call the init function if no IK is found? If so, how does that affect withTracking or calls?
Should we have 2 different component exports based on whether we have an IK existing or not?
Any other guidance around best practice for this would be appreciated.
The text was updated successfully, but these errors were encountered: