Skip to content

Commit e622c98

Browse files
author
Patrick Leckey
committed
added care exclusions
1 parent 83c47f2 commit e622c98

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Intouch/LaravelNewrelic/Observers/NewrelicTimingObserver.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ public function restoring( $model )
128128
*/
129129
public function created( $model )
130130
{
131+
if ( !in_array( 'created', $this->care ) ) return;
131132
$ms = round( static::$times['create'] + microtime( true ), 3 ) * 1000;
132133
\Newrelic::customMetric( $this->getMetricName( $model, 'created' ), $ms );
133134
}
@@ -139,6 +140,7 @@ public function created( $model )
139140
*/
140141
public function saved( $model )
141142
{
143+
if ( !in_array( 'saved', $this->care ) ) return;
142144
$ms = round( static::$times['save'] + microtime( true ), 3 ) * 1000;
143145
\Newrelic::customMetric( $this->getMetricName( $model, 'saved' ), $ms );
144146
}
@@ -150,6 +152,7 @@ public function saved( $model )
150152
*/
151153
public function deleted( $model )
152154
{
155+
if ( !in_array( 'deleted', $this->care ) ) return;
153156
$ms = round( static::$times['delete'] + microtime( true ), 3 ) * 1000;
154157
\Newrelic::customMetric( $this->getMetricName( $model, 'deleted' ), $ms );
155158
}
@@ -161,6 +164,7 @@ public function deleted( $model )
161164
*/
162165
public function updated( $model )
163166
{
167+
if ( !in_array( 'updated', $this->care ) ) return;
164168
$ms = round( static::$times['update'] + microtime( true ), 3 ) * 1000;
165169
\Newrelic::customMetric( $this->getMetricName( $model, 'updated' ), $ms );
166170
}
@@ -172,6 +176,7 @@ public function updated( $model )
172176
*/
173177
public function restored( $model )
174178
{
179+
if ( !in_array( 'restored', $this->care ) ) return;
175180
$ms = round( static::$times['restore'] + microtime( true ), 3 ) * 1000;
176181
\Newrelic::customMetric( $this->getMetricName( $model, 'restored' ), $ms );
177182
}

0 commit comments

Comments
 (0)