Sentry-laravel: How to register a new integration outside config file?

Created on 13 May 2019  路  1Comment  路  Source: getsentry/sentry-laravel

As far as I know, there are two ways to register a new integration into the client:

  1. Adding integration instances to integrations array in config/sentry.php;
  2. Override \Sentry\Laravel\ServiceProvider::configureAndRegisterClient method and add integration instances at this line https://github.com/getsentry/sentry-laravel/blob/master/src/Sentry/Laravel/ServiceProvider.php#L113 .

But both ways are not good enough:

  1. The custom integration may depend on other third-party objects which are not able to instantiate in the config file
  2. When I copy-paste the body of \Sentry\Laravel\ServiceProvider::configureAndRegisterClient method into my own ServiceProvider class, it told me that ClientBuilder::setSdkIdentifier and ClientBuilder::setSdkVersion method are internal (they are not defined as private but there is @internal annotation).

So I wonder if there is an elegant way to add a new integration which has third-part dependence?

question

Most helpful comment

@leo108 thanks for bringing this up, I am working on a PR (#239) that should solve this issue.

The setSdkIdentifier & setSdkVersion are marked as @internal because they should only be used by library authors and not by end users since they identify the SDK to the Sentry server and should not be changed by the user.

>All comments

@leo108 thanks for bringing this up, I am working on a PR (#239) that should solve this issue.

The setSdkIdentifier & setSdkVersion are marked as @internal because they should only be used by library authors and not by end users since they identify the SDK to the Sentry server and should not be changed by the user.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

carlosrgzm picture carlosrgzm  路  7Comments

andrey-helldar picture andrey-helldar  路  7Comments

AidasK picture AidasK  路  5Comments

andrey-helldar picture andrey-helldar  路  6Comments

masoudjahromi picture masoudjahromi  路  4Comments