Skip to content

feat(logging): enhance JSON logging fields#129

Closed
TheMeinerLP wants to merge 4 commits into
mainfrom
feat/observability-loki
Closed

feat(logging): enhance JSON logging fields#129
TheMeinerLP wants to merge 4 commits into
mainfrom
feat/observability-loki

Conversation

@TheMeinerLP

Copy link
Copy Markdown
Contributor
  • build: add OpenTelemetry and JSON-logging dependencies
  • feat(logging): structured JSON logging for Grafana Loki
  • feat(tracing): configure OpenTelemetry OTLP export
  • feat(logging): enhance JSON logging fields for improved structure and readability

Add the version-catalog entries (settings.gradle.kts) and wire them into
the backend: micronaut-tracing-opentelemetry http/jdbc, the OTLP exporter,
logstash-logback-encoder, the OpenTelemetry logback MDC appender and janino.

Also disable the AOT replaceLogbackXml optimization so logback.xml is parsed
at runtime, which the env-driven JSON/plain switch and ${...} substitution
in the optimized (Docker/prod) jar depend on.
Switch logback to emit structured JSON on stdout when LOG_JSON=true (set in
the Docker/prod container) so Loki can index the fields; local dev keeps the
human-readable pattern. Wrap the appender with the OpenTelemetry MDC appender
so each line carries trace_id/span_id for log <-> trace correlation.
Add the otel config block: tracing is disabled by default (exporter "none")
and activates when OTEL_TRACES_EXPORTER=otlp is set, exporting spans over OTLP
gRPC to the configured endpoint. Metrics stay on Prometheus/Micrometer, and
health/prometheus/swagger paths are excluded from tracing.
@TheMeinerLP TheMeinerLP changed the title feat/observability loki feat(logging): enhance JSON logging fields Jun 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant