Skip to content

Commit

Permalink
Merge pull request #374 from ostelco/feature/slack-channel-alerting
Browse files Browse the repository at this point in the history
Slack channel alerting
  • Loading branch information
vihangpatil authored Oct 12, 2018
2 parents 1b1307c + 2ab1cf9 commit e499d99
Show file tree
Hide file tree
Showing 23 changed files with 36 additions and 58 deletions.
2 changes: 1 addition & 1 deletion analytics-module/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies {
implementation "com.google.cloud:google-cloud-pubsub:$googleCloudVersion"
implementation 'com.google.code.gson:gson:2.8.5'

testImplementation 'com.google.api:gax-grpc:1.33.0'
testImplementation 'com.google.api:gax-grpc:1.33.1'

testImplementation "io.dropwizard:dropwizard-testing:$dropwizardVersion"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ subprojects {
ext {
kotlinVersion = "1.2.71"
dropwizardVersion = "1.3.7"
kotlinXCoroutinesVersion = "0.30.0"
googleCloudVersion = "1.48.0"
kotlinXCoroutinesVersion = "0.30.2"
googleCloudVersion = "1.49.0"
jacksonVersion = "2.9.7"
stripeVersion = "7.0.0"
stripeVersion = "7.1.0"
guavaVersion = "26.0-jre"
junit5Version = "5.3.1"
assertJVersion = "3.11.1"
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ services:

neo4j:
container_name: "neo4j"
image: neo4j:3.4.7
image: neo4j:3.4.8
environment:
- NEO4J_AUTH=none
ports:
Expand Down
2 changes: 1 addition & 1 deletion neo4j-store/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id "java-library"
}

ext.neo4jVersion="3.4.7"
ext.neo4jVersion="3.4.8"
ext.neo4jDriverVersion="1.6.3"

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
Expand Down
2 changes: 1 addition & 1 deletion neo4j-store/src/test/resources/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3.3"
services:
neo4j:
container_name: "neo4j"
image: neo4j:3.4.7
image: neo4j:3.4.8
environment:
- NEO4J_AUTH=none
ports:
Expand Down
2 changes: 1 addition & 1 deletion ocs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies {
implementation project(':prime-modules')

implementation 'com.lmax:disruptor:3.4.2'
// implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.30.0"
// implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.30.2"

testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlinVersion"
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion"
Expand Down
4 changes: 2 additions & 2 deletions ocsgw/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "application"
// FIXME: unable to update to 4.0.0
// FIXME martin: unable to update to 4.0.1
id "com.github.johnrengelman.shadow" version "2.0.4"
}

Expand All @@ -17,7 +17,7 @@ dependencies {
implementation 'ch.qos.logback:logback-classic:1.2.3'

// log to gcp stack-driver
implementation 'com.google.cloud:google-cloud-logging-logback:0.66.0-alpha'
implementation 'com.google.cloud:google-cloud-logging-logback:0.67.0-alpha'

testImplementation project(':diameter-test')
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit5Version"
Expand Down
2 changes: 1 addition & 1 deletion prime-client-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id "org.jetbrains.kotlin.jvm" version "1.2.71"
id 'java-library'
id 'org.hidetake.swagger.generator' version '2.13.0'
id 'org.hidetake.swagger.generator' version '2.14.0'
id "idea"
}

Expand Down
5 changes: 3 additions & 2 deletions prime/infra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ gcloud container builds submit \

```bash
kubectl create secret generic pantel-prod.json --from-file prime/config/pantel-prod.json
kubectl create secret generic imeiDb.csv.zip --from-file imeiDb.csv.zip
```

Reference:
Expand Down Expand Up @@ -207,11 +208,11 @@ kubectl create secret generic pantel-prod.json --from-file prime/config/pantel-p
Note: To update the secrets defined using yaml, delete and created them again. They are not updated.

```bash
sed -e s/STRIPE_API_KEY/$(echo -n 'keep-stripe-api-key-here' | base64)/g prime/infra/dev/stripe-secrets.yaml | kubectl apply -f -
kubectl create secret generic stripe-secrets --from-literal=stripeApiKey='keep-stripe-api-key-here'
```

```bash
sed -e s/SLACK_WEBHOOK_URI/$(echo -n 'https://hooks.slack.com/services/.../.../...' | base64)/g prime/infra/dev/slack-secrets.yaml | kubectl apply -f -
kubectl create secret generic slack-secrets --from-literal=slackWebHookUri='https://hooks.slack.com/services/.../.../...'
```

```bash
Expand Down
2 changes: 1 addition & 1 deletion prime/infra/dev/neo4j.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
spec:
containers:
- name: neo4j
image: "neo4j:3.4.7-enterprise"
image: "neo4j:3.4.8-enterprise"
imagePullPolicy: "IfNotPresent"
env:
- name: NEO4J_dbms_mode
Expand Down
7 changes: 0 additions & 7 deletions prime/infra/dev/slack-secrets.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions prime/infra/dev/stripe-secrets.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion prime/infra/prod/neo4j.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
spec:
containers:
- name: neo4j
image: "neo4j:3.4.7-enterprise"
image: "neo4j:3.4.8-enterprise"
imagePullPolicy: "IfNotPresent"
env:
- name: NEO4J_dbms_mode
Expand Down
7 changes: 0 additions & 7 deletions prime/infra/prod/slack-secrets.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions prime/infra/prod/stripe-secrets.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion prime/src/integration-tests/resources/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3.3"
services:
neo4j:
container_name: "neo4j"
image: neo4j:3.4.7
image: neo4j:3.4.8
environment:
- NEO4J_AUTH=none
ports:
Expand Down
5 changes: 3 additions & 2 deletions slack/src/main/kotlin/org/ostelco/prime/slack/Model.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import com.fasterxml.jackson.annotation.JsonProperty
data class Message(
val channel: String,
@JsonProperty("username") val userName: String? = null,
val text: String ?= null,
@JsonProperty("icon_emoji") val iconEmoji: String ?= null,
val text: String = "",
@JsonProperty("icon_emoji") val iconEmoji: String? = null,
val attachments: List<Attachment> = emptyList()) {

fun format(): Message = this.copy(
channel = "#$channel",
text = "<!channel> $text",
iconEmoji = iconEmoji?.let { ":$it:" })
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object SlackNotificationReporter {
channel = Registry.channel,
// text = message,
// userName = Registry.userName,
iconEmoji = levelToEmoji(level),
// iconEmoji = levelToEmoji(level),
attachments = listOf(
Attachment(
fallback = message,
Expand Down Expand Up @@ -53,12 +53,16 @@ object SlackNotificationReporter {
TRACE -> "#C0C0C0"
}

private fun levelToTitle(level: Level): String = when (level) {
ERROR -> "Error"
WARN -> "Warning"
INFO -> "Info"
DEBUG -> "Debug"
TRACE -> "Trace"
private fun levelToTitle(level: Level): String {
val emoji = levelToEmoji(level)
val title = when (level) {
ERROR -> "Error"
WARN -> "Warning"
INFO -> "Info"
DEBUG -> "Debug"
TRACE -> "Trace"
}
return ":$emoji: $title"
}
}

2 changes: 1 addition & 1 deletion tools/neo4j-admin-tools/docker-compose.backup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3.7"
services:
neo4j-online-backup:
container_name: neo4j-online-backup
image: neo4j:3.4.7-enterprise
image: neo4j:3.4.8-enterprise
command: >
bin/neo4j-admin backup
--backup-dir=/backup_dir
Expand Down
2 changes: 1 addition & 1 deletion tools/neo4j-admin-tools/docker-compose.neo4j.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3.7"
services:
neo4j:
container_name: "neo4j"
image: neo4j:3.4.7
image: neo4j:3.4.8
environment:
- NEO4J_AUTH=none
ports:
Expand Down
2 changes: 1 addition & 1 deletion tools/neo4j-admin-tools/docker-compose.restore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3.7"
services:
neo4j-online-restore:
container_name: neo4j-online-restore
image: neo4j:3.4.7-enterprise
image: neo4j:3.4.8-enterprise
command: >
bin/neo4j-admin restore
--from=/backup_dir/graph.db-backup
Expand Down
2 changes: 1 addition & 1 deletion tools/neo4j-admin-tools/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3.7"
services:
neo4j:
container_name: "neo4j"
image: neo4j:3.4.7
image: neo4j:3.4.8
environment:
- NEO4J_AUTH=none
ports:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3.7"
services:
neo4j:
container_name: "neo4j"
image: neo4j:3.4.7-enterprise
image: neo4j:3.4.8-enterprise
environment:
- NEO4J_AUTH=none
- NEO4J_ACCEPT_LICENSE_AGREEMENT=yes
Expand Down

0 comments on commit e499d99

Please sign in to comment.