You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Other (e.g. Ionic/Cordova, Node, browser, operating system):
browser
How to reproduce these conditions
I have multiple environments: integration, testing, staging, production. AngularFirePerformanceModule doesn't seem to work in anything except for integration. The only difference between these environments is the environment variables, and the only one that I can think of that makes materially differences is the enableProdMode from production: true.
Failing test unit, Stackblitz demonstrating the problem
Steps to set up and reproduce
see above. 1 project, 2 env variables
Sample data and security rules
export const environment = {
production: false
}
vs
export const environment = {
production: true
}
Debug output
** Errors in the JavaScript console **
no console log errors
** Output from firebase.database().enableLogging(true); **
not db related
** Screenshots **
can't show screenshots of working performance for other reasons
Expected behavior
performance logged
Actual behavior
doesn't even show that the sdk is setup. contacted google support and they say they haven't gotten anything from this project (in production)
Using the below code in app.component is registering all the logs in production mode constructor(private perfSvc:AngularFirePerformance) { this.perfSvc.dataCollectionEnabled.then(dcp=>{ console.log('dcp enabled',dcp) }) }
@jonbcampos-alto I think I'm having the same issue as you. My performance monitoring was logging just fine in the Firebase dashboard up until a couple months ago. Now nothing is being sent over. Do we have to include PerformanceMonitoringService as a provider now since v6?
based on the thread it looks like the tree shaking is overly aggressive and
stopping this functionality from working. until there is a fix I think the
only option is to turn prod: false. which I don't recommend.
Yeah, looks like this is the case ae0ef48#diff-473350a8df09472fdfe71659bcae05daR36 the logic with the "default" was broken in that commit. If it's null, which is what an @Optional defaults to, it will disable metrics. I'm testing, will cut an RC with a fix for this and the analytics shortly.
Yeah, I saw that too but I ran into some issues trying to get the full cycle of build lib, yarn in sample project, ng serve in sample project, etc to see the changes. I haven't found any contributor docs that explain how to best do this development cycle for this project. It seems like I need to rm -rf sample/node_modules/;yarn after every time that I run yarn build to build the library.
In the meantime, I tried this workaround, but it didn't work for me. I also tried applying the fix in my node_modules/@angular/fire/ directory directly, but that also did not work for me. I guess that I'll wait for the next canary or release 😄
While I verified that the changes in PR #2595 alone fixed this, I didn't test PR #2597 locally. Now that 6.0.3 is released and I've tested it on a few sites, I can confirm that this is not fixed. I am still not getting Firebase Performance logs sent to the server from any of the apps.
Sorry to confirm that it is NOT fixed. I built a completely new angular app from scratch with v6.0.3 and performance data is only logged when I deploy with: ng build; firebase use my-project; firebase deploy --only hosting
but not with: ng build --prod; firebase use my-project; firebase deploy --only hosting
-----------Update-----------
It turns out that custom metrics work fine.
I think that tree shaking is the issue.
My workaround: use a custom trace somewhere at startup (eg logon), then also the non-custom/built-in traces seem to work fine!
I think that tree shaking is the issue.
My workaround: use a custom trace somewhere at startup (eg logon), then also the non-custom/built-in traces seem to work fine!
Thank you for this information. @jamesdaniels I was able to confirm that this is the case. Just adding a simple start/stop trace in your AppComponent seems to avoid having the PerformanceModule tree shaken and then performance logging seems to start working (I need to wait 24 hours to verify that all of the built-in data appears).
Odd... AngularFirePerformanceModule makes a dummy call to AngularFirePerformance, which should keep it from tree-shaking out & trip the lazy load. Maybe that's getting shaken out since I'm not doing anything with it or the implementation of the promise in AngularFirePerformance requires it to be awaited.
Activity
jamesdaniels commentedon Jun 26, 2020
Perhaps the same as #2505, see my comment on that thread for a possible work around.
vamsiambati commentedon Jun 30, 2020
Using the below code in app.component is registering all the logs in production mode
constructor(private perfSvc:AngularFirePerformance) { this.perfSvc.dataCollectionEnabled.then(dcp=>{ console.log('dcp enabled',dcp) }) }kyleabens commentedon Jul 16, 2020
@jonbcampos-alto I think I'm having the same issue as you. My performance monitoring was logging just fine in the Firebase dashboard up until a couple months ago. Now nothing is being sent over. Do we have to include PerformanceMonitoringService as a provider now since v6?
jonbcampos-alto commentedon Jul 16, 2020
jonbcampos-alto commentedon Sep 22, 2020
tested @madHorse54 's solution. no effect.
Splaktar commentedon Sep 24, 2020
It's possible that this was broken due to lint fixes similar to how 23e2f1e caused #2505.
The related lint fixes for Performance are in ae0ef48. I'm going to take a look and do some debugging there.
jamesdaniels commentedon Sep 25, 2020
Yeah, looks like this is the case ae0ef48#diff-473350a8df09472fdfe71659bcae05daR36 the logic with the "default" was broken in that commit. If it's
null, which is what an@Optionaldefaults to, it will disable metrics. I'm testing, will cut an RC with a fix for this and the analytics shortly.Splaktar commentedon Sep 25, 2020
Yeah, I saw that too but I ran into some issues trying to get the full cycle of build lib, yarn in sample project, ng serve in sample project, etc to see the changes. I haven't found any contributor docs that explain how to best do this development cycle for this project. It seems like I need to
rm -rf sample/node_modules/;yarnafter every time that I runyarn buildto build the library.fix(performance): correct check for disabling performance
Splaktar commentedon Sep 25, 2020
Posted PR #2595 to solve this after I was finally able to verify the fix locally.
Splaktar commentedon Sep 25, 2020
In the meantime, I tried this workaround, but it didn't work for me. I also tried applying the fix in my
node_modules/@angular/fire/directory directly, but that also did not work for me. I guess that I'll wait for the next canary or release 😄jamesdaniels commentedon Sep 25, 2020
Will be fixed in
6.0.3which should be up on NPM shortly.Splaktar commentedon Sep 27, 2020
While I verified that the changes in PR #2595 alone fixed this, I didn't test PR #2597 locally. Now that
6.0.3is released and I've tested it on a few sites, I can confirm that this is not fixed. I am still not getting Firebase Performance logs sent to the server from any of the apps.It looks like maybe this was actually needed?
HerbertBodner commentedon Oct 6, 2020
Sorry to confirm that it is NOT fixed. I built a completely new angular app from scratch with v6.0.3 and performance data is only logged when I deploy with:
ng build; firebase use my-project; firebase deploy --only hostingbut not with:
ng build --prod; firebase use my-project; firebase deploy --only hosting-----------Update-----------
It turns out that custom metrics work fine.
kyleabens commentedon Oct 26, 2020
Any update on this or workarounds for the time being with v6.0.3?
HerbertBodner commentedon Oct 26, 2020
I think that tree shaking is the issue.
My workaround: use a custom trace somewhere at startup (eg logon), then also the non-custom/built-in traces seem to work fine!
Splaktar commentedon Nov 2, 2020
Thank you for this information. @jamesdaniels I was able to confirm that this is the case. Just adding a simple start/stop trace in your
AppComponentseems to avoid having the PerformanceModule tree shaken and then performance logging seems to start working (I need to wait 24 hours to verify that all of the built-in data appears).jamesdaniels commentedon Nov 2, 2020
Odd...
AngularFirePerformanceModulemakes a dummy call toAngularFirePerformance, which should keep it from tree-shaking out & trip the lazy load. Maybe that's getting shaken out since I'm not doing anything with it or the implementation of the promise inAngularFirePerformancerequires it to be awaited.Splaktar commentedon Nov 2, 2020
@jamesdaniels initially I tried in an app to just do
this.angularFirePerformance.trace('app-component-trace')and that got tree shaken.Then I tried
And that seemed to be tree shaken too.
I finally settled on the following to make it start working:
I didn't use
awaitsince it complained that the constructor wasn't anasyncfunction.