Comments (7)
This normally means that you are creating multiple instances of the SDK and initializing them.
You are probably not getting them for Page views because a page view is only sent from a specific instance, while the dependency (ajax) requests are indirectly sent because each instance "hooks" the XMLHttpRequest and/or fetch API.
Which means that each "hook" instance monitors that an Ajax request occurred and sends a remote dependency call for each instance. If this is the case I would expect "multiple" calls to track
as each instance is managing it's own batching and sending of the events.
There are 2 ways to work around this
- Make sure you only create and initialize 1 single instance of the SDK for your SPA
- Before "creating" and initializing a new instance you should call
unload()
to cause the previous instance tounhook
itself, just "replacing" any "global" reference like thewindow.appInsights
will still leave the previous instance intact and sending events for the hooked values.
from applicationinsights-js.
Can I assume that your application is a SPA? And that these page views are all occurring on the client side?
In v3.0.3 we change the way we capture the page load "start time" to use the browser's reported metrics, which might be the source of this issue.
@siyuniu-ms can you please check that whether we are applying the timestamp change to ALL page views for a page or only the first one?
I'm labeling as a bug and assigning to the next release, as I suspect this is the case. If we cannot reproduce then I'll adjust the labelling.
from applicationinsights-js.
Your assumption is correct, this is a SPA and all the page views happen on the client side.
Please let me know if I can provide you with more information!
from applicationinsights-js.
I am using @microsoft/[email protected]
Just more info in case it matters to troubleshooting. Seeing many duplicates in AppInsight logs, my app is SPA. Seeing duplicates (groups of 2, 3 or more) with identical timestamp for Dependency and Event - but for some reason I don't get them for Page Views. I don't always get dups, some sessions have em, some don't. I get dups across devices.
from applicationinsights-js.
My duplicates have the same timestamp, id, duration, operation_Id, etc. Every property, in a set of duplicates, seem identical to me.
But I think this is unrelated to issue at hand. I see some duplicates dating all the way back to 2023-08-19, so I have a feeling this a Red herring, sorry about that and I will need to investigate more.
from applicationinsights-js.
I am using @microsoft/[email protected]
Just more info in case it matters to troubleshooting. Seeing many duplicates in AppInsight logs, my app is SPA. Seeing duplicates (groups of 2, 3 or more) with identical timestamp for Dependency and Event - but for some reason I don't get them for Page Views. I don't always get dups, some sessions have em, some don't. I get dups across devices.
Hi, correct me if I understand wrong. For depenency and event traces, those who have the same start time does not have the same ingestion time or duration time.
from applicationinsights-js.
Thanks MSNev, your comments put me on the path. The duplicates happen when/after my PWA updates itself so something with my service worker reloading app and in the process the "old" SDK instance keeps logging events and dependencies. I think my service worker update process just needs to unload() "old/existing" instance before cutting down the tree it's sitting on. I'll nail it down & thanks for your pointers.
from applicationinsights-js.
Related Issues (20)
- Add `customSpan` telemetry type HOT 8
- [Question] App crash with the trace message HOT 1
- [BUG] - CRITICAL - Application runs out of memory HOT 7
- [BUG] Filtering logs with status code 308 does not work HOT 2
- Deprecated feature used when using with jQuery 3.7.1 HOT 8
- [BUG] `ITelemetryItem` uses intersection type instead of union type for `tags` property HOT 4
- [BUG] Network calls aren't visualized correctly between frontend(AI-JS) / backend(Azure Otel Distro) components in Application Map HOT 2
- [BUG] [Web-Snippet] dependency chain issues
- [BUG] Event time is not set HOT 4
- [BUG] @microsoft/applicationinsights-web-snippet version 1.1.1 type problem
- `console.log` unnecessarily noisy HOT 3
- Need to add max retry count for telemetry events to prevent events accumulation in sent buffer
- [Offline Support] offline support plugin can't be added to extensions of core config now, it can only be added through addPlugin
- [main] retry document updates HOT 1
- [BUG] remove 403 as a “retriable” error code
- [BUG] Circular dependencies
- ApplicationInsights-JS latest version 3.1.1 giving TypeError: Cannot read properties of undefined (reading 'getCrypto') HOT 32
- [BUG] Excessive memory usage for SPA where unload hooks keep accumulating HOT 2
- ClickAnalyticsPlugin extension should have html tag configurability HOT 1
- Is there a suggested method for dealing with browsers disallowing third party cookies without disabling cookies altogether? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from applicationinsights-js.