hyperf / hyperf

πŸš€ A coroutine framework that focuses on hyperspeed and flexibility. Building microservice or middleware with ease.

Home Page:https://www.hyperf.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[QUESTION] body request and body response in tracer-zipkin

jonaselias198 opened this issue Β· comments

Hi!

I have a question about spans tracer config, is there any specific reason why the body request and body response is not made available as an option in span Zipkin tracer?

'tags' => [
    'request' => [
        'path' => 'request.path',
        'uri' => 'request.uri',
        'method' => 'request.method',
        'header' => 'request.header',
        'data' => 'request.data', // not available 😒
        'body' => 'request.body', // not available 😒
    ],
    'coroutine' => [
        'id' => 'coroutine.id',
    ],
    'response' => [
        'status_code' => 'response.status_code', 
        'body' => 'response.body', // not available 😒
    ],
],

Available options in hyperf/tracer:

protected function buildSpan(ServerRequestInterface $request): Span
{
    $uri = $request->getUri();
    $span = $this->startSpan(sprintf('request: %s %s', $request->getMethod(), $uri->getPath()));
    $span->setTag($this->spanTagManager->get('coroutine', 'id'), (string) Coroutine::id());
    $span->setTag($this->spanTagManager->get('request', 'path'), (string) $uri->getPath());
    $span->setTag($this->spanTagManager->get('request', 'method'), $request->getMethod());
    $span->setTag($this->spanTagManager->get('request', 'uri'), (string) $uri);
    foreach ($request->getHeaders() as $key => $value) {
        $span->setTag($this->spanTagManager->get('request', 'header') . '.' . $key, implode(', ', $value));
    }
    return $span;
}