Send logs from Docker Buildpack to OpenTelemetry

0
Hello,    I want to connect my mendix apps hosted on kubernetes using Docker mendix buildpack (v6.0.0) with opentelemetry and send logs from app to opentelemetry.  I tried to install opentelemetry-instrument and it works but... only for buildpack python script.  Last log that i see it : "Runtime database is now available"  So its seems to me that Runtime require Java opentelemetry Agent.    Have anyone of you had this problem in the past and know how to handle it ? :)  Thanks !   
asked
1 answers
0

You’re correct that Mendix Runtime is Java-based, so opentelemetry-instrument (Python) only catches the buildpack startup logs — it won’t instrument the Mendix Runtime itself.To capture Runtime traces/metrics (and optionally logs) you need the OpenTelemetry Java Agent.

Two ways to enable it on Kubernetes

1. Use the OpenTelemetry Operator (recommended in K8s)

  • Install the OpenTelemetry Operator in your cluster.

  • Create an Instrumentation resource for Java, pointing to your OTLP endpoint.

  • Annotate your Mendix Deployment/StatefulSet with:

    instrumentation.opentelemetry.io/inject-java: "true"
    
  • The operator will inject the Java agent and configure JAVA_TOOL_OPTIONS automatically.

2. Bake the agent into your Mendix Docker image

  • Start FROM the Mendix Docker Buildpack v6.0.0 image.

  • Download opentelemetry-javaagent.jar (Java 17 compatible) and COPY it into the image.

  • Add environment variables:

    ENV JAVA_TOOL_OPTIONS="-javaagent:/opt/otel/opentelemetry-javaagent.jar" ENV OTEL_SERVICE_NAME=my-mendix-app ENV OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317 ENV OTEL_TRACES_SAMPLER=parentbased_always_on ENV OTEL_RESOURCE_ATTRIBUTES=deployment.environment=prod
    

     

Logs vs traces/metrics

  • The Java agent will automatically give you traces (HTTP, JDBC, etc.) and metrics.

  • For application logs, the simplest production approach is to let Mendix write logs to stdout (default) and have your OTel Collector (or Fluent Bit → Collector) scrape container logs and forward them to your backend.

  • Direct log shipping from Mendix via OTLP is possible but requires custom logging config and is more brittle.

answered