Closed Bug 1022679 Opened 8 years ago Closed 1 year ago

Add network analytics


(Firefox for Android Graveyard :: General, defect, P5)




Tracking Status
fennec + ---


(Reporter: snorp, Unassigned, Mentored)



(Whiteboard: [lang=C++] )


(1 obsolete file)

Sometimes we get reports where Fennec causes a ton of network usage, overrunning a users bandwidth allotment. This makes people angry, understandably. We really need to have a way of seeing what was causing all of that. We have about:networking which shows current active connections, but maybe we could extend that to show number of bytes transferred over some period of time (a week? a day?), broken down by page. Not sure of the best way forward here, but we need to have something.
tracking-fennec: --- → ?
↳ user files bug report that Firefox uses 1.4GB of cell data overnight (bug 1022569), and we have nothing to help diagnose the problem
tracking-fennec: ? → +
Whiteboard: [lang=C++] []
Mentor: snorp
Whiteboard: [lang=C++] [] → [lang=C++]
Hi guys, I am willing to work on this... need a little bit of guidance on code structure. I am going through the wiki right now
(In reply to Taha Lukmanji from comment #3)
> Hi guys, I am willing to work on this... need a little bit of guidance on
> code structure. I am going through the wiki right now

This was just a random thought I had for a way to help debug problems like we had in bug 1022569. It may need some more thought before any coding happens. My initial idea was to just record the number of requests per host for the last....24 hours? And then have some about: page that would show that. There may be some privacy concerns...

Patrick, do you have any ideas here? Is there something reasonable we could do for bugs like 1022569 to help our investigation?
Flags: needinfo?(mcmanus)
we can track by appid - but afaik appid is only really useful on b2g, right?

you could pretty trivially track by origin by putting a hash table in nshttpconnectionmgr for it.. make sure to consider private browsing. It would be similar to the existing connectionEntry hash but I wouldn't just add it that structure as those things get cleared out based on certain fairly regular events. (e.g. soon based changing from wifi to cell).

you can piggyback off nsHttpTransaction::SaveNetworkStats() which is currently only doing things for b2g and appid.. but it already has the byte counts you're interested in.

reporting can just be added to about:networking, so you don't need to blaze new ground there.

this won't work at all if its not http or not from necko (i.e. from flash). hopefully you can ignore that.
Flags: needinfo?(mcmanus)
Hi Patrick, dumb question. Is https tracked by nshttptransaction? I havent looked at the code yet.

whats b2g?
it would be safe to assume that we get data from http/s only.
yes nshttptransaction sees https .. (you won't see the overhead bytes, but that is relatively small)

b2g is the original name of firefox os
Sorry guys but I have been a bit busy. Plan is to fix it by the weekend.
Flags: needinfo?(valentin.gosu)
Hi Valentin,

I was tracing back to the email you sent regarding the 4 files to look at. I am confused on how does Dashboard.cpp and AboutNetworking.js work together. Could you provide me some guidelines and as the case description states that it would be nice if we display a day, or week or month of accumulative stats so is there a data repo built inside firefox or fennec as we need to save data

Hi Taha,

Dashboard.cpp (nsIDashboard.idl) provides an interface which AboutNetworking.js uses to display the current state of the networking layer. It displays mostly the instantaneous state of sockets, connections, dns, but there some fields that may be used to get some usage statistics.

Consider the following example:

var dash = Components.classes[';1'].getService(Components.interfaces.nsIDashboard);
function callback(res) {
   console.log("Total received: "+res.received);
   console.log("Total sent: "+res.sent);


This can give you access to the total traffic in bytes sent an received by the browser (the real numbers would be slightly higher, as we don't measure everything). If there's anything I can do to help, please let me know.
Flags: needinfo?(valentin.gosu)
filter on [mass-p5]
Priority: -- → P5
Duplicate of this bug: 1484453
Duplicate of this bug: 1484481
hi there i am an undergrad student in computer science,
i will happy yo help on this issue 
the patch i may suggest will be to create a log file for data
that is transmitted every time you start firefox 
so that one may know what went wrong
or here is a good approach that to send notifications to the user everytime he hits particular data limit 
that would be counted as a feature though 
but still i think creating log file containing how data is transacted will make sure that where and when it was used .
 I am sure the person that installed backdoor and used 1.4 gb overnight isn't listening :P
Attached file Bug 1022679 add network analytics (obsolete) —
i added nothing , for time-being i wasn't able to contact anybody
  regarding this bug over a month!. Its a mentored one as far as i see , there
  is need to change 2-3 files and it will take some time
  i am willing to submit patch for it but i want a mentor who can work
  review and respond in a week !
(In reply to shivambalikondwar from comment #15)
I'm afraid we might not have enough bandwidth right now to shepherd a patch like this right now. I'm flagging Susheel and Valentin, as they might disagree. Generally, though, we're trying to not add new features to Fennec. I could see a generic data usage monitoring tool being useful in Gecko, though.
Flags: needinfo?(valentin.gosu)
Flags: needinfo?(sdaswani)
James has it right - unless Andreas asks us to get this into Fennec, we will probably have to pass on mentoring you.
Flags: needinfo?(sdaswani)
I don't see it being a high priority on Firefox either. :(
Flags: needinfo?(valentin.gosu)
OK , but when i wanted any expertise on network related bugs i didn't find anyone 
I am new here which irc do you people are on ?
(In reply to shivambalikondwar from comment #20)
> OK , but when i wanted any expertise on network related bugs i didn't find
> anyone 
> I am new here which irc do you people are on ?

The network IRC channel is #necko on
Hi, is this issue still open? I am new to open source development and would like to work on this. Where do I begin?
Attachment #9030124 - Attachment is obsolete: true
We have completed our launch of our new Firefox on Android. The development of the new versions use GitHub for issue tracking. If the bug report still reproduces in a current version of [Firefox on Android nightly]( an issue can be reported at the [Fenix GitHub project]( If you want to discuss your report please use [Mozilla's chat]( server and join the [#fenix]( channel.
Closed: 1 year ago
Resolution: --- → INCOMPLETE
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.