Skip to content

Commit

Permalink
releaseb releasef add metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Sammers21 committed Jan 8, 2025
1 parent 441ae58 commit 947f6d3
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM amazoncorretto:21 AS build_stage
FROM amazoncorretto:23 AS build_stage
WORKDIR /build
COPY . .
RUN ./gradlew --no-daemon clean test shadowJar --stacktrace

FROM amazoncorretto:21
FROM amazoncorretto:23
WORKDIR /awg2
COPY --from=build_stage /build/build/libs/wow-pla.jar wow-pla.jar
EXPOSE 9000 5006
EXPOSE 9000 9400
CMD java \
-jar \
--add-opens java.base/java.lang=ALL-UNNAMED \
Expand Down
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ dependencies {
implementation group: 'org.apache.commons', name: 'commons-collections4', version: '4.4'
implementation 'org.ocpsoft.prettytime:prettytime:5.0.6.Final'
implementation group: 'org.javatuples', name: 'javatuples', version: '1.2'
// metrics
implementation group : 'io.prometheus', name : 'prometheus-metrics-core', version : prometheusVersion
implementation group : 'io.prometheus', name : 'prometheus-metrics-instrumentation-jvm', version : prometheusVersion
implementation group : 'io.prometheus', name : 'prometheus-metrics-exporter-httpserver', version : prometheusVersion
// test
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.3'
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/constants/filterSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const SEARCH_PARAM_TO_SPEC = {
'frostmage': 'frostm',
'armswarrior': 'arms',
'furywarrior': 'fury',
'protectionwarrior': 'protection',
'protectionwarrior': 'protectionwarrior',
'assassinationrogue': 'assassination',
'outlawrogue': 'outlaw',
'subtletyrogue': 'subtlety',
Expand All @@ -44,7 +44,7 @@ export const SEARCH_PARAM_TO_SPEC = {
'enhancementshaman': 'enhancement',
'restorationshaman': 'restosham',
'holypaladin': 'holypala',
'protectionpaladin': 'protection',
'protectionpaladin': 'protectionpaladin',
'retributionpaladin': 'retribution',
'brewmastermonk': 'brewmaster',
'windwalkermonk': 'windwalker',
Expand Down
5 changes: 3 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
vertxVersion=4.4.3
luceneVersion=9.6.0
vertxVersion=4.5.11
luceneVersion=9.6.0
prometheusVersion=1.3.5
13 changes: 12 additions & 1 deletion src/io/github/sammers/pla/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import io.github.sammers.pla.logic.CharacterCache;
import io.github.sammers.pla.logic.Ladder;
import io.github.sammers.pla.logic.Refs;
import io.prometheus.metrics.exporter.httpserver.HTTPServer;
import io.prometheus.metrics.instrumentation.jvm.JvmMetrics;
import io.reactivex.Scheduler;
import io.reactivex.plugins.RxJavaPlugins;
import io.reactivex.schedulers.Schedulers;
Expand All @@ -19,7 +21,10 @@
import io.vertx.reactivex.ext.mongo.MongoClient;
import io.vertx.reactivex.ext.web.client.WebClient;
import org.ocpsoft.prettytime.PrettyTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.util.Locale;
Expand All @@ -35,14 +40,20 @@ public class Main {

public static final Executor VTHREAD_EXECUTOR = Executors.newVirtualThreadPerTaskExecutor();
public static final Scheduler VTHREAD_SCHEDULER = Schedulers.from(VTHREAD_EXECUTOR);
private static final Logger log = LoggerFactory.getLogger(Main.class);
public static PrettyTime PRETTY_TIME = new PrettyTime(new Locale("en"));
public static DateTimeFormatter DATA_TIME = ISO_DATE_TIME;
public static DateTimeFormatter DATA_TIME_WITH_WEEKDAY = new DateTimeFormatterBuilder()
.appendPattern("EEEE, ")
.append(ISO_DATE_TIME)
.toFormatter();

public static void main(String[] args) {
public static void main(String[] args) throws IOException {
JvmMetrics.builder().register();
HTTPServer.builder()
.port(9400)
.buildAndStart();
log.info("Starting Metrics server on port 9400");
final Vertx vertx = Vertx.vertx(new VertxOptions()
.setBlockedThreadCheckInterval(10)
.setBlockedThreadCheckIntervalUnit(TimeUnit.SECONDS)
Expand Down

0 comments on commit 947f6d3

Please sign in to comment.