Commit Graph

25 Commits

Author SHA1 Message Date
f06c804c24
Updated response handling and added 404 page
The code changes include an update to the response handling in index.php. Now, it checks if the request URI is '/metrics'. If so, it continues with the previous behavior of executing a script and outputting its result. If not, it loads a new 404 error page using Twig templating engine.

A new file '404.twig' has been added under templates directory which serves as a custom 404 error page. It displays the requested URI and provides a link back to '/metrics'.
2024-06-13 16:03:44 +02:00
b52abb69c7
Updated script execution path
The shell_exec command in index.php has been updated to include the document root in the script path. This change ensures that the correct script is executed regardless of the current working directory.
2024-06-13 14:33:48 +02:00
f367958d69
Introduced .htaccess file and refactored index.php
A new .htaccess file has been added to handle URL rewriting. The index.php file has been significantly refactored for improved readability and performance. A large portion of the original code was moved to a separate script.php file, which is now executed from within index.php. This change simplifies the main entry point of the application and separates concerns more effectively. Additionally, minor changes were made to cache handling in script.php.
2024-06-13 13:41:31 +02:00
aa6d231ead
Add parallel processing for HTTP requests and handle fallback values
- Implement parallel processing using pcntl_fork for HTTP requests
- Handle different types of HTTP data retrieval and response codes
- Set fallback values if necessary based on configuration
2024-06-05 22:13:05 +02:00
8ac31b0092
Update gitignore to exclude config files, refactor index.php for dynamic configuration file loading and caching. 2024-06-05 08:33:29 +02:00
81255d0b27
Update handling of submetric values in index.php
Refactor condition to set submetric value based on fallback.
2024-06-04 19:39:08 +02:00
8d0959b21c
Refactor fallback logic for submetrics
- Updated condition to check maxage existence before comparison.
2024-06-04 16:59:23 +02:00
9707a3cfb9
Add check for empty array before accessing elements.
- Added a condition to check for an empty array before accessing its elements in the getArrayValue function. This prevents potential errors when trying to access values from an empty array.
2024-06-04 16:51:05 +02:00
dcf62d3865
Add metrics_cache.json to gitignore and implement cache fallback logic
The commit adds metrics_cache.json to .gitignore and implements cache fallback logic in index.php for handling metric values.
2024-06-04 16:50:53 +02:00
fd8a67c23c
Refactor conditional logic for response handling
- Adjusted code to handle different scenarios when processing responses.
2024-06-04 13:22:16 +02:00
439d658d14
Refactor error handling for command execution
- Added try-catch block to handle exceptions during command execution.
2024-06-04 13:20:43 +02:00
e004a1002e
Refactor handling of HTTP response data
- Added condition to check status code for response body
- Updated logic for determining presence of response
2024-06-04 07:06:40 +02:00
069e550a3f
Refactor metric retrieval and display
Improved handling of submetrics for better data organization and presentation. Updated metric values based on retrieved data, ensuring accurate representation in the metrics template file.
2024-06-03 23:47:40 +02:00
41f2ddea37
Reorder conditional for CLI check, then URI comparison.
- Reordered the condition to first check for CLI mode before URI comparison.
2024-06-03 23:41:42 +02:00
24f1f6c974
Add content type header for metrics endpoint
Set the Content-Type header to 'text/plain; version=0.0.4' for the '/metrics' endpoint and CLI requests.
2024-06-03 19:48:39 +02:00
6f26907181
Adjust handling of boolean values in metrics output
Ensure boolean values are converted to integers for consistency.
2024-06-03 19:48:39 +02:00
aea6873ed8
Refactor error handling for GuzzleException
- Refactored error handling to check for response in exception.
2024-06-03 19:48:39 +02:00
51ab7bcde6
Refactor HTTP request handling for response status check
- Added try-catch block to handle GuzzleException
- Updated logic to check for response status before processing
2024-06-03 19:48:39 +02:00
201c935330
Refactor HTTP request handling and data extraction
- Improved handling of HTTP requests and extraction of response data.
2024-06-03 19:48:39 +02:00
66933d7d19
Update URI check to include CLI request detection.
The code now checks if the request URI is '/metrics' or if the PHP script is running from the command line interface (CLI). This change allows for proper handling of CLI requests in addition to web requests.
2024-06-03 19:48:39 +02:00
7c61ead8ac
Refactor HTTP handling, update Guzzle requests and Twig config.
- Refactored HTTP handling to use nested arrays for options
- Updated Guzzle requests based on new array structure
- Adjusted Twig cache configuration in the code
2024-06-03 19:48:39 +02:00
638e6d9346
Refactor Guzzle HTTP requests for flexibility and proxy support
Restructured Guzzle HTTP requests to allow for additional options like proxy support, enhancing flexibility in handling different types of requests.
2024-06-03 19:48:39 +02:00
a726fa024c
Add handling for HTTP response time metric using GuzzleHttp. 2024-06-03 19:48:39 +02:00
d0fa8a6a99
Update handling of value assignment when 'jsonelem' is not set.
- Adjusted code to assign $output directly to 'value' if 'jsonelem' is not set.
2024-06-03 19:48:39 +02:00
5d76b42c23
Added the first code 2024-06-03 19:48:39 +02:00