Skip to content

Commit

Permalink
Split remaining service dependencies into their own modules
Browse files Browse the repository at this point in the history
This is AWS, Graphite, Jaeger, SignalFx, and Zipkin.

The Zipkin/Jaeger change is unsatisfying because we used to support choosing a tracer
at runtime depending on what was in the config. This was nice behavior but it meant
that every application had the union of all tracing dependencies in their binary.
I'm going to try to find a nicer way in follow-up.
  • Loading branch information
squarejesse committed Jul 5, 2018
1 parent 8aa8e0c commit cea3164
Show file tree
Hide file tree
Showing 47 changed files with 263 additions and 139 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ ext {
gcpCloudStorage : 'com.google.cloud:google-cloud-storage:1.15.0',
jCommander : 'com.beust:jcommander:1.72',
openTracing : 'io.opentracing:opentracing-api:0.31.0',
openTracingUtil : 'io.opentracing:opentracing-util:0.31.0',
openTracingMock : 'io.opentracing:opentracing-mock:0.31.0',
openTracingOkHttp : 'io.opentracing.contrib:opentracing-okhttp3:0.1.0',
tracingJaeger : 'com.uber.jaeger:jaeger-core:0.24.0',
Expand Down
40 changes: 40 additions & 0 deletions misk-aws/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import org.junit.platform.console.options.Details

apply plugin: 'kotlin'
apply plugin: 'org.junit.platform.gradle.plugin'

compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
allWarningsAsErrors = true
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
allWarningsAsErrors = true
}
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin/'
test.java.srcDirs += 'src/test/kotlin/'
}

junitPlatform {
details Details.VERBOSE
}

dependencies {
compile dep.awsApi
compile dep.awsLogging
compile project(':misk')

testCompile dep.assertj
testCompile dep.junitApi
testCompile dep.junitEngine
testCompile dep.junitParams
testCompile project(':misk-testing')
}

apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
4 changes: 4 additions & 0 deletions misk-aws/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
POM_ARTIFACT_ID=misk-aws
POM_NAME=misk-aws
POM_DESCRIPTION=Misk module for AWS
POM_PACKAGING=jar
7 changes: 5 additions & 2 deletions misk-gcp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@ junitPlatform {
}

dependencies {
compile dep.metricsStackDriver
compile dep.gcpCloudStorage
compile(dep.gcpDatastore) {
exclude group: 'com.google.protobuf'
exclude group: 'com.google.api.grpc'
exclude group: 'io.grpc'
}
compile dep.gcpKms
compile dep.gcpCloudStorage
compile dep.gcpLogback
compile dep.metricsStackDriver
compile project(':misk')
compile project(':misk-jaeger')
compile project(':misk-zipkin')

testCompile project(':misk-testing')
testCompile project(':misk-gcp-testing')
Expand Down
39 changes: 39 additions & 0 deletions misk-graphite/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import org.junit.platform.console.options.Details

apply plugin: 'kotlin'
apply plugin: 'org.junit.platform.gradle.plugin'

compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
allWarningsAsErrors = true
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
allWarningsAsErrors = true
}
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin/'
test.java.srcDirs += 'src/test/kotlin/'
}

junitPlatform {
details Details.VERBOSE
}

dependencies {
compile dep.metricsGraphite
compile project(':misk')

testCompile dep.assertj
testCompile dep.junitApi
testCompile dep.junitEngine
testCompile dep.junitParams
testCompile project(':misk-testing')
}

apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
4 changes: 4 additions & 0 deletions misk-graphite/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
POM_ARTIFACT_ID=misk-graphite
POM_NAME=misk-graphite
POM_DESCRIPTION=Misk module for Graphite
POM_PACKAGING=jar
3 changes: 2 additions & 1 deletion misk-hibernate/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ junitPlatform {

dependencies {
compile dep.hibernateCore
compile dep.mysql
compile dep.hikariCp
compile dep.hsqldb
compile dep.mysql
compile project(':misk')

testCompile project(':misk-testing')
Expand Down
39 changes: 39 additions & 0 deletions misk-jaeger/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import org.junit.platform.console.options.Details

apply plugin: 'kotlin'
apply plugin: 'org.junit.platform.gradle.plugin'

compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
allWarningsAsErrors = true
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
allWarningsAsErrors = true
}
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin/'
test.java.srcDirs += 'src/test/kotlin/'
}

junitPlatform {
details Details.VERBOSE
}

dependencies {
compile dep.tracingJaeger
compile project(':misk')

testCompile dep.assertj
testCompile dep.junitApi
testCompile dep.junitEngine
testCompile dep.junitParams
testCompile project(':misk-testing')
}

apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
4 changes: 4 additions & 0 deletions misk-jaeger/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
POM_ARTIFACT_ID=misk-jaeger
POM_NAME=misk-jaeger
POM_DESCRIPTION=Misk module for Jaeger
POM_PACKAGING=jar
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package misk.tracing.backends.jaeger

import com.google.common.util.concurrent.Service
import com.google.inject.Provides
import com.google.inject.Singleton
import com.uber.jaeger.Configuration
Expand All @@ -8,7 +9,9 @@ import misk.config.AppName
import misk.inject.KAbstractModule

class JaegerBackendModule(val config: JaegerBackendConfig?) : KAbstractModule() {
override fun configure() {}
override fun configure() {
multibind<Service>().to<JaegerTracingService>()
}

@Provides
@Singleton
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package misk.tracing
package misk.tracing.backends.jaeger

import com.google.common.util.concurrent.AbstractIdleService
import io.opentracing.Tracer
import io.opentracing.util.GlobalTracer
import javax.inject.Inject

internal class TracingService @Inject internal constructor(
internal class JaegerTracingService @Inject internal constructor(
private val tracer: Tracer
) : AbstractIdleService() {
override fun startUp() = GlobalTracer.register(tracer)
override fun shutDown() {}
}
override fun shutDown() {
}
}
40 changes: 40 additions & 0 deletions misk-signalfx/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import org.junit.platform.console.options.Details

apply plugin: 'kotlin'
apply plugin: 'org.junit.platform.gradle.plugin'

compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
allWarningsAsErrors = true
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
allWarningsAsErrors = true
}
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin/'
test.java.srcDirs += 'src/test/kotlin/'
}

junitPlatform {
details Details.VERBOSE
}

dependencies {
compile dep.metricsSignalFx
compile project(':misk')

testCompile dep.assertj
testCompile dep.junitApi
testCompile dep.junitEngine
testCompile dep.junitParams
testCompile project(':misk-testing')
testCompile project(':misk-gcp-testing')
}

apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
4 changes: 4 additions & 0 deletions misk-signalfx/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
POM_ARTIFACT_ID=misk-signalfx
POM_NAME=misk-signalfx
POM_DESCRIPTION=Misk module for SignalFx
POM_PACKAGING=jar
41 changes: 41 additions & 0 deletions misk-zipkin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import org.junit.platform.console.options.Details

apply plugin: 'kotlin'
apply plugin: 'org.junit.platform.gradle.plugin'

compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
allWarningsAsErrors = true
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
allWarningsAsErrors = true
}
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin/'
test.java.srcDirs += 'src/test/kotlin/'
}

junitPlatform {
details Details.VERBOSE
}

dependencies {
compile dep.tracingZipkin
compile dep.zipkinReporter
compile dep.zipkinBrave
compile project(':misk')

testCompile dep.assertj
testCompile dep.junitApi
testCompile dep.junitEngine
testCompile dep.junitParams
testCompile project(':misk-testing')
}

apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
4 changes: 4 additions & 0 deletions misk-zipkin/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
POM_ARTIFACT_ID=misk-zipkin
POM_NAME=misk-zipkin
POM_DESCRIPTION=Misk module for Zipkin
POM_PACKAGING=jar
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package misk.tracing.backends.zipkin

import brave.Tracing
import brave.opentracing.BraveTracer
import com.google.common.util.concurrent.Service
import com.google.inject.Provides
import io.opentracing.Tracer
import misk.config.AppName
Expand All @@ -11,8 +12,10 @@ import zipkin2.reporter.okhttp3.OkHttpSender
import java.util.concurrent.TimeUnit
import javax.inject.Singleton

class ZipkinBackendModule(val config: ZipkinBackendConfig) : KAbstractModule() {
override fun configure() {}
class ZipkinTracingModule(val config: ZipkinBackendConfig) : KAbstractModule() {
override fun configure() {
multibind<Service>().to<ZipkinTracingService>()
}

@Provides
@Singleton
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package misk.tracing.backends.zipkin

import com.google.common.util.concurrent.AbstractIdleService
import io.opentracing.Tracer
import io.opentracing.util.GlobalTracer
import javax.inject.Inject

internal class ZipkinTracingService @Inject internal constructor(
private val tracer: Tracer
) : AbstractIdleService() {
override fun startUp() = GlobalTracer.register(tracer)
override fun shutDown() {
}
}
11 changes: 1 addition & 10 deletions misk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,13 @@ dependencies {
compile dep.jacksonJsr310
compile dep.metricsCore
compile dep.metricsParent
compile dep.metricsGraphite
compile dep.metricsSignalFx
compile dep.jCommander
compile dep.openTracing
compile dep.openTracingUtil
compile dep.openTracingOkHttp
compile dep.tracingJaeger
compile dep.tracingZipkin
compile dep.zipkinReporter
compile dep.zipkinBrave
compile dep.retrofit
compile dep.retrofitMoshi
compile dep.retrofitWire
compile dep.gcpLogback
compile dep.hikariCp
compile dep.awsApi
compile dep.awsLogging
compile dep.logbackClassic
compile dep.slf4jApi
compile dep.jaxbApi
Expand Down
14 changes: 1 addition & 13 deletions misk/src/main/kotlin/misk/security/ssl/PemComboFile.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import okio.Buffer
import okio.BufferedSource
import okio.ByteString
import okio.Okio
import org.bouncycastle.asn1.ASN1Sequence
import org.bouncycastle.asn1.pkcs.RSAPrivateKey
import java.io.File
import java.io.IOException
Expand All @@ -12,19 +13,6 @@ import java.security.cert.Certificate
import java.security.cert.CertificateFactory
import java.security.spec.KeySpec
import java.security.spec.RSAPrivateCrtKeySpec
import java.security.GeneralSecurityException
import org.bouncycastle.util.io.pem.PemObject
import com.google.api.client.http.UrlEncodedContent.getContent
import org.bouncycastle.asn1.ASN1Object
import org.bouncycastle.asn1.ASN1Sequence
import org.bouncycastle.asn1.DERNull
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers
import org.bouncycastle.asn1.x509.AlgorithmIdentifier
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo





/**
* A file containing a mix of PEM-encoded certificates and PEM-encoded private
Expand Down
Loading

0 comments on commit cea3164

Please sign in to comment.