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

Application Insights not tracking fetch calls #214

Open
vasalis opened this issue May 7, 2021 · 3 comments
Open

Application Insights not tracking fetch calls #214

vasalis opened this issue May 7, 2021 · 3 comments

Comments

@vasalis
Copy link

vasalis commented May 7, 2021

Describe the bug
Enabling application insights does not track fetch requests, even by enabling them on App Insights configuration.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new Teams app with Application Insights enabled. For example a Tab using personal scope.

  2. Change JavaScript snippet to enable tracking of fetch requests, like this:
    { instrumentationKey: "{{APPINSIGHTS_INSTRUMENTATIONKEY}}", disableFetchTracking: false, enableCorsCorrelation: true, distributedTracingMode: 2, });

  3. Create a fetch request, for example:

  4. useEffect(() => { fetch("https://backend", { method: "GET", headers: { Accept: "application/json", "Content-Type": "application/json" } }) .then(response => response.json()) }, []);

  5. The request is not tracked on Application insights.

Expected behavior
The request should be logged on Application Insights as a dependency.

Detailed information

  • Generator version (3.0.3)
  • Build tools version (yoteams-build-core): [eg: 1.0.0]
  • OS: Windows

Additional information
Also, when enabling Application Insights on the generator, I would expect to enable tracking of fetch requests and distributed tracing by default. Moreover, upgrading to the latest version of Application Insights did not solve the issue.

@wictorwilen
Copy link
Member

Thanks for reporting this. Will take a look at this.

@vasalis
Copy link
Author

vasalis commented May 10, 2021

In order to solve the issue I ended up using Application Insights for React https://docs.microsoft.com/en-us/azure/azure-monitor/app/javascript-react-plugin
It was very easy to do and at the same time it provides much more options for integration with App Insights (for example tracking custom events, metrics etc). Maybe this could be the approach for the next version.
Just a thought :)

@wictorwilen
Copy link
Member

@vasalis - very good idea. I personally use the React plugin for many projects, based on yo teams.

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

2 participants