Dumping aggregated data into a local file

537 views
Skip to first unread message

Thomas Krueger

unread,
May 12, 2014, 2:54:54 PM5/12/14
to getglim...@googlegroups.com
Is it possible to dump the measured (and potentially aggregated) data into a local file on the client (or the server) for later retrieval? 
Related to this: Is there a way to place a button on a custom tab that performs this step?

Thomas

Nik Molnar

unread,
May 13, 2014, 3:05:42 PM5/13/14
to getglim...@googlegroups.com
Hi Thomas,

Both of these are certainly possible!

For the first, take a look at our implementation of IPersistanceStore. We write everything to memory, but you could dump it to a file.

A button on a tab? Sure thing! Look at the network tab in your browser and you'll see requests that look like this: /Glimpse.axd?n=glimpse_request&requestId=5ecd9c51-fdc5-4b4f-8da1-ba10b222dcd3&hash=dacdf3f2&callback=glimpse.data.initData

You can call that URL and get back the data for that request. Drop the callback=foo part to get straight up JSON. There is already a script tag on the page that downloads that data.

If you don't want to make the extra HTTP request, you can call window.glimpse.data.currentData(); in JS to get the data for the current page too. Stringify it and write to a file and you're good to go as well.

Hope this helps!
Nik




--
You received this message because you are subscribed to the Google Groups "GetGlimpse-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to getglimpse-de...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thomas Krueger

unread,
May 14, 2014, 3:34:30 PM5/14/14
to getglim...@googlegroups.com
Thanks Nik!

However, is there already a piece of code where I could see how to do that? I mean, how do I build the layout for this? How can I inject JS code ?

Thomas

Thomas Krueger

unread,
May 17, 2014, 9:04:32 AM5/17/14
to getglim...@googlegroups.com
I just looked at the NLog stuff, but honestly: I'm not so much of a JavaScript guy and I'm having a bit of hard time here. Therefore again the question: How would I place a button that writes the data that is already somewhere in window.glimpse.data.currentData() to a local file? I'm seeing all the data correctly in my glimpse plugin, displayed nicely in my tab. Now I just need the ability to really persist this information.

Thank you very much, Nik!
Thomas

Thomas Krueger

unread,
May 19, 2014, 4:02:34 PM5/19/14
to getglim...@googlegroups.com
OK, after learning JavaScript a bit more and especially jQuery I found a way to incorporate a button feature, that writes me the internal trace data into a server side file. 

Thomas

Nik Molnar

unread,
May 22, 2014, 11:52:41 AM5/22/14
to getglim...@googlegroups.com
Great,

Thanks Thomas!

Nik
Reply all
Reply to author
Forward
0 new messages