Skip to content

NomadBlacky/sentry-config

Repository files navigation

sentry-config

Configure sentry-java by typesafe-config.

Installation

Using Maven:

<dependency>
    <groupId>com.github.nomadblacky</groupId>
    <artifactId>sentry-config</artifactId>
    <version>0.4.0</version>
</dependency>

Using Gradle:

compile 'com.github.nomadblacky:sentry-config:0.4.0'

Using SBT:

libraryDependencies += "com.github.nomadblacky" % "sentry-config" % "0.4.0"

Usage

Set configurations in application.conf

sentry {
  dsn = "https://public:private@host:port/1"
  environment = "production"
}

Apply the sentry.factory property

Using JVM options:

$ java -Dsentry.factory=com.github.nomadblacky.sentry.config.SentryClientFactory

or

Using sentry.properties:

factory=com.github.nomadblacky.sentry.config.SentryClientFactory

Supported configurations

See the examples in src/test/resources/application.conf.

Custom client factories

Implementation

package sample;

import com.github.nomadblacky.sentry.config.DefaultTypesafeConfigSentryClientFactory;

public class MyCustomSentryClientFactory extends DefaultTypesafeConfigSentryClientFactory {
    @Override
    public SentryClient createSentryClient(Dsn dsn) {
        // Initialize a SentryClient with typesafe-config.
        SentryClient client = super.createSentryClient(dsn);
        client.addBuilderHelper(new CustomEventBuilderHelper());
        return client;
    }
}

public class CustomEventBuilderHelper implements EventBuilderHelper { 
    @Override
    public void helpBuildingEvent(EventBuilder eventBuilder) {
        // Helping to build events!
    }
}

Usage

$ java -Dsentry.factory=sample.MyCustomSentryClientFactory

or

factory=sample.MyCustomSentryClientFactory

About

Configure sentry-java by typesafe-config.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages