Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are we considering supporting QueueReport? #52

Open
summerKK opened this issue Nov 17, 2023 · 2 comments
Open

Are we considering supporting QueueReport? #52

summerKK opened this issue Nov 17, 2023 · 2 comments

Comments

@summerKK
Copy link
Contributor

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();
    }
}
@summerKK
Copy link
Contributor Author

@KinaneD

@KinaneD
Copy link
Member

KinaneD commented Dec 26, 2023

Hey @summerKK could you please provide a use case of an architecture were crash in Zipkin could jeopardise your app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants