lukeyouell / craft-sentry

Error tracking that helps developers monitor and fix crashes in real time. Iterate continuously. Boost efficiency. Improve user experience.
https://sentry.io
MIT License
17 stars 10 forks source link

Feature Request: Allow to define sentry host #3

Closed sergeifilippov closed 5 years ago

sergeifilippov commented 6 years ago

It would be great if you could specify the host to be used for Sentry so you can send the data to the self hosted version. 👍🏻

lukeyouell commented 6 years ago

@sergeifilippov I'm unfamiliar with self-hosted Sentry installations, could you point me in the direction of api documentation regarding this?

sergeifilippov commented 6 years ago

As far as I know you just need to change the hostname to which you're sending the requests to.

So https://sentry.io/api/0/ would become https://self-hosted-sentry.example.com/api/0/.

I can send you a docker-compose.yml configuration to get it setup locally for testing if you need.

lukeyouell commented 6 years ago

@sergeifilippov can you replace line 108 of SentryService.php:

$sentryClient = new Raven_Client($settings->clientDsn);

with:

$sentryClient = new Raven_Client($settings->clientDsn, [
    'name' => 'hostname'
]);

as per the docs and then let me know if this works for you?

sergeifilippov commented 6 years ago

I have a Sentry stack running in docker on http://localhost:8080

It works if I do the following:

Update base_uri in SentryService.php on line 53:

      $client = new \GuzzleHttp\Client([
        'base_uri' => 'http://localhost:8080',
        'http_errors' => false,
        'timeout' => 5,
        'headers' => [
          'Authorization' => 'Bearer ' . $authToken
        ]
      ]);

and update href in settings.twig on line 56:

{% if 'authToken' not in overrides %}
  <a class="btn" href="http://localhost:8080/api/" target="_blank">Get Authentication Token</a>
{% endif %}
lukeyouell commented 6 years ago

@sergeifilippov Guzzle is used to fetch the available config settings from Sentry, the actual error handling is managed using Sentry's Raven Client.

You'll still need to update the Raven Client parameters.