A checkout trace looks healthy until it reaches the system that still settles the payment. The API gateway has spans. The Java service has spans. The queue producer has spans. Then the trail ends at a mainframe transaction name and a few log lines in another tool.
That is the mainframe observability problem for many modernization teams: the customer-facing path moved forward, but the system of record did not become easy to instrument. During an incident, the missing span is rarely an academic problem. It is the gap between “the modern service timed out” and “the legacy transaction stalled after it accepted the request.”
The fix is not to pretend every mainframe operation can become a first-class OpenTelemetry span. A workable pattern uses OpenTelemetry up to the boundary, preserves the identifiers that cross it, collects legacy logs and metrics, and models the unknown part of the trace honestly.
Why mainframe observability breaks modern traces
Mainframe observability is the practice of making mainframe-backed transactions debuggable with logs, metrics, traces, transaction IDs, and service context. In a modernization program, it usually means connecting the mainframe layer to the telemetry from the services around it.
That distinction matters. The reader’s job is not always to migrate COBOL, replace the runtime, or instrument every line of legacy code. The job is often narrower and more urgent: keep customer flows debuggable while the mainframe remains in the path.
A typical flow looks like this:
- A browser or mobile app calls a modern API.
- The API creates an OpenTelemetry trace.
- The service calls a queue, gateway, adapter, or batch handoff.
- The mainframe processes the business transaction.
- The response returns to the modern service, or a later batch result updates state.
The trace usually breaks between steps 3 and 4. Sometimes the legacy runtime cannot be changed. The team that owns it may not accept instrumentation changes. In other cases, the only supported output is a log file, queue record, job report, SMF feed, or vendor export.
If you treat that as a normal missing instrumentation task, you will overpromise. If you treat it as a correlation problem, you can still reduce incident time.
Where OpenTelemetry coverage stops
OpenTelemetry is excellent when you can instrument the process, use an auto-instrumentation agent, or propagate context through a supported carrier. It is not a magic adapter for every runtime in the enterprise.
The public OpenTelemetry language APIs and SDKs list supported language projects. COBOL is not listed there, and OpenTelemetry does not list an official COBOL SDK or auto-instrumentation path today. That does not mean mainframe tracing is impossible in general. It means OpenTelemetry-native instrumentation cannot be assumed at the COBOL layer.
A second limit is ownership. Even if a vendor tool can observe some mainframe activity, the platform team modernizing the customer-facing services may not control that tool, its agents, or the logging policy. They may only receive exported records.
The practical boundary is usually one of these:
| Boundary | What usually crosses | What often gets lost |
|---|---|---|
| Synchronous API adapter | Request ID, transaction name, status | Parent span context |
| Message queue | Message ID, business key, queue name | W3C traceparent header |
| Batch handoff | File name, batch ID, schedule time | Per-request causality |
| File exchange | File path, row key, transfer timestamp | Operation-level spans |
| Terminal or transaction gateway | Transaction code, user-safe key | Modern service context |
OpenTelemetry can still cover everything before that boundary. W3C Trace Context defines the traceparent and tracestate fields that keep a trace connected across systems that carry them. When the carrier cannot preserve those fields, you need another key and a clear model for the gap.
Map the legacy boundary before adding tools
Start with an inventory, not a Collector config. The goal is to find the smallest set of identifiers and timestamps that can connect the modern trace to the mainframe evidence.
For one high-value transaction path, write down:
- The modern service that first calls the legacy boundary.
- The exact handoff mechanism: API, MQ, batch, file, scheduler, or gateway.
- The transaction name or code used by the legacy side.
- The request, correlation, message, account, or batch ID that crosses the boundary.
- The log files, job records, or exported events that contain that ID.
- The clock source and timezone used by each layer.
- The service owner who can confirm the mapping during an incident.
Do this before deciding whether something is a span, log, metric, or annotation. A lot of bad tracing models come from forcing opaque work into spans just because the backend UI looks better with a waterfall.
A good boundary map answers two incident questions:
- Which modern span represents the call into the legacy system?
- Which log or transaction record proves what happened after that call?
If you cannot answer both, adding more telemetry will produce more records but not better debugging.
Bridge legacy backends with logs, gateways, and correlation IDs
The bridge pattern has three parts.
First, use OpenTelemetry until the point where it stops being true. Instrument the API gateway, application service, queue producer, adapter, or scheduler that calls the mainframe path. Make sure those spans include the operation name, peer system, transaction code, and the identifier that will appear in legacy evidence.
Second, collect the legacy evidence without pretending it is native trace data. If the mainframe layer emits logs, reports, job output, mirrored files, or vendor-exported events, bring those records into the same telemetry workflow. The record should keep the original timestamp and source, plus normalized attributes such as service.name, deployment.environment, transaction.id, and correlation.id.
Third, decide how the backend should show the relationship. When trace context crosses the boundary, continue the trace. If only a correlation ID crosses, link the logs and metrics to the boundary span through attributes and search. When only time and transaction code exist, say that in the runbook.
The rule is simple: do not manufacture precision. A span should represent an operation you can observe. A log should represent evidence you received. A metric should represent a measured count, duration, or state. An annotation can mark the handoff when the downstream operation remains opaque.
This is where OpenTelemetry context propagation and trace ID versus correlation ID become separate tools. A trace ID gives you causal structure when the downstream system participates in tracing. A correlation ID gives you a join key when it does not.
Collector patterns for legacy logs and service context
The OpenTelemetry Collector is useful at the boundary because it can receive, parse, enrich, and export telemetry without putting new code into the legacy system. In a mainframe path, it often sits as a gateway between exported logs and the observability backend.
The filelog receiver tails and parses logs from files. That makes it a fit when a legacy log stream is mirrored to a Linux host, object store mount, transfer directory, or intermediate collector node. The gateway deployment model is useful when many services share the same backend and you want one normalization point.
A minimal collector shape looks like this:
receivers: filelog/mainframe_payments: include: - /var/log/legacy/payments/*.log start_at: end operators: - type: regex_parser regex: '^(?P<ts>\S+) tx=(?P<transaction_id>\S+) corr=(?P<correlation_id>\S+) status=(?P<status>\S+) msg="(?P<message>.*)"$' timestamp: parse_from: attributes.ts layout: '%Y-%m-%dT%H:%M:%S%z'
processors: resource/mainframe_payments: attributes: - key: service.name action: upsert value: mainframe-payments - key: deployment.environment action: upsert value: production
exporters: otlphttp/observability_backend: endpoint: ${env:OTLP_ENDPOINT} headers: # Full header value, including the "Basic " prefix Authorization: ${env:OTLP_AUTH_HEADER}
service: pipelines: logs/mainframe_payments: receivers: [filelog/mainframe_payments] processors: [resource/mainframe_payments] exporters: [otlphttp/observability_backend]Treat this as a pattern, not a drop-in config. Your parser depends on the exported log format. For records that already have JSON fields, parse JSON instead of regex. If the file is batch-oriented, add batch job identifiers. Normalize local timestamps before responders use them next to traces.
Also decide where enrichment belongs. The Collector can set stable resource attributes. It should not become the only place that knows business semantics. Put the transaction-code mapping in versioned config or a small lookup table that service owners can review.
For Kubernetes-heavy teams, our guide to the OpenTelemetry filelog receiver covers the mechanics of file-based collection. The mainframe version uses the same receiver pattern with a different source and stricter correlation requirements.
How to model trace gaps without lying to yourself
A trace gap is not a failure if the model says what is unknown. It becomes a failure when the UI implies a complete waterfall while responders still need to grep another system.
Use a boundary span for the call you can observe. Name it after the operation at the edge, not the internal mainframe work you cannot see:
span.name = "mainframe.payment.authorize"span.kind = CLIENTpeer.service = "mainframe-payments"legacy.transaction = "PAYAUTH"correlation.id = "c-8d1f7a"transaction.id = "PAYAUTH-20261125-4412"Then attach what you know:
| Evidence | Better representation | Why |
|---|---|---|
| API call to adapter | Client span | You observe duration and status. |
| Queue publish | Producer span | You observe the handoff. |
| Mainframe log record | Log with correlation.id | You observe an emitted record, not a span. |
| Batch completion count | Metric | You observe aggregate state. |
| Uninstrumented internal work | Boundary annotation | You know the gap exists, not its internal shape. |
This approach also keeps alerting sane. When the boundary span duration increases, you know the modern caller waited longer. If a legacy log status changes, you know the downstream system reported a different result. When neither source appears, the failure may be at the handoff.
During an incident, the runbook should say which question each signal answers:
- Did the modern service send the request?
- Did the boundary accept it?
- Did the legacy log record appear?
- Did the transaction status change?
- Did the response return inside the caller timeout?
Those questions are better than a fake trace. They turn the unknown segment into a bounded investigation.
Where Last9 fits, and where it does not
Last9 supports metrics, logs, and traces through OpenTelemetry, so the pattern above can land in one place when your services and collectors export over OTLP. Our OpenTelemetry integration docs cover sending metrics, logs, and traces, and the logs and traces docs cover how those signals are explored after ingestion.
The useful Last9 role in this pattern is correlation and ingest-time cleanup, not magic mainframe instrumentation. The Control Plane drops, remaps, redacts, forwards, and aggregates telemetry at ingest, before storage. It also previews every rule against live data before you save it. That matters when legacy logs carry inconsistent attribute names or fields that should not be stored as-is.
For example, you can normalize corr, correlationId, and correlation_id into one attribute before responders search across services. If a legacy log stream carries more than an incident workflow should expose, you can drop or remap those fields at ingestion, and redact supported PII types such as email addresses, phone numbers, and card numbers in logs.
The limit is just as important: Last9 does not claim native mainframe tracing. If you need deep runtime-level mainframe instrumentation, evaluate tools built for that environment. If your problem is that modern OpenTelemetry traces stop at the mainframe boundary, Last9 can help you keep the surrounding traces, logs, and metrics correlated without pretending the opaque layer is fully instrumented.
Rollout checklist for mainframe observability
Start with one transaction path that matters to customers. A broad “observe the mainframe” project will stall because every boundary has different owners, data formats, and risk.
Use this checklist for the first path:
- Choose the transaction. Pick a user-visible flow with a known mainframe dependency.
- Find the boundary span. Instrument or verify the modern service that calls the legacy layer.
- Pick the join key. Prefer
traceparentif it survives. If not, use a correlation ID, transaction ID, message ID, or batch ID. - Collect the legacy evidence. Mirror or export the log, job, or event stream that contains the join key.
- Normalize attributes. Standardize
service.name, environment, transaction, and correlation fields before storage. - Write the incident query. Document the trace search and log search side by side.
- Test with a known transaction. Trigger a low-risk request and prove the modern span and legacy record meet in the backend.
- Define success. Aim for faster handoff and fewer blind escalations, not perfect traces.
A good first milestone is modest: a responder can start from a modern trace, find the boundary span, copy the correlation ID, and see the matching legacy log or transaction status without leaving the incident workflow. Once that works, expand to more transaction codes and better metrics.
Mainframe observability is not about making the old system look cloud-native. It is about making the handoff explicit enough that modern teams can debug customer impact while the legacy layer still does the work.
FAQ
What is mainframe observability?
Mainframe observability is the practice of making mainframe-backed transactions debuggable with logs, metrics, traces, transaction IDs, and service context. In modernization projects, it often means correlating mainframe logs and events with OpenTelemetry traces from the surrounding services, not replacing the mainframe runtime.
Can OpenTelemetry trace COBOL programs directly?
OpenTelemetry does not list an official COBOL API, SDK, or auto-instrumentation path today. You can still use OpenTelemetry around the mainframe boundary, then correlate mainframe logs, transaction IDs, queue messages, or exported events with the trace that reached that boundary.
How do you connect mainframe logs to distributed traces?
Pick the identifier that survives the handoff, such as a correlation ID, transaction ID, customer-safe request key, or batch job ID. Parse that value from the legacy log stream, normalize it in the Collector or gateway, and attach it to logs and boundary spans so responders can search both sides of the transaction.
Should legacy backend work be modeled as spans or logs?
Use spans when you own the code path or can observe a real operation boundary. Use logs and metrics when the mainframe remains opaque. A boundary span can mark the call into the legacy system, while logs and metrics explain what happened after the trace context stopped.
