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

Elasticsearch support #672

Open
nklmilojevic opened this issue Mar 28, 2023 · 6 comments
Open

Elasticsearch support #672

nklmilojevic opened this issue Mar 28, 2023 · 6 comments

Comments

@nklmilojevic
Copy link

Hi!

We are in the process of switching from Datadog to Sentry fully (paid) and one thing I noticed is that there is no Elasticsearch traces. Is that something that is planned to support?

Thanks!

@antonpirker
Copy link
Member

Hey @nklmilojevic !

Cool thing you want to use Sentry more. Currently there is no ElasticSearch support in PHP, you are right.
As far as I know there is no ES support planned for now, but if enough people upvote this issue and we see that there is demand, we will put in on our todo list.

But as always: PRs are very welcome! If you want to give it a go, I would look at how we do support for databases and copy this and change it.

@cleptric
Copy link
Member

@nklmilojevic Are you using https://github.com/elastic/elasticsearch-php or something else?

@nklmilojevic
Copy link
Author

Hi @cleptric! We use https://github.com/cviebrock/laravel-elasticsearch which essentially wraps the official client into Laravel.

@cleptric
Copy link
Member

cleptric commented Mar 31, 2023

This Package Will Be Abandoned

is kind of a red flag 🙁

@nklmilojevic
Copy link
Author

It is - we planned to fork it and to maintain it as MailerLite company (of course, opensourced), and that will probably happen in the next few days.

@stayallive
Copy link
Collaborator

stayallive commented Apr 13, 2023

The nice thing is that you can already enable tracing of the Elastic client.

$elasticClient = Elastic\Elasticsearch\ClientBuilder::create()
    ->setHttpClient($someHttpClient)
    ->build();

The Elastic ClientBuilder class supports setting a http client, it expects a PSR ClientInterface and Guzzle is one of those. And we already have a tracing middleware for Guzzle so combining those pieces of information:

$stack = GuzzleHttp\HandlerStack::create();
$stack->push(Sentry\Tracing\GuzzleTracingMiddleware::trace());

$httpClient = new GuzzleHttp\Client([
    'handler' => $stack,
]);

$elasticClient = Elastic\Elasticsearch\ClientBuilder::create()
    ->setHttpClient($someHttpClient)
    ->build();

This $elasticClient can be bound tot he container for example to re-use throughout your application and will trace all HTTP requests the Elastic client makes 👍

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

6 participants