io.sentry.dsn.Dsn Java Examples

The following examples show how to use io.sentry.dsn.Dsn. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SentryHandlerValueFactory.java    From quarkus with Apache License 2.0 6 votes vote down vote up
public RuntimeValue<Optional<Handler>> create(final SentryConfig config) {
    final SentryConfigProvider provider = new SentryConfigProvider(config);
    final Lookup lookup = new Lookup(provider, provider);

    if (!config.enable) {
        // Disable Sentry
        Sentry.init(SentryOptions.from(lookup, Dsn.DEFAULT_DSN));
        return new RuntimeValue<>(Optional.empty());
    }
    if (!config.dsn.isPresent()) {
        throw new ConfigurationException(
                "Configuration key \"quarkus.log.sentry.dsn\" is required when Sentry is enabled, but its value is empty/missing");
    }
    if (!config.inAppPackages.isPresent()) {
        LOG.warn(
                "No 'quarkus.sentry.in-app-packages' was configured, this option is highly recommended as it affects stacktrace grouping and display on Sentry. See https://quarkus.io/guides/logging-sentry#in-app-packages");
    }

    // Init Sentry
    Sentry.init(SentryOptions.from(lookup, config.dsn.get()));
    SentryHandler handler = new SentryHandler();
    handler.setLevel(config.level);
    return new RuntimeValue<>(Optional.of(handler));
}
 
Example #2
Source File: SentryFactory.java    From zhcet-web with Apache License 2.0 5 votes vote down vote up
@Override
public SentryClient createSentryClient(Dsn dsn) {
    SentryClient sentryClient = new SentryClient(createConnection(dsn), getContextManager(dsn));

    /* Create and use the ForwardedAddressResolver, which will use the
       X-FORWARDED-FOR header for the remote address if it exists. */
    ForwardedAddressResolver forwardedAddressResolver = new ForwardedAddressResolver();
    sentryClient.addBuilderHelper(new HttpEventBuilderHelper(forwardedAddressResolver));

    sentryClient.addBuilderHelper(new ContextBuilderHelper(sentryClient));
    return configureSentryClient(sentryClient, dsn);
}
 
Example #3
Source File: EarthSentryClientFactory.java    From collect-earth with MIT License 4 votes vote down vote up
@Override
protected ContextManager getContextManager(Dsn dsn) {
	return new SingletonContextManager();
}