ApinizerMetricsService collects various metrics about API traffic, external connections, cache operations, and JVM status. These metrics are provided in Prometheus format and can be integrated with monitoring systems.
API Traffic Metrics
API requests, success/error rates, response times, and sizes
External Connection Metrics
Requests made to external services, success/error rates, response times
Cache Metrics
Cache operations, success/error rates, response times
JVM Metrics
Memory usage, GC, thread status, processor usage
- General Metric: Total values without labels (e.g., total count of all API requests)
- Tagged Metric: Metrics enriched with labels for detailed analysis (e.g., requests by API ID)
- API Traffic Metrics: API requests, success/error rates, response times, and sizes
- External Connection Metrics: Requests made to external services, success/error rates, response times
- Cache Metrics: Cache operations, success/error rates, response times
- JVM Metrics: Memory usage, GC, thread status, processor usage
- General Metric: Total values without labels (e.g., total count of all API requests)
- Tagged Metric: Metrics enriched with labels for detailed analysis (e.g., requests by API ID)
Prometheus Metric Types
Gateway metrics are collected using Prometheus’s four basic metric types. These types are designed to best represent different data types and behaviors. Each metric type serves different purposes depending on how you collect and analyze the data.Counter (Counter)
Counter (Counter)
Counter is a value that only increases. It starts from zero when the application runs and only resets when the application is restarted. Counter type metrics are ideal for tracking continuously increasing values such as total request count, error count, or completed operation count.Available Operations:
sum: The total value itselfrate: Calculates the rate of increase over time (such as how much it increases per second)increase: Calculates the total increase over a specific time range
Gauge (Indicator)
Gauge (Indicator)
Gauge represents an instantaneous value. This value can increase, decrease, or remain constant. Gauge type metrics are used to monitor an instantaneous state or level such as current memory usage, instantaneous CPU usage, or number of active threads.Available Operations:
sum: Sum of Gauge values grouped by labelsmean: Average of Gauge values grouped by labelsmin/max: Minimum or maximum of values grouped by labels
Timer (Timer)
Timer (Timer)
Timer measures how long an operation takes (usually in milliseconds or seconds). Although not technically a special type in Prometheus, it is a metric created by libraries like Micrometer through a combination of DistributionSummary and Counter. These metrics provide information such as average duration, maximum duration, and percentiles.Available Operations:
sum: Gives the total durationcount: Gives how many times the operation was performed in totalmean: Calculates the average duration of the operationmax: Gives the longest observed durationhistogram_quantile: Calculates percentiles
DistributionSummary (Distribution Summary)
DistributionSummary (Distribution Summary)
DistributionSummary is used to track the distribution of a value. It works similarly to Timer, but instead of measuring time, it measures arbitrary numerical values such as request size, file size. This metric also provides statistical information such as average, maximum, and percentiles.Available Operations:
sum: Gives the total valuecount: Gives the number of observed valuesmean: Calculates the average of valuesmax: Gives the largest observed valuehistogram_quantile: Calculates percentiles
API Traffic Metrics
These metrics are used to monitor and measure the performance of API requests passing through Apinizer. While total request, success, error, and cache hit rates are tracked numerically, request processing duration and data sizes are measured for performance analysis. Some metrics are provided with api_id and api_name tags for detailed API-based examination.
| Metric Name | Description | Type | Labels |
|---|---|---|---|
| apinizer_api_traffic_total_count | Total API traffic requests | Counter | - |
| apinizer_api_traffic_success_count | Successful API requests | Counter | - |
| apinizer_api_traffic_error_count | Failed API requests | Counter | - |
| apinizer_api_traffic_blocked_count | Blocked API requests | Counter | - |
| apinizer_api_traffic_request_pipeline_time | API request pipeline duration (ms) | Timer | - |
| apinizer_api_traffic_routing_time | API routing duration (ms) | Timer | - |
| apinizer_api_traffic_response_pipeline_time | API response pipeline duration (ms) | Timer | - |
| apinizer_api_traffic_total_time | API total duration (ms) | Timer | - |
| apinizer_api_traffic_request_size | API request size (byte) | DistributionSummary | - |
| apinizer_api_traffic_response_size | API response size (byte) | DistributionSummary | - |
| apinizer_api_traffic_cache_hits_count | API cache hit count | Counter | - |
| apinizer_api_traffic_total_count_tagged | Total API traffic requests | Counter | api_id, api_name |
| apinizer_api_traffic_success_count_tagged | Successful API requests | Counter | api_id, api_name |
| apinizer_api_traffic_error_count_tagged | Failed API requests | Counter | api_id, api_name |
| apinizer_api_traffic_blocked_count_tagged | Blocked API requests | Counter | api_id, api_name |
| apinizer_api_traffic_request_pipeline_time_tagged | API request pipeline duration (ms) | Timer | api_id, api_name |
| apinizer_api_traffic_routing_time_tagged | API routing duration (ms) | Timer | api_id, api_name |
| apinizer_api_traffic_response_pipeline_time_tagged | API response pipeline duration (ms) | Timer | api_id, api_name |
| apinizer_api_traffic_total_time_tagged | API total duration (ms) | Timer | api_id, api_name |
| apinizer_api_traffic_request_size_tagged | API request size (byte) | DistributionSummary | api_id, api_name |
| apinizer_api_traffic_response_size_tagged | API response size (byte) | DistributionSummary | api_id, api_name |
| apinizer_api_traffic_cache_hits_count_tagged | API cache hit count | Counter | api_id, api_name |
External Connection Metrics
These metrics are used to monitor external requests made through Apinizer. External service performance is analyzed by measuring total request, error count, and response time. Some metrics are provided with the url tag for detailed URL-based examination.
| Metric Name | Description | Type | Labels |
|---|---|---|---|
| apinizer_external_requests_total_count | Total external request count | Counter | - |
| apinizer_external_errors_total_count | Total external error count | Counter | - |
| apinizer_external_response_time | External response time (ms) | Timer | - |
| apinizer_external_requests_total_count_tagged | Total external request count | Counter | url |
| apinizer_external_errors_total_count_tagged | Total external error count | Counter | url |
| apinizer_external_response_time_tagged | External response time (ms) | Timer | url |
Cache Metrics
These metrics are used to monitor the worker (gateway) pod’s interaction with cache. The worker pod’s cache operations and performance are analyzed by measuring total request, error count, and response time.
| Metric Name | Description | Type | Labels |
|---|---|---|---|
| apinizer_cache_requests_total_count | Total cache request count | Counter | - |
| apinizer_cache_errors_total_count | Total cache error count | Counter | - |
| apinizer_cache_response_time | Cache operation response time (ms) | Timer | - |
JVM Metrics
These metrics are used to monitor JVM performance and resource usage in the worker (gateway) pod. They help analyze system efficiency by providing detailed information about memory, GC (Garbage Collection) activity, and thread status.
| Metric Name | Description | Type | Labels |
|---|---|---|---|
| jvm_buffer_count_buffers | Number of buffers used by JVM | Gauge | - |
| jvm_buffer_memory_used_bytes | Total buffer memory used (byte) | Gauge | - |
| jvm_buffer_total_capacity_bytes | Buffer total capacity (byte) | Gauge | - |
| jvm_gc_live_data_size_bytes | Data size surviving after GC (byte) | Gauge | - |
| jvm_gc_max_data_size_bytes | Maximum data size for GC (byte) | Gauge | - |
| jvm_gc_memory_allocated_bytes_total | Memory allocated by GC (byte) | Counter | - |
| jvm_gc_memory_promoted_bytes_total | Memory promoted by GC (byte) | Counter | - |
| jvm_gc_pause_seconds_count | Total number of GC pauses | Counter | - |
| jvm_gc_pause_seconds_max | Longest GC pause (seconds) | Gauge | - |
| jvm_gc_pause_seconds_sum | Total GC pause duration (seconds) | Gauge | - |
| jvm_memory_committed_bytes | Memory allocated by JVM (byte) | Gauge | - |
| jvm_memory_max_bytes | Maximum memory available to JVM (byte) | Gauge | - |
| jvm_memory_used_bytes | Memory used by JVM (byte) | Gauge | - |
| jvm_threads_daemon_threads | Number of running daemon threads | Gauge | - |
| jvm_threads_live_threads | Number of actively running threads | Gauge | - |
| jvm_threads_peak_threads | Highest thread count reached | Gauge | - |
| jvm_threads_started_threads_total | Total number of threads started | Counter | - |
| jvm_threads_states_threads | Number of different thread states | Gauge | state |
System Metrics
These metrics are used to monitor the worker (gateway) pod’s CPU and system load. Provides information about CPU core count, usage rate, and load average.
| Metric Name | Description | Type | Labels |
|---|---|---|---|
| system_cpu_count | Total CPU core count | Gauge | - |
| system_cpu_usage | System-wide CPU usage rate | Gauge | - |
| system_load_average_1m | System load average for the last 1 minute | Gauge | - |
Process Metrics
These metrics monitor the resource usage of the JVM process running in the worker (gateway) pod. Provides information about CPU usage, open file count, and maximum file limit.
| Metric Name | Description | Type | Labels |
|---|---|---|---|
| process_cpu_usage | JVM’s CPU usage rate | Gauge | - |
| process_files_max_files | Maximum number of files that can be opened | Gauge | - |
| process_files_open_files | Number of open files | Gauge | - |

