← All changes
|
vendor_prefixed/sentry/sentry/src/Metrics/MetricsAggregator.php
+8
-3
1.10.9
→
1.10.21
View file →
| @@ -80,11 +80,16 @@ | ||
| 80 | 80 | $metricTypeClass = self::METRIC_TYPES[$type]; |
| 81 | 81 | /** @var Metric $metric */ |
| 82 | 82 | $metric = new $metricTypeClass($name, $value, $traceId, $spanId, $attributes, \microtime(\true), $unit); |
| 83 | 83 | if ($client !== null) { |
| 84 | - $beforeSendMetric = $client->getOptions()->getBeforeSendMetricCallback(); | |
| 85 | - $metric = $beforeSendMetric($metric); | |
| 86 | - if ($metric === null) { | |
| 84 | + try { | |
| 85 | + $beforeSendMetric = $client->getOptions()->getBeforeSendMetricCallback(); | |
| 86 | + $metric = $beforeSendMetric($metric); | |
| 87 | + if ($metric === null) { | |
| 88 | + return; | |
| 89 | + } | |
| 90 | + } catch (\Throwable $exception) { | |
| 91 | + $client->getOptions()->getLoggerOrNullLogger()->error(\sprintf('The "before_send_metric" callback failed with exception: "%s".', $exception->getMessage())); | |
| 87 | 92 | return; |
| 88 | 93 | } |
| 89 | 94 | } |
| 90 | 95 | $metrics = $this->getStorage($metricFlushThreshold); |