Karyo
Documentation/ Decision records

ADR 0025: Metrics are exposed and no collector ships; tracing is present and off

Karyo 2.1.1rendered at build time
On this page

Status: Accepted

Context

An operator running Karyo needs to know whether it is up, whether it is healthy, and - when something has gone wrong - what it was doing. The managed-identity deployment is four containers on one host; external-provider mode omits Keycloak (ADR 0022), run by whoever installed it.

Quarkus supplies health checks, Prometheus-format metrics and OpenTelemetry tracing as extensions, and including them costs little. Collecting, storing and showing what they produce is a different matter: it takes a scraper, storage and a dashboard, which are services somebody has to run. And a request in Karyo is served by one process in one transaction (ADR 0001), so there is no path across services for a trace to reveal.

Decision

  • Health. nginx exposes only the exact /q/health/live path for anonymous uptime probes. Its report contains status and an empty checks list, with no dependency detail. All other /q/ paths return 404 on the public origin. Container healthchecks continue to read /q/health/ready on the internal application port.
  • Readiness detail requires administration access. The console Health page reads GET /api/v1/admin/health, guarded by settings.manage held at the Company node, the same gate as the page. The report describes the whole installation, so a grant at one Business Unit or Facility neither shows the page nor opens the route. It returns SmallRye's readiness report in-process, including check data. Anonymous callers receive the standard 401 problem; signed-in callers without the action at the Company receive 403. A valid report returns HTTP 200 even when its status is DOWN, so the page can display the detail. The response is not cached. This replaces anonymous aggregate health access because database and identity-provider details do not belong on the public origin.
  • Metrics. Micrometer's Prometheus registry is in the application, and Quarkus exposes Prometheus-format metrics on the management path, /q/metrics. Only the built-in meters are in use; Karyo defines no business metrics of its own. nginx does not proxy the metrics path, so it is reachable only from the Compose network.
  • No collector ships. The deployment contains no metrics server, no dashboard, no alerting and no log or trace backend. An operator who wants them runs them.
  • Tracing is present and off. The OpenTelemetry extension is in the application, with an OTLP exporter endpoint configured (OTEL_ENDPOINT, http://localhost:4317 unless set), and it is switched off in every profile Karyo runs in: quarkus.otel.enabled: false in dev, quarkus.otel.sdk.disabled: true in prod, and quarkus.otel.enabled=false in tests. No spans are produced.

Consequences

  • An installation reports liveness with no extra service. External monitors use /q/health/live; readiness monitors use the internal port. The console reads readiness through the signed-in API rather than exposing management endpoints.
  • Nothing scrapes the metrics. They exist in every image and go unread unless an operator puts a scraper on the Compose network.
  • There are no traces, so there is no trace id. ProblemDetail carries a traceId field that nothing populates.
  • Correlation is the journal's correlationId. The X-Correlation-Id header reaches the logging context (ADR 0026) and the journal rows the request writes, unless the operation sets a correlation of its own (ADR 0010). With tracing off, that is how a client reconstructs a multi-step operation: it queries GET /api/v1/journals?correlationId=. The journal covers stock movements only, and Karyo does not generate an id.
  • Whether a collector should ship with the deployment has not been decided. None does.

Alternatives considered

  • A metrics server, dashboards and alerting deployed with every installation. Not part of the deployment. They would add at least three services to a four-container stack on one host. No decision against them is recorded; they are simply not part of it.
  • A hosted monitoring or tracing service. Rejected: an installation runs on a host its operator controls, often on premises, and the product does not assume it may send data to a third party or tie its operators to one vendor's pricing.
  • Tracing switched on. Rejected while every request is one process and one transaction: a trace would show a call path inside a single JVM that the logs already show.
  • Metrics exposed through nginx. Rejected: the management namespace stays private, and only liveness is proxied.

Evidence

  • services/karyo-app/build.gradle.kts, libs.quarkus.smallrye.health, libs.quarkus.micrometer.registry.prometheus, libs.quarkus.opentelemetry, libs.quarkus.logging.json - the health, Prometheus, OpenTelemetry and JSON logging extensions
  • services/karyo-app/src/main/resources/application.yaml keys quarkus.smallrye-health.root-path and quarkus.otel.exporter.otlp.endpoint - the health path and the OTLP exporter endpoint
  • application.yaml keys %dev quarkus.otel.enabled and %prod quarkus.otel.sdk.disabled - tracing off in dev and prod
  • services/karyo-app/src/test/resources/application.properties, quarkus.otel.enabled - tracing off in tests
  • infrastructure/docker/nginx/nginx.conf, location = /q/health/live - only exact liveness is proxied
  • services/karyo-app/src/main/kotlin/com/karyo/app/admin/AdminHealthResource.kt - signed-in readiness detail
  • infrastructure/docker/docker-compose.prod.yml, services.karyo-app.healthcheck - the application's healthcheck
  • libs/karyo-common/src/main/kotlin/com/karyo/common/exception/ProblemDetail.kt, ProblemDetail - the unused traceId
  • services/karyo-app/src/main/kotlin/com/karyo/app/auth/TenantFilter.kt, TenantFilter.populateMdc - where the correlation id goes into the log; TenantFilter.usableCorrelationId - into the journal
  • Operating an installation
  • API error contract
  • ADR 0001 - one process, one transaction per request
  • ADR 0022 - the deployment that ships no collector
  • ADR 0026 - the log, which is the record that remains
  • ADR 0017 - the error contract ProblemDetail belongs to