Skip to content

Commit 2ace1ea

Browse files
committed
feat: sentry error logs
1 parent 5bc3213 commit 2ace1ea

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Span/Exporter/Sentry.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public function export(Span $span): void
5151
$ch = curl_init($this->endpoint);
5252

5353
if ($ch === false) {
54+
error_log('Sentry exporter: Failed to initialize curl');
5455
return;
5556
}
5657

@@ -66,7 +67,18 @@ public function export(Span $span): void
6667
CURLOPT_CONNECTTIMEOUT_MS => 500,
6768
]);
6869

69-
curl_exec($ch);
70+
$result = curl_exec($ch);
71+
72+
if ($result === false) {
73+
error_log('Sentry exporter: ' . curl_error($ch));
74+
} else {
75+
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
76+
if ($statusCode >= 400) {
77+
error_log("Sentry exporter: HTTP {$statusCode} - {$result}");
78+
}
79+
}
80+
81+
curl_close($ch);
7082
}
7183

7284
private function buildEnvelope(Span $span): ?string

0 commit comments

Comments
 (0)