Skip to content
This repository has been archived by the owner on Oct 22, 2019. It is now read-only.

Detect if APC is enabled when trying to use APC storage. #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/Prometheus/Storage/APC.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,24 @@
namespace Prometheus\Storage;


use Prometheus\Exception\StorageException;
use Prometheus\MetricFamilySamples;
use RuntimeException;

class APC implements Adapter
{
const PROMETHEUS_PREFIX = 'prom';

/**
* @throws StorageException
*/
public function __construct()
{
if (!ini_get('apc.enabled') || ((php_sapi_name() == 'cli') && !ini_get('apc.enable_cli'))) {
throw new StorageException('APC is not enabled');
}
}

/**
* @return MetricFamilySamples[]
*/
Expand Down