The application aims to improve developer experience while building applications by tracking various facets of the application, such as exceptions, function call frequencies, function execution paths and function execution times. The application provides a visual representation of data that allows the developer to identify possible bottlenecks and points of disruption in the program.
The product that is developed will reduce the time that is spent during Java program development in analysing and optimising the program by enabling rapid identification of bottlenecks. The visibility of favoured paths through the application can also enable developers to quickly figure out possible flaws in program logic causing repetitive processing. The exception statistics will allow developers to quickly figure out buggy pieces of code and fix them before going into production.
The primary functions that the application provides can be described as follows
-
Bytecode Weaving - The application takes a jar file and instruments it with the aspect code. The woven code contains the necessary ability to monitor various aspects of the code that the user wishes to monitor and is integrated with the rest of the monitoring suite.
-
Data Collection - The code modifications collect data regarding the woven application and send the information to the server, which acts as a central repository. This is done while allowing different users to function separately and monitor and access only data that belongs to their own applications.
-
Data Visualization - The collected data is shown in an easily comprehensible manner to the user so that complex runtime data can be easily understood and used to make decisions regarding application design and performance.
The operating environment for the application is listed below:
-
Frameworks - External libraries and dependencies include:
-
AspectJ: ajc, aspectjrt, aspectjtools, aspectjweaver have been used to generate weaved bytecode.
-
Gson: Library to serialize the generated data so that it can be sent to the backend
-
ExpressJS: To create the REST endpoint, which is used by the application to push data to the database and fetch data to the front end.
-
ReactJS: To design the analytics dashboard.
-
Operating System - All code has been written and tested on the Windows Operating System
-
Database - Cloud Firestore (non-relational database) has been used to store the generated data
-
Hardware Platform - Any hardware with the capability to host a ExpressJS server that can handle 2880 requests per day per user. Varies based on the expected audience size
The AspectJ compiler will be used to perform the weaving of the pre-written aspects with the provided JAR file. The AspectJ compiler is capable of instrumenting the code by itself and also provides functionality to call user defined functions at particular “Join Points” in the code. We have leveraged this to gain insights on the execution of the program and send this data to our backend server to store and analyze.
We will be using Firebase as a NoSQL database. A NoSQL database would be suitable for this purpose as data of various structures, such as graph edge structures and function call orders, have to be handled by the database. A cloud-based database also facilitates rapid development, as well-established APIs are available for CRUD operations. It would also be easier to switch in the future to other NoSQL providers in the future if required, as there are no language-specific structures weighing down the application. Deployment on physical servers is also feasible if ever required.
We will be using ReactJS along with Tailwind to develop the front-end application. The component-based facet of React allows us to develop reusable code that can be used throughout the application. We will also use the visualization tools provided by React Google Charts to create graphs and charts to better analyze the data generated by the woven applications. Authentication and login have also been implemented using Firebase.
We will be using NodeJS along with ExpressJS to develop the back-end application. applications: Express.js provides a set of features that make it easy to build web applications using Node.js. It includes a routing system for handling HTTP requests, middleware for handling requests and responses, and templating engines for rendering HTML views. They are used for building RESTful APIs in real-time applications. Express.js provides a set of features that make it easy to create APIs, including support for handling different HTTP methods (GET, POST, PUT, DELETE).
There are 4 primary components in the application which are the web application, an Express server, a non-relational database and the aspect files. These require the following components to interact with each other:
-
The web application will be built using ReactJS and will communicate with the Express server through an API.
-
The Express server will be built using NodeJS and will communicate with the database through the Firebase SDK and will be controlling the AspectJ compiler during the bytecode weaving process.
-
The AJC files will be written in AspectJ and will be compiled using the AspectJ compiler which is on our hosted server.
The communication interfaces are primarily between the React SPA - Express server and the Express server - Firebase server. The communication between the React SPA and the Express server will be through HTTP AJAX requests. The communication between the Express server and the Firebase server will be through the Firebase SDK that uses HTTPS for communication.
Every user who interacts with the system will have the same user interface. The single central interface for interacting with the application will be the web application. This will be a highly visual interface involving a minimal, easy to navigate UI. The interface would be primarily useful to users to view the analytics of their applications. The interface will be designed to be intuitive and easy to use. The interface will be designed to be responsive and work on all devices. The interface will be designed to be compatible with all major browsers.
The interface will primarily be required to display information about the applications that the user has previously uploaded, the functions in those applications and various data collected about those applications. The interface will also be required to display the analytics of the applications in the form of graphs and charts. The primary objective of the interface is to allow users to grasp information about their programs quickly without having to go through the inconvenience of manually sifting through the textual data that is collected.
You can clone the github repo to try your modifications on our application.
The target system is a UNIX machine.
- For bytecode weaving, Java AJC is used. Java version 17 (LTS) is used (https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html).
- Chrome is required to run the Selenium tests. Chrome can be downloaded from (Google Chrome - Download the Fast, Secure Browser from Google)
- Maven is required as a build script. Apache Maven 3.9.1 was used for development. (Maven – Download Apache Maven)
- The backend code is written in Node.js.Version for Node.js v18.5.0 to v18.16.0 is suggested. NodeJS stable LTS version. (Can be installed by following these steps: https://nodejs.org/en/download/)
- We use Visual Studio Code for developing and debugging the backend and frontend(sr/dashboard) code. (src/backend)
- We use IntelliJ for developing and testing the bytecode weaving process of the source code in Java AJC. (
src/analytics/javaM
).
Open a shell in the project directory.
- Run
cd src/backend
to get into the backend directory. - Run
npm i
to install any necessary dependencies.
- Run
cd src/dashboard
to get into the dashboard (frontend) directory. - Run
npm i
to install any necessary dependencies.
- Run
cd src/analytics/javaM
to get into the analytics directory, - Run
mvn compile
to weave the test classes.
- Go to
analytics/javaM/
and runmvn test
to test the weaved test classes.
- Run
npm test --detectOpenHandles --coverage
for backend testing. Head over tosrc/backend/coverage/lcov-report/index.html
to view the code coverage report. - Run
npm start
to run the application on http://localhost:8000
-
To see the selenium test coverage :
i. Run
cd src/__tests__
inside the dashboard directory.ii. Create a Python virtual environment for the tests. Run the command
python3 -m venv tests
to create the virtual environment inside these tests directory.iii. Activate the virtual env by running :
.\tests\Scripts\Activate.ps1
iv. Run
pip install -r requirements.txt
v. To run the tests :
pytest .\auth-testing.py .\security-testing.py .\linkages-testing.py --html=report.html
iv. Run
report.html
to see the frontend coverage report. -
Run
npm run dev
to view the application.
- Run
npm run dev
to run the dashboard application on http://localhost:5173
- Run
npm start
to run the backend application on http://localhost:8000
Note that the following is not intended to be used separate from the application. If you want to weave your own project JAR file, then follow these steps:
- Install AJC compiler - AspectJ 1.9.5/1.9.19 (https://github.com/eclipse-aspectj/aspectj/releases) (https://www.eclipse.org/aspectj/downloads.php)
- Add dependency: aspectjrt.jar (can be found along with AspectJ installation) and gson-20.10.1 (gson - 2.10.1)
- Run the following command to weave your jar file from the command line move to the directory containing the AOPDeps directory in javam (
cd javaM/’src/main/java/org/example/
):ajc -source 1.8 -cp "<path_to_aspectjrt.jar>;<path_to_gson-2.10.4.jar>;" -sourceroots ".\AOPDeps\" -outjar <output_jar_filename> -inpath <path_to_input_jarfile>
- This weaves the jar files with the necessary aspects and classes.
- The developers can now distribute the weaved jar files to their clients.
- At the client side, to run the weaved files, it is necessary to include aspectjrt.jar and gson in the class path along with any dependencies your project may have.
- Command to run the weaved jar files :
java -cp "..\Deps\*;.\aspectjrt.jar;.\gson-2.10.1.jar" softwareEngineering.App
-
Subham Subhasis Sahoo - 2020CSB1317
-
Parth Jain - 2020CSB1106
-
Aman Pankaj Adatia - 2020CSB1154
-
Abhijith T R - 2020CSB1062
-
Pratham Kundan - 2020CSB1114