Skip to content

Commit

Permalink
Gradle 7.1 og oppdaterte prometheus client
Browse files Browse the repository at this point in the history
  • Loading branch information
geiralund committed Jun 23, 2021
1 parent 6d8b5be commit bbb62ad
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 4 deletions.
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand Down
4 changes: 4 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

Expand Down Expand Up @@ -81,6 +84,7 @@ set CMD_LINE_ARGS=%*

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/no/nav/dagpenger/streams/Service.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import java.util.Properties
private val LOGGER = KotlinLogging.logger {}
private val bootstrapServersConfig = System.getenv("KAFKA_BOOTSTRAP_SERVERS") ?: "localhost:9092"

abstract class Service {
abstract class Service(val collectorRegistry: CollectorRegistry = CollectorRegistry.defaultRegistry) {
protected abstract val SERVICE_APP_ID: String
protected open val HTTP_PORT: Int = 8080
protected open val healthChecks: List<HealthCheck> = emptyList()
protected open val withHealthChecks: Boolean = true
private val collectorRegistry: CollectorRegistry = CollectorRegistry.defaultRegistry
private val registry = PrometheusMeterRegistry(PrometheusConfig.DEFAULT, collectorRegistry, Clock.SYSTEM)

private val streams: KafkaStreams by lazy {
setupStreamsInternal().also {
KafkaStreamsMetrics(it).also { metrics -> metrics.bindTo(registry) }
Expand Down
3 changes: 2 additions & 1 deletion src/test/kotlin/no/nav/dagpenger/streams/ServiceTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package no.nav.dagpenger.streams

import io.kotest.assertions.throwables.shouldThrow
import io.kotest.matchers.shouldBe
import io.prometheus.client.CollectorRegistry
import org.apache.kafka.streams.StreamsBuilder
import org.apache.kafka.streams.Topology
import org.junit.jupiter.api.Test
Expand All @@ -15,7 +16,7 @@ import java.util.Properties
internal class ServiceTest {

internal class ServiceUnderTest(override val withHealthChecks: Boolean, override val healthChecks: List<HealthCheck>) :
Service() {
Service(CollectorRegistry(true)) {
override fun buildTopology(): Topology {
val builder = StreamsBuilder()
builder.stream<String, String>("test-topic")
Expand Down

0 comments on commit bbb62ad

Please sign in to comment.