Access Data from Azure Application Inside - java

I have created an Azure Function that has the purpose of generating data under certain conditions. During the day, the function is triggered several times and if the condition is met, the data is saved in a database and a project team is informed.
Since it can sometimes happen that no data is generated in a week, the project team should receive a weekly report about the number of Azure Function executions and whether they were successful or not. I have seen in the Azure Portal that the Application Inside stores exactly this data, but I am not yet clear how I can access this data.
What options do I have in Java to retrieve and process the telemetry data?

What options do I have in Java to retrieve and process the telemetry data?
To retrieve the telemetry data and store it for longer time or to process the telemetry data in some specialized way, Continuous Export is ideal for this purpose.
Alternative ways to retrieve or access/process the telemetry data:
In the Log explorer, export button lets you transfer tables and charts to an Excel spreadsheet.
Log Analytics Queries also exports the results of telemetry data.
Power BI used to explore and export your data.
To access your telemetry programmatically, you can use the Data access REST API.
Through PowerShell, you can also access setup continuous export.
Instead of Log Analytics API, you can access it programmatically for retrieve and storing the Telemetry data because the Query API has some query limits.
To access programmatically, the Azure Monitor Query SDK contains idiomatic client libraries for JavaScript, .NET, Python, and Java.
Refer to the Azure Monitor Query Client Library for Java Documentation by Microsoft provides sample code examples to view how to access/process the Telemetry logs programmatically.

Related

Simplest way to store and return data on google app engine

I have created an app to enable users to manually log data for their use of phytosanitary products in their fields.
I would like to store all of this data one the app engine.
I thought of storing it as entities on the google app datastore but then is there a way to gather all that data afterwards and make it downloadable as an XML file for example?
The only data that will be stored each time will be the following:
I am using Vaadin to handle the whole application
AFAIK, you will need to write code to read data you want from Datastore and convert it to the form you need - XML or something else. Then you can trigger above functionality at a specific URL (click of a button) or as a scheduled job that emails you the XML or stores it in a Cloud storage bucket.

Android database and connection to the cloud

I'm developing and Android app which provides content to the user.
I want to store the information of the data in a database on the cloud and locally, and to store the actual content also on the cloud, and access it via the information on the database.
I also want to be able to show the user content based on a date, and to check for that frequently.
I would also like to be able to update the content over the web, and show the user news and updates on the fly.
I'm new to this, and would like to understand this. I read all sorts of terms, but not sure which I need for what. GCM, Content Provider, SyncAdapter, database, AsyncTask, etc..
If someone could please give me an overview of how to do what I want, with an explanation, I would be very grateful.
Thanks!
I want to store the information of the data in a database on the cloud
and locally, and to store the actual content also on the cloud, and
access it via the information on the database.
About this requirement, I recommend you can use Azure Offline Data Sync feature to sync up your local and cloud data. Please refer to this documents:
https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-xamarin-android-get-started-offline-data/
I would also like to be able to update the content over the web, and
show the user news and updates on the fly.
Notification Hub Service is for pushing the message to client and customer, if you want to use the similar feature, please refer to this documents :
https://azure.microsoft.com/en-us/documentation/articles/notification-hubs-push-notification-overview/#integration-with-app-service-mobile-apps

Android Google Drive SDK: Saving to App Folder

For my current project, I would like to allow a user to create a sqlite database file and have them enter some content. Then the user has the option to sign into their google drive account and upload this file. Afterwards, after the user makes further edits, the new database file is uploaded to replace the old file. Finally, if the user has multiple devices, the database should be downloaded from the google drive and replace the existing file stored on the device.
Currently, I have successfully setup Google Drive SDK authentication and I can sign in to the app with my account.
My main question is, how do I upload a sqlite database file to the APP FOLDER when I choose to press a sync button? (This method should be called when the user needs to sync)
Additionally, how do I upload a sqlite database file to the APP FOLDER?
Your question is a bit broad, but I'll try to send you in the right direction.
First you have to decide if to use the REST Api or GDAA. Both will accomplish the same (actually the GDAA's functionality is a bit narrower now, but for your situation will do).
The big difference is that GDAA will handle on-line / off-line states for you, where with the REST Api, you have to implement some kind of non-UI thread (sync service) synchronization. Also, there are latency issues you must be aware when using GDAA.
Next, the process of uploading SQLite database is the same as any other binary data stream.
Grab the 'xxx.db' file, make output stream (or byte[] buffer) and create a GooDrive file with title + mimetype metadata, push the stream into it's content and send it on it's merry way. The only difference between a standard folder and an app folder is the parent of the file.
You get an ID you can subsequently use to download the file to the device. Or you can use search by metadata (title in your case) to get this ID. Again it comes as input stream and you dump it to an 'xxx.db' file on your device.
The second portion of your question deals with multiple devices. None of the apis will notify you about a change in GooDrive, so you must implement one of the 2 strategies:
1/ Polling (ouch), preferably in sync service with sync intervals the system gives you.
2/ GCM message broadcasted to the devices / users who are interested (not trivial, but efficient ... and sexy).
Another pitfall you must be aware when using multiple devices with GDAA is described in SO 29030110 and SO 22874657.
In case you decide to play with the 2 apis, I maintain basic CRUD implementation demos for both the REST and GDAA. The GDAADemo has also an option to work with the app folder.
Good Luck

Access Web Storage or IndexedDB from outside the browser in Android

I want to build an offline browser-based app using HTML and javascript to collect survey data on Android tablets. The app would consist of some static pages with forms for users to enter data, which would then be stored locally using Web Storage or IndexedDB. However, I also want to build a small native Android app which would grab this data and transfer it to other devices. Is this possible, and if so how would I go about it?
Specifically, I want to understand if and how the native app would access the browser's data store (I can manage the rest). I would prefer to use the Android browser but can use any other if that makes it easier. I have found this blog post which suggests that it might be possible but I would appreciate some pointers as to where the data is stored by the Android browser and how easily it can be accessed by another app.
Unfortunately I don't think the data flow can work the way you want it. In the Chromium WebKit implementation, IDB stores data in levelDB files that you should not be able to access (by design).
So how do we get Java and JavaScript to play nice together? That's a great question! As I see it, the only good way to transform Java data into IDB data is via the client-side.
I've got good IDB chops but my Android experience is non-production. From what I understand of it, here's a proposed solution:
collect data via native application views
write a string to a file in your sandbox with the data stored as a JSON blob or in an .html <script> attached to a JavaScript global
load a webview that can access a local URI like file://android_asset/blah.json and then run some IDB code to bulk insert it into IDB
use your IDB store to drive your web-based views
So the answer to "if and how the native app would access the browser's data store" would be: try the opposite. Architect it to let your browser access your native app data store.
Easiest and most robust way to serialise all your records and load into your app when it first run.
It's possible if you're willing to try a slightly different approach:
Pulling data from an HTML5 app is tricky but pushing data to a native app is easier. Your HTML5 app must have a native container. Does the container API include a way to access native ContentProviders? If not, can you add your own native code to the container to do that? Basically, if you can access ContentProviders then your native app need only implement a ContentProvider with insert privileges (which can be restricted to only your HTML5 app). After an insert, the native app can do whatever it wishes with the data, including broadcasting it to to other devices.
If you insist on pulling data from the HTML5 app, this may only be possible if the native and HTML5 app are actually the same app, and that is only possible if your container allows you to add your own native code. Then you will have direct access to the WebView's storage via the WebStorage class.

How to log application usage to website

I'm looking for a method to see how often people use my application and some small usage stats about that usage, e.g. Time Of Day (derived from the message time), duration of usage (program statistic), etc.
The application is written in Java and already connects to the internet, so I know I can send/request information from websites.
My question, is how best to do this? I know I could use Google Analytics and "ping" a specific web page, but ideally I'd like the extra statistics too, can that be done with GA? How do I separate that traffic out of the other GA stats?
Are there existing code snippets I could utilise?
What do I need the server to do? I have hosting with SSH access, MySQL, etc. So can install packages if needed.
Edited to add
This is not a web application, it's a local program that runs on a client machine and connects to the internet to gather data. So there's no web pages that I can insert java code or other scripts into for true web analytics.
This is why I was thinking that I would have to "ping" or "poke" (No idea what the correct terms are) a specific web address, perhaps a PHP page that would record the statistics.
The statistics that I would like to gather are:
IP Address (ONLY to determine the unique visitor and perhaps country of origin)
Time of execution (from the time the statistic was generated)
Number of items processed (program statistic)
Execution duration (program generated statistic)
As the program is usually run by the user an average of once per day, I don't anticipate massive load on the server (famous last words!)
Edited for clarification
The application is a CLI based (no GUI or web browser, web server, or other web application technologies are used). The application runs locally on a user's machine, collects information on various files, downloads information on those files from the internet (yes, using a URL connection), and compiles that information into a database.
I have no view of or access to, the users of the application. I do have a website that I use Google Analytics to see who visits and where from, all the usually stats.
I want to be able to capture a small bunch of stats (explained above) each time the application is run so I know that the application is being used and by how many users and what for.
I had thought I might be able to call a PHP web page with some arguments that could then be added to a database, e.g. http://omertron.com/stats?IP=192.168.2.0|processed=23|duration=270
Or can Google Analytics be used to log that information some how? I can't find much in the documentation about how I would do that.
Check out this list of web analytics software. Lots of free packages there, and once you find one that suits your needs, you'll be able to frame your question specifically to the challenges in using that particular package.
Your options are:
Tagging Systems (like Google Analytics)
Access Log File Analysis
With tagging you create an account with Google Analytics and add some specific JavaScript code you will get from Google, into the relevant places of your code, this allows the browser of your visitors to connect to GA and get captured there.
The Access log file can hold all information about all sessions. There is a lot of detail data generated, so data has to be Extracted, Transformed and Loaded (ETL) to a database. The evaluation can be then performed in nearly real-time. You can create some dashboard application that does the ETL and displays the status of you application.
A third option would be to combine tagging and log file analysis. This will give you more precise results.
Interesting, my thoughts are you would need a framework to accomplish this.
The java application should be able to asynchronously log every event that is happening in the application.
In google analytics you can define names and push events for those specific names. If you would be able to use the following api, I dont think you need to ping a specific web page to use google analytics.
http://download.oracle.com/javase/6/docs/technotes/guides/scripting/programmer_guide/index.html
I have not used this api, hope this helps!

Categories

Resources