Skip to content

Are we considering supporting QueueReport? #52

@summerKK

Description

@summerKK

Using a queue can speed up the response time of your site and reduce a lot of risks. For example, if zipkin crashes, it won't affect the site.

It can be supported with very few code changes, I can provide a PR.

The reporter can be obtained through dependency injection.

tracing-laravel/src/Drivers/Zipkin/ZipkinTracer.php

protected function createReporter(): Reporter
{
    if (!$this->reporter) {
        return new HttpReporter([
            'endpoint_url' => sprintf('http://%s:%s/api/v2/spans', $this->host, $this->port),
            'timeout' => $this->requestTimeout,
        ]);
    }

    return $this->reporter;
}
class QueueReporter implements Reporter
{
    public function report(array $spans): void
    {
        if (count($spans) === 0) {
            return;
        }

        $reporterJob = new ReporterJob(
            config('tracing.zipkin.host'),
            config('tracing.zipkin.port'),
            config('tracing.zipkin.options.request_timeout', 1),
            $spans
        );
        dispatch($reporterJob)->onQueue();
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions