Skip to content

Instantly share code, notes, and snippets.

@sweeney
Forked from videlalvaro/graphite_index.php
Created January 25, 2011 17:12
Show Gist options
  • Save sweeney/795237 to your computer and use it in GitHub Desktop.
Save sweeney/795237 to your computer and use it in GitHub Desktop.
<?php
if($enable_graphite)
{
$fp = @fsockopen('127.0.0.1', 2003, $errno, $errstr, 1);
if($fp)
{
$out = array();
$out[] = sprintf('symfony.%s.%s.%s.memory %s %d%s',
gethostname(),
sfContext::getInstance()->getModuleName(),
sfContext::getInstance()->getActionName(),
memory_get_usage(true),
time(), "\n");
$out[] = sprintf('symfony.%s.%s.%s.requesttime %s %d%s',
gethostname(),
sfContext::getInstance()->getModuleName(),
sfContext::getInstance()->getActionName(),
microtime(true) - $start_request,
time(), "\n");
foreach($out as $o)
{
@fwrite($fp, $o);
}
@fclose($fp);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment