Skip to content

Commit

Permalink
Fix metric server and add documentation readme helper
Browse files Browse the repository at this point in the history
  • Loading branch information
fpapon committed Apr 3, 2024
1 parent c0b54f7 commit 022c6fe
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
9 changes: 9 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ Pre-requisite: Maven >= 3.8 and Java >= 17.
mvn clean install
----

== Documentation

To run the documentation website locally:

[source, bash]
----
mvn process-classes -pl app-documentation yupiik-tools:serve-minisite -e
----

== Test

=== Products
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import io.yupiik.fusion.examples.backend.configuration.BackendConfiguration;
import io.yupiik.fusion.framework.api.scope.DefaultScoped;
import io.yupiik.fusion.framework.build.api.event.OnEvent;
import io.yupiik.fusion.framework.build.api.order.Order;
import io.yupiik.fusion.http.server.api.WebServer;
import io.yupiik.fusion.http.server.impl.tomcat.TomcatWebServerConfiguration;
import io.yupiik.fusion.json.JsonMapper;
Expand All @@ -35,6 +36,8 @@
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.LongAdder;
import java.util.function.Consumer;
import java.util.stream.Stream;

import static io.yupiik.fusion.tracing.id.IdGenerator.Type.HEX;
import static jakarta.servlet.DispatcherType.REQUEST;
Expand All @@ -46,7 +49,7 @@
*/
@DefaultScoped
public class DemoMetricRegistrar {
protected void onStart(@OnEvent final WebServer.Configuration configuration,
protected void onStart(@OnEvent @Order(10_000) final WebServer.Configuration configuration,
final MetricsRegistry registry,
final BackendConfiguration conf,
final JsonMapper json) {
Expand All @@ -55,8 +58,10 @@ protected void onStart(@OnEvent final WebServer.Configuration configuration,
// add a custom metric
tomcatConf.setContextCustomizers(List.of(ctx -> customize(ctx, registry)));
// enable tracing (zipkin/jaeger)
tomcatConf.setTomcatCustomizers(List.of(
t -> enableTracing(t, conf, json)));
tomcatConf.setTomcatCustomizers(Stream.concat(
tomcatConf.getTomcatCustomizers().stream(), // keep default customizers
Stream.of(t -> enableTracing(t, conf, json)))
.toList());
}

private void enableTracing(final Tomcat tomcat, final BackendConfiguration conf, final JsonMapper json) {
Expand Down
1 change: 1 addition & 0 deletions app-deployment/bundlebee/descriptions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
app.deploytime = Deployment time label.
app.environment = Environment label.
app.namespace.name = Namespace for the application (`backend`)
app.node.port = Node port of the application

yupiik.bundlebee.version = BundleBee version (default alveoli version) - injected from the pom.xml version if not overriden.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@
},
"readinessProbe": {
"initialDelaySeconds": 4,
"periodSeconds": 30,
"periodSeconds": 10,
"failureThreshold": 10,
"httpGet": {
"path": "{{service.probes.readiness.path:-/health?type=live}}",
"port": {{service.probes.readiness.port:-8181}}
}
},
"livenessProbe": {
"initialDelaySeconds": 10,
"periodSeconds": 30,
"initialDelaySeconds": 5,
"periodSeconds": 10,
"failureThreshold": 10,
"timeoutSeconds": 30,
"httpGet": {
Expand All @@ -105,12 +105,7 @@
}
}
],
"serviceAccountName": "{{service.account.name:-default}}",
"imagePullSecrets": [
{
"name": "{{service.image.pullSecret:-registry-secret}}"
}
]
"serviceAccountName": "{{service.account.name:-default}}"
}
},
"replicas": {{service.replicas:-1}}
Expand Down

0 comments on commit 022c6fe

Please sign in to comment.