New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimized tag of exception for tracer. #4082
Conversation
@jcchavezs Hi, could you please help me to review this pr? |
@@ -18,7 +18,7 @@ | |||
'redis' => env('TRACER_ENABLE_REDIS', false), | |||
'db' => env('TRACER_ENABLE_DB', false), | |||
'method' => env('TRACER_ENABLE_METHOD', false), | |||
'error' => false, | |||
'exception' => env('TRACER_ENABLE_EXCEPTION', false), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is TRACER_RECORD_EXCEPTION
a more accurate name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think TRACER_RECORD_EXCEPTION
is more appropriate, but in order to be consistent with other environments, it is better to use TRACER_ENABLE_EXCEPTION
.
@@ -60,9 +60,12 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface | |||
}); | |||
try { | |||
$response = $handler->handle($request); | |||
$span->setTag('response.statusCode', $response->getStatusCode()); | |||
$span->setTag('response.status_code', $response->getStatusCode()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
馃憤
if ($exception instanceof HttpException) { | ||
$span->setTag('error.statusCode', $exception->getStatusCode()); | ||
} | ||
$span->setTag('exception.code', $exception->getCode()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we were not using .
as delimiter anymore. Can't we use _
as discussed in #4045 (comment)?
@leocavalcante Hi, could you please help me to review this pr? |
Looks fine for me, personally I will still need to replace the Errored/failed spans should be signaled only by the |
But I think So I set tags about them. |
I prefer them too. Actually, span logs didn't work for my environment (zipkin -> otel collector -> new relic) that is why I added all about the Exception as tags. |
$span->setTag($this->spanTagManager->get('exception', 'class'), get_class($exception)); | ||
$span->setTag($this->spanTagManager->get('exception', 'code'), $exception->getCode()); | ||
$span->setTag($this->spanTagManager->get('exception', 'message'), $exception->getMessage()); | ||
$span->log(['exception' => (string) $exception]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not sure about the log. Could we elaborate more on why it is better to add it as a log?
$span->setTag($this->spanTagManager->get('exception', 'class'), get_class($exception)); | ||
$span->setTag($this->spanTagManager->get('exception', 'code'), $exception->getCode()); | ||
$span->setTag($this->spanTagManager->get('exception', 'message'), $exception->getMessage()); | ||
$span->setTag($this->spanTagManager->get('exception', 'stack_trace'), (string) $exception); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it meet your needs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine! Thanks
No description provided.