File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -84,9 +84,17 @@ public static function trace(?HubInterface $hub = null): \Closure
8484 $ response = $ responseOrException ->getResponse ();
8585 }
8686
87+ $ breadcrumbLevel = Breadcrumb::LEVEL_INFO ;
88+
8789 if ($ response !== null ) {
8890 $ spanAndBreadcrumbData ['http.response.body.size ' ] = $ response ->getBody ()->getSize ();
8991 $ spanAndBreadcrumbData ['http.response.status_code ' ] = $ response ->getStatusCode ();
92+
93+ if ($ response ->getStatusCode () >= 400 && $ response ->getStatusCode () < 500 ) {
94+ $ breadcrumbLevel = Breadcrumb::LEVEL_WARNING ;
95+ } elseif ($ response ->getStatusCode () >= 500 ) {
96+ $ breadcrumbLevel = Breadcrumb::LEVEL_ERROR ;
97+ }
9098 }
9199
92100 if ($ childSpan !== null ) {
@@ -99,7 +107,7 @@ public static function trace(?HubInterface $hub = null): \Closure
99107 }
100108
101109 $ hub ->addBreadcrumb (new Breadcrumb (
102- Breadcrumb:: LEVEL_INFO ,
110+ $ breadcrumbLevel ,
103111 Breadcrumb::TYPE_HTTP ,
104112 'http ' ,
105113 null ,
You can’t perform that action at this time.
0 commit comments