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
import org.junit.jupiter.api.Test | |
class CalculateEdgeTest { | |
@Test | |
fun `given two positive x points, calculate edge should return correct value`() { | |
val result1 = calculateEdge(listOf(Point(105, 0), Point(101, 0))) | |
assert(result1 == 103) | |
} |
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
fun main(args: Array<String>) { | |
[...] | |
embeddedServer(Netty, port = config.port) { | |
println("Starting instance in ${config.host}:${config.port}") | |
module { | |
install(Koin) { | |
modules( | |
module { | |
[...] | |
single { PrometheusMeterRegistry(PrometheusConfig.DEFAULT) } |
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
fun Application.module() { | |
[...] | |
// Metrics feature installation, adding Micrometer as the preferred lib | |
install(MicrometerMetrics) { | |
registry = get<PrometheusMeterRegistry>() | |
meterBinders = listOf( | |
ClassLoaderMetrics(), | |
JvmMemoryMetrics(), | |
JvmGcMetrics(), | |
ProcessorMetrics(), |
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
apply plugin: 'kotlin' | |
apply plugin: 'application' | |
apply plugin: 'com.github.johnrengelman.shadow' | |
[...] | |
dependencies { | |
[...] | |
implementation "io.ktor:ktor-metrics:$ktor_version" |
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
fun Routing.metrics() { | |
val registry = get<PrometheusMeterRegistry>() | |
get("/metrics") { | |
call.respondText { | |
registry.scrape() | |
} | |
} | |
} |
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
scrape_configs: | |
- job_name: 'KtorEasy' | |
metrics_path: /metrics | |
scrape_interval: 5s | |
static_configs: | |
- targets: ['backend:3500'] |
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
version: '2.1' | |
services: | |
db: | |
image: mariadb:latest | |
restart: always | |
environment: | |
- MYSQL_ROOT_PASSWORD=mypassword | |
- MYSQL_DATABASE=ktoreasydb | |
- MYSQL_USER=ktoreasyuser | |
- MYSQL_PASSWORD=ktoreasypassword |
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
###################### PREVIOUS DOCKER-COMPOSE FILE ############### | |
version: '2.1' | |
services: | |
db: | |
image: mariadb:latest | |
restart: always | |
volumes: | |
- ./db/KtorEasyDBSnap:/var/lib/mysql | |
- ./db/dbConfig:/etc/mysql/conf.d | |
environment: |
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
version: '2.1' | |
# Services we are going to use when running | |
services: | |
# Database instance we need to store data | |
db: | |
image: mariadb:latest | |
restart: always | |
environment: | |
- MYSQL_ROOT_PASSWORD=mypassword |
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
ktor { | |
deployment { | |
dev { | |
host = "localhost" | |
port = 3500 | |
databaseHost = "db" | |
databasePort = "3306" | |
} | |
uat { | |
host = "myhost.com" |
NewerOlder