API Metrics Tracker is a web application that allows you to measure and track various metrics of API endpoints. It provides a web interface to view the metrics and an API endpoint to fetch the metrics in JSON format.
- Measure API endpoint metrics such as request size, response size, response time, timestamp, and energy consumption.
- View metrics in a web interface.
- Fetch metrics via an API endpoint in JSON format.
/metrics- Displays the metrics page./measure- Processes API endpoint form submission and measures API metrics.
/api/metrics- Returns the metrics in JSON format.
-
Clone the repository:
git clone https://github.com/yourusername/apimetrics.git cd apimetrics -
Install dependencies:
go mod tidy
-
Set up the database:
# Assuming you have a PostgreSQL database psql -U yourusername -d yourdatabase -f schema.sql -
Run the application:
go run main.go
-
Open your browser and navigate to
http://localhost:8080/metrics.
- Open the
/metricspage to view the metrics. - Use the
/measureendpoint to submit an API endpoint for measurement. - Use the
/api/metricsendpoint to fetch the metrics in JSON format.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License.