Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

what's the reasoning for only setting the "autoCollect" params for just the 1st AppInsightsKey? #17

Open
user1m opened this issue Aug 6, 2017 · 3 comments
Labels

Comments

@user1m
Copy link

user1m commented Aug 6, 2017

@morsh In the code below what's the reasoning for only setting the "autoCollect" params for just the 1st AppInsightsKey?

  private setupInstrumentation() {
    if (this.instrumentationKeys && this.instrumentationKeys.length > 0) {
      //we are setting the automatic updates to the first instumentation key.
      let autoCollectOptions = this.settings && this.settings.autoLogOptions || {};
      ApplicationInsights.setup(this.instrumentationKeys[0])
        .setAutoCollectConsole(autoCollectOptions.autoCollectConsole || false)
        .setAutoCollectExceptions(autoCollectOptions.autoCollectExceptions || false)
        .setAutoCollectRequests(autoCollectOptions.autoCollectRequests || false)
        .setAutoCollectPerformance(autoCollectOptions.autoCollectPerf || false)
        .start();

      //for all other custom events, traces etc, we are initiazling application insight clients accordignly.
      let self = this;
      _.forEach(this.instrumentationKeys, (iKey) => {
        let client = ApplicationInsights.getClient(iKey);
        self.appInsightsClients.push(client);
      });
    }
  }
@morsh
Copy link
Contributor

morsh commented Aug 7, 2017

Hi @user1m - I think this was a quick fix since the code was supposed to support multiple application insights accounts, but wasn't really able to support them (although I might be mistaken).
Also, I think that ApplicationInsights.setup can only run once.

@user1m
Copy link
Author

user1m commented Aug 8, 2017

Ahh ok if ApplicationInsights.setup can only run once is correct then I see.

@morsh morsh added the question label Aug 8, 2017
@morsh
Copy link
Contributor

morsh commented Aug 8, 2017

@user1m - I think so, I havn't had a chance to test multiple AI accounts yet

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

No branches or pull requests

2 participants