Download the PHP package vntrungld/prometheus-exporter-opcache-collector without Composer
On this page you can find all versions of the php package vntrungld/prometheus-exporter-opcache-collector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vntrungld/prometheus-exporter-opcache-collector
More information about vntrungld/prometheus-exporter-opcache-collector
Files in vntrungld/prometheus-exporter-opcache-collector
Package prometheus-exporter-opcache-collector
Short Description OPcache Collector for Prometheus Exporter
License MIT
Homepage https://github.com/vntrungld/prometheus-exporter-opcache-collector
Informations about the package prometheus-exporter-opcache-collector
Prometheus Exporter OPcache Collector
An OPcache metrics collector for Prometheus Exporter in Laravel applications. This package collects OPcache memory usage, cache statistics, interned strings, JIT status, and configuration limits, exposing them in Prometheus format.
Requirements
| Laravel | PHP | Package |
|---|---|---|
| 6.x | 7.2 - 8.0 | 1.x |
| 7.x | 7.2 - 8.0 | 1.x |
| 8.x | 7.3 - 8.1 | 1.x |
| 9.x | 8.0 - 8.2 | 1.x |
| 10.x | 8.1 - 8.3 | 1.x |
| 11.x | 8.2 - 8.4 | 1.x |
| 12.x | 8.2 - 8.4 | 1.x |
Installation
Install via Composer:
The package uses Laravel's auto-discovery, so the service provider will be automatically registered.
Configuration
Add the collector set to your prometheus-exporter configuration file (config/prometheus-exporter.php):
Available Metrics
Up Status
| Metric Name | Type | Description |
|---|---|---|
opcache_up |
Gauge | Whether OPcache is available (1=up, 0=down) |
Memory Usage
| Metric Name | Type | Description |
|---|---|---|
opcache_used_memory_bytes |
Gauge | Used memory in bytes |
opcache_free_memory_bytes |
Gauge | Free memory in bytes |
opcache_wasted_memory_bytes |
Gauge | Wasted memory in bytes |
opcache_wasted_memory_percentage |
Gauge | Wasted memory as percentage |
Cache Statistics
| Metric Name | Type | Description |
|---|---|---|
opcache_cached_scripts |
Gauge | Number of cached scripts |
opcache_hits_total |
Counter | Total cache hits |
opcache_misses_total |
Counter | Total cache misses |
opcache_cached_keys |
Gauge | Number of keys in the hash table |
opcache_max_cached_keys |
Gauge | Maximum slots in the hash table |
opcache_oom_restarts |
Gauge | Out-of-memory restart count |
opcache_hash_restarts |
Gauge | Hash table overflow restart count |
opcache_manual_restarts |
Gauge | Manual restart count |
Interned Strings
| Metric Name | Type | Description |
|---|---|---|
opcache_interned_strings_buffer_bytes |
Gauge | Total buffer size |
opcache_interned_strings_used_bytes |
Gauge | Used buffer memory |
opcache_interned_strings_free_bytes |
Gauge | Free buffer memory |
opcache_interned_strings_count |
Gauge | Number of interned strings |
JIT (PHP 8.0+)
These metrics are only available when JIT is present. They are silently skipped on PHP < 8.0.
| Metric Name | Type | Description |
|---|---|---|
opcache_jit_enabled |
Gauge | Whether JIT is enabled |
opcache_jit_buffer_size_bytes |
Gauge | Total JIT buffer size |
opcache_jit_buffer_used_bytes |
Gauge | Used JIT buffer |
opcache_jit_buffer_free_bytes |
Gauge | Free JIT buffer |
Configuration Limits
These gauges expose OPcache configuration values, useful for computing utilization ratios in PromQL.
| Metric Name | Type | Source |
|---|---|---|
opcache_config_memory_limit_bytes |
Gauge | opcache.memory_consumption |
opcache_config_max_accelerated_files |
Gauge | opcache.max_accelerated_files |
opcache_config_interned_strings_buffer_bytes |
Gauge | opcache.interned_strings_buffer |
opcache_config_jit_buffer_size_bytes |
Gauge | opcache.jit_buffer_size (8.0+) |
Example PromQL Queries
Example Output
OPcache Configuration
For this collector to work, the OPcache extension must be enabled. Ensure your php.ini has:
The collector uses PHP's built-in opcache_get_status() and opcache_get_configuration() functions. When OPcache is not available, the opcache_up metric reports 0 and all other metrics are silently skipped.
Testing
Run the test suite:
Or with PHPUnit directly:
Changelog
Please see the changelog for more information on what has changed recently.
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- vntrungld
- All Contributors
License
MIT. Please see the license file for more information.
All versions of prometheus-exporter-opcache-collector with dependencies
illuminate/support Version ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
vntrungld/prometheus-exporter Version ^1.1