-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add slack telemetry messages, remove NewRelic (#4231)
* Add slack telemetry messages for sql errors * pretty backend * remove newrelic code
- Loading branch information
Showing
14 changed files
with
63 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
app/oxalis/telemetry/SlackNotificationService/SlackNotificationService.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package oxalis.telemetry.SlackNotificationService | ||
|
||
import com.scalableminds.webknossos.datastore.rpc.RPC | ||
import com.typesafe.scalalogging.LazyLogging | ||
import javax.inject.Inject | ||
import play.api.libs.json.{JsObject, Json} | ||
import utils.WkConf | ||
|
||
class SlackNotificationService @Inject()(rpc: RPC, conf: WkConf) extends LazyLogging { | ||
|
||
lazy val url: String = conf.SlackNotifications.url | ||
|
||
def noticeError(ex: Throwable, message: String): Unit = | ||
noticeError(ex.toString + ": " + ex.getLocalizedMessage + "\n" + message) | ||
|
||
def noticeError(msg: String): Unit = | ||
if (url != "empty") { | ||
logger.info(s"Sending Slack notification: $msg") | ||
rpc(url).postJson( | ||
Json.obj( | ||
"attachments" -> Json.arr( | ||
Json.obj( | ||
"title" -> s"Notification from webKnossos at ${conf.Http.uri}", | ||
"text" -> msg, | ||
"color" -> "#ff8a00" | ||
)))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,6 +150,10 @@ airbrake { # To be defined in secrets.conf | |
projectID = "empty" | ||
} | ||
|
||
slackNotifications { | ||
url = "empty" | ||
} | ||
|
||
mail.reply = "No reply <[email protected]>" | ||
|
||
# other settings | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters