Can Azure Application Insights be used as APM via rest API? - java

Application insights can used to monitor custom application events (such as calls, exceptions, durations etc).
The documentation gives SDKs for .net, and an agent for java. https://learn.microsoft.com/en-us/azure/azure-monitor/app/platforms
We are using java, but its hosting by Adobe (its their cloud CMS called AEM), so we cant run or install any agent. We can include java libraries, and cam make rest calls going out.
The question is, does AI have any sort of rest API to get application monitoring data into AI? Azure as a whole has one (e.g. for querying resource groups) https://learn.microsoft.com/en-us/rest/api/azure/
NOTE: this is not to query AI data, there is a specific API for that, we need an API to write the event and telemetry data into it.

I don't think it is officially published (REST API for ingestion).
At the same time the wire protocol is used by both all SDKs and by many customers who decided to use REST API directly. So, essentially REST API will not change.
One way is to build an app using agent, sniff wire protocol using Fiddler (or similar tool) and then use it as REST API.
Beware that Application Insights SDKs (and agents) take care of many things - starting from auto collection, calculating standard metrics and finishing with proper backoff logic/retries/etc.
On top of it Application Insights SDKs support two channels - Standard and Real-time (Live Metrics/Diagnostics). Implementing the second channel might be quite tricky.

Related

Getting info about external processes in linux using JNA- Ptrace?

I'm on a student research team currently working on a Java project in which we want to be able to gather some info about specific external programs in CentOS 7. Some potential examples of data we might want to gather would be the URL from firefox, or the coordinates from Google Earth. Thus far, looking into how to implement this has mostly led me to using JNA and ptrace.
Is this a good route to take to tackle this problem? And if so, what can I use to find the location of specific information about the programs in memory?
JNA and ptrace are quite low level things. To run system applications you should use:
exec method of Runtime class
Apache Common Exec
Last one is more useful.
But it seems you don't need to run any application at all. To get information from Google Earth you can just use special web API - Google Maps APIs Web Services. If you want to send HTTP request you should try Apache Http Client. It's very powerful library and i'm pretty sure it's all for you need.
PS. More convenient client Java Client for Google Maps Services
PS1. I think java is the worst choice to work with OS and native applications. I see 2 ways to use it:
write agent on C/C++ which will be gather this information for java manager. It's a hard way
use hacks and tricks like here is there a way to get the url from current tab in google-chrome or here Possible to catch URLs in linux?. It's more easy but you will have restricted amount these hacks. And it will work not for all applications and cases.

Pointing Web-Application and Native Application to same database/back-end?

I am creating a web application with a Java back end. I intend to house this on Amazon Web Services.
Ideally, in the future, I would like to create a Native Android application that carries the same functionality as the web app.
How can I implement my current application so that the Native App and Web App can both use the same back end database and services?
I have been reading about Service Orientated Architecture, is this the correct approach?
Service Orientated Architecture (SOA) is an approach that has been around for a while and could certainly meet your requirements. However I would caution you that you are going to run into lots of "Enterprise" designs as you search for information about SOA that will really be overkill for the type of development you are doing.
In general I would simply recommend that you focus on the following:
Keep your UI (HTML/JS/CSS) in a separate project from the Java back end. This practice will force you to keep the UI and back end concerns separate.
Have your back end expose an API that sends and receives JSON via HTTP/HTTPS.
Make your back end services stateless. Using JSON web tokens for authentication is a good way to accomplish this (I like using Auth0 for this). In other words don't rely on an HTTP session to track your users from within your Java code. This has the added benefit of making your application really easy to scale.
If you do these things then when it comes time to build the Android app you wont have to touch the back end at all. You will just have to implement the UI again in native Android.
Since you tagged this question with AWS I assume you plan to implement your back end on AWS. If so, I would highly recommend you look into using Amazon's API Gateway service. This service would sit between your UI layer and your back end. This provides several advantages such as rate limiting and caching to secure your API from DDOS attacks, an optional API key for added security, and API versioning to help you deploy new versions of your API without breaking existing clients. Also, by defining your API using the API Gateway service you can then generate an SDK for your API for use in JavaScript, Android and iOS.
Another big advantage of using API Gateway is that it allows you to break up your back end into separate servers, Lambda functions, etc. This allows for great flexibility, and I can't stress enough how the ability to use AWS Lambda in your back end will reduce administrative work as well as hosting costs. This enables you to start thinking about your back end in terms of Microservices.

Can AWS be used as android back end? Or AWS is used by back end program?

Is it correct that Android application which communicates with external database (somewhere on the server), requires web service (e.g. java web service)?
Is that web service an actual back end application which directly communicate with the DB?
Is this service, I am talking about, the same thing what AWS or google cloud offers, or am I messing it up?
Cloud providers can provide you computers and other hardware to run your back end server on and in some cases can provide you some or all of the services you need in your back end, obviously depending on what your app actually needs to do.
For example, AWS provides identify verification services, streaming recording backend services, notifications etc. You still need to do work to integrate your app with them but they do a lot of the heavy lifting for you.
Deciding whether to use the services or just the HW with your own services built on top is an architectural and business decision really.
You may want to balance ease of integration against vendor lock in (i.e. being tied to a single cloud provider to run your back end).
Personally, I like architectures that can be ported between cloud providers - you can still build on non cloud provider 3rd party service building block software if you want.
Having said that, AWS and Google have almost certainly put a lot of effort and thought into making their service building blocks easy to integrate and scalable so you may find their ecosystems work for you.

Azure Mobile Services with Android

I am very new to both Android development & Azure Mobile Services. I have a decent knowledge of Java so Android development is not proving to be too difficult. Although, I am struggling to gain a good knowledge of working with Azure Mobile Services.
I have little knowledge of REST API's but will be able to learn quite quickly if required. My main concerns/questions are as followed:
Can I build my Android app by using Mobile Services Data & API's alone. i.e the simple table values and the basic CRUD API's?
If not, how should I approach building the application?
I want to cater for multiple column queries, table relationships (1 .. n , inheritance) and I also would like to use JSON objects as parameters for a more lightweight communication rather than passing my full Java objects.
Also, is the possibility of setting up an SSL available?
Any help would be appreciated.
thanks for trying out Azure Mobile Services. Here is a good tutorial on how to get started with Android.
To answer your questions specifically:
Generally a CRUD API for data storage and a custom API for arbitrary REST calls should be all you need for a straightforward app, and those are all offered in the box with Mobile Services. The one thing we don't offer today (but are considering) is support for duplex messaging (WebSocket), which you might need if you are building a realtime app or game.
Mobile Services does not support object trees on the client, but you can still have them in your server database. You just have to write some custom code to "flatten" the hierarchy before you send it to the client.
Every mobile service supports HTTPS by default. We do not currently allow you to do a custom SSL cert.

Android Client and Google App Engine APIs

Am I confused as to what is possible between an Android Client and Google App Engine? I would like to be able to create a Python API that would handle requests between GAE services such as Datastore, and an Android Client.
I have found some examples that detail how to make a call from within an Android Client, but it doesn't seem to outline whether or not you can pass data to any specific API language. The question I have is whether or not it is possible to use a Python API deployed on GAE and making calls through Google End Points, or would I have to use Java Servlets to handle requests?
Yes, you can use Python to do what you want.
Google designs their services (such as GAE and endpoints) to be language agnostic, e.g. using JSON to serialize objects.
There are a few advantages to using Java on both, such as being able to share code between client and service projects, but Google does not promote such dependencies at all - you will have no problem using Python instead.

Categories

Resources