Applicationinsights-js: Will ApplicationInsights-JS support "Request-Id" header for "fetch" method in client's CORS requests?

Created on 25 Jun 2018  路  9Comments  路  Source: microsoft/ApplicationInsights-JS

Currently ApplicationInsights-JS only allow XHR to add correlation headers, which blocked some projects that using "fetch" and want to use AI's correlation feature. Will ApplicationInsights-JS support fetch in the future? ( #166 seems mentioned the same issue)

*attach CORS and correlation headers config used in this issue:
{
disableCorrelationHeaders: false,
enableCorsCorrelation: true
}

image

enhancement

Most helpful comment

I will. I needed it yesterday hence a separate project.

All 9 comments

We have a new iteration of the sdk under works currently which will have the ability to use fetch for sending data as well.

595

wow, wonderful news, looking forward to new iteration.

@yuejiaozhs judging by the answer it's planned to use fetch to send data. Not monitor fetch calls. Anyhow, while you're waiting
https://github.com/MaximBalaganskiy/application-insights-fetch-monitor

Do you want to send PR into this repo?

I will. I needed it yesterday hence a separate project.

Great

I'm using @microsoft/[email protected] which seems to add the request-id for OPTIONS requests but not for the actual requests themselves.
This is my config:

config: {
    instrumentationKey: "--key--",
    disableFetchTracking: false,
    enableCorsCorrelation: true
}

Hey @FelschR, it should be adding request-id to the list of Access-Control-Request-Headers in the OPTIONS call, and then fills in the request-id for the actual fetch. Is this different from what you are seeing?

The OPTONS call
image

The fetch
image

Was this page helpful?
0 / 5 - 0 ratings