Skip to content

Commit

Permalink
chore: uses span error API.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcchavezs committed Jul 13, 2020
1 parent dca2ac7 commit 43b2e08
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 13 deletions.
5 changes: 0 additions & 5 deletions src/Zipkin/Instrumentation/Http/Server/DefaultParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,4 @@ public function response(ResponseInterface $response, TraceContext $context, Spa
$span->tag(Tags\ERROR, (string) $response->getStatusCode());
}
}

public function error(Throwable $e, TraceContext $context, SpanCustomizer $span): void
{
$span->tag(Tags\ERROR, $e->getMessage());
}
}
2 changes: 1 addition & 1 deletion src/Zipkin/Instrumentation/Http/Server/Middleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
$this->parser->response($response, $span->getContext(), $spanCustomizer);
return $response;
} catch (Throwable $e) {
$this->parser->error($e, $span->getContext(), $spanCustomizer);
$span->setError($e);
throw $e;
} finally {
$span->finish();
Expand Down
7 changes: 0 additions & 7 deletions src/Zipkin/Instrumentation/Http/Server/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,4 @@ public function request(ServerRequestInterface $request, TraceContext $context,
* payload can be added.
*/
public function response(ResponseInterface $response, TraceContext $context, SpanCustomizer $span): void;

/**
* error parses the exception when doing a HTTP call, usually it is good enough to tag
* the throwable message but depending on the wrapping client, one might want to enrich
* the error with meaningful information from the exception.
*/
public function error(Throwable $e, TraceContext $context, SpanCustomizer $span): void;
}

0 comments on commit 43b2e08

Please sign in to comment.