Skip to content

Commit

Permalink
Merge pull request #1968 from GiganticMinecraft/add_sentry
Browse files Browse the repository at this point in the history
Add Sentry
  • Loading branch information
inductor authored May 7, 2023
2 parents a46f26f + b1664f4 commit d61e5c8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ val dependenciesToEmbed = Seq(

// ajd4jp
"com.github.KisaragiEffective" % "ajd4jp-mirror" % "8.0.2.2021",

// Sentry
"io.sentry" % "sentry" % "6.18.1",
)

// endregion
Expand Down
16 changes: 16 additions & 0 deletions src/main/scala/com/github/unchama/seichiassist/SeichiAssist.scala
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ import com.github.unchama.seichiassist.task.PlayerDataSaveTask
import com.github.unchama.seichiassist.task.global._
import com.github.unchama.util.{ActionStatus, ClassUtils}
import io.chrisdavenport.log4cats.slf4j.Slf4jLogger
import io.sentry.Sentry
import io.sentry.SentryLevel;
import org.bukkit.Bukkit
import org.bukkit.ChatColor._
import org.bukkit.entity.{Entity, Player, Projectile}
Expand Down Expand Up @@ -594,6 +596,20 @@ class SeichiAssist extends JavaPlugin() {
// コンフィグ系の設定は全てConfig.javaに移動
SeichiAssist.seichiAssistConfig = Config.loadFrom(this)

Sentry.init(options => {
options.setDsn("https://[email protected]/2");
// パフォーマンスモニタリングに使うトレースサンプルの送信割合
// tracesSampleRateを1.0にすると全てのイベントが送られるため、送りすぎないように調整する必要がある
options.setTracesSampleRate(0.25);
// When first trying Sentry it's good to see what the SDK is doing:
options.setDebug(true);

// どのサーバーからイベントが送られているのかを判別する識別子
options.setEnvironment(SeichiAssist.seichiAssistConfig.getServerId);
});

Sentry.configureScope(scope => scope.setLevel(SentryLevel.WARNING));

if (SeichiAssist.seichiAssistConfig.getDebugMode == 1) {
// debugmode=1の時は最初からデバッグモードで鯖を起動
logger.info(s"${RED}SeichiAssistをデバッグモードで起動します")
Expand Down

0 comments on commit d61e5c8

Please sign in to comment.