ediverse Explore the platform

Spotlight PEPPOL BIS Billing 3.0 The EU e-invoicing mandate is here — France Sept 2026, Belgium Jan 2026, Germany 2025.

Adapter (cloud-native)

Standardise what a container exposes outward — logs, metrics, health — so the native Kubernetes ecosystem can read it without touching the code.

Problem

A proprietary EDIFACT connector writes flat .txt logs to /var/log/edi/connector.log, exposes metrics via JMX on port 9999, and offers a /status endpoint returning a coloured HTML mini-page for ops. To integrate this service into a modern stack — Prometheus for metrics, Loki for logs, kubelet probes for health — all three interfaces must be adapted. Recompiling the binary is impossible (vendor gone).

Forces

  • Ecosystem standards are fixed. Prometheus expects /metrics as text name{label="value"} 42. OpenTelemetry expects structured JSON.
  • The application container is frozen. Changing output format is excluded — lost source or locked partner certification.
  • The adapter must be passive. No business transformation, no behaviour change — only technical interface translation.
  • Added latency must be negligible. A Prometheus scrape every 15s tolerates 50ms overhead, not 5s.

Solution

Attach an adapter sidecar in the Pod. It reads the proprietary format on input — file tail, JMX scrape, HTTP polling — and exposes on output the expected standardised format. Standard binaries exist: jmx_exporter (Java → Prometheus), fluent-bit (logs → JSON OTel), cloudwatch-agent. Otherwise a small Go or Python program suffices. The adapter is stateless; its sole role is interface translation.

┌──────────────────────────────────────────────────────────┐
│  Pod                                                     │
│ ┌─────────────────┐                ┌───────────────────┐ │
│ │ Legacy AS2      │                │ Adapter sidecar   │ │
│ │ connector       │ JMX :9999 ───▶ │ JMX → Prometheus  │ │
│ │ /var/log/edi/   │ ─────files───▶ │ tail → JSON OTel  │ │
│ │ /status custom  │ ─────HTTP────▶ │ /healthz standard │ │
│ └─────────────────┘                └─────────┬─────────┘ │
└──────────────────────────────────────────────│───────────┘
                                               ▼
                          Prometheus / Loki / kubelet probe

EDI implementation

Concrete case: legacy Java AS2 connector exposes JMX. Attach jmx_exporter as sidecar, configured via YAML to publish edi_messages_total, edi_mdn_pending, edi_partner_latency_seconds in Prometheus format on port 9091. The Kubernetes ServiceMonitor scrape collects metrics. Logs: the connector writes connector.log in plain text — a Fluent Bit sidecar with regex parser extracts partnerId, messageType, level, and emits structured JSON to Loki. Health: a small HTTP sidecar polls the custom /status URL every 5s, parses the HTML, returns 200 or 503 on /healthz exposed to the kubelet.

Anti-patterns

  • Adapter that transforms semantics. Renaming metrics to fit a dashboard: pollutes data. The adapter must preserve faithfully, not reinterpret.
  • Adapter that becomes a cache. If the adapter buffers and loses messages on crash, a new failure point appears. Preserve the exactly-once-or-not semantics of the source container.
  • Several adapters in competition. Log adapter + metric adapter + health adapter: sidecar stacking, inflated Pod cost. Consolidate when possible.
  • Sidecar — parent pattern.
  • Ambassador — outbound sibling; the adapter is more inbound/exposure.
  • Normalizer — the EIP cousin for message-level format normalisation.
  • Message Translator — translation at the business level.

Sources

  • Burns B., Oppenheimer D.Design Patterns for Container-based Distributed Systems, HotCloud 2016. Academic source of the cloud-native sidecar / ambassador / adapter trio. usenix.org — HotCloud 2016
  • Microsoft Architecture Center — Cloud Native patterns. learn.microsoft.com — Cloud Native
  • Prometheus — JMX Exporter. The reference Java → Prometheus adapter. github.com/prometheus/jmx_exporter
  • Fluent Bit — Log adapter. The open-source reference to adapt heterogeneous logs to standard formats. fluentbit.io
  • Gamma E., Helm R., Johnson R., Vlissides J.Design Patterns: Elements of Reusable Object-Oriented Software, Addison-Wesley 1994. The original (object-level) Adapter pattern, of which the cloud-native pattern is the container-scale analogue.