L
Logs in the Sky
Beam in Production

Adding Logs and Basic Observability to an AI Service

Adding Logs and Basic Observability to an AI Service
Add useful logs and basic observability to a Beam AI service with outcome checks, request context, small metric labels, privacy limits, and actionable alerts.

Before adding another dashboard, I want to answer three questions: did the request finish, how long did the caller wait, and was the output usable? My AI monitoring observability checklist starts with those outcomes, then adds enough context to explain a failure. Beam supplies platform records; the application still needs to describe its own work.

A green container does not establish a healthy AI service. It can remain alive while requests time out, structured outputs fail validation, or a model returns confidently wrong answers.

Start with the questions your service must answer

For a small extraction endpoint, I would make the initial monitoring agreement explicit. The following checklist describes coverage to verify, rather than features automatically enabled by deploying to Beam:

  • ☐ Count accepted requests, completed requests, errors, and timeouts.

  • ☐ Measure complete client-visible duration separately from handler duration.

  • ☐ Associate a failure with the application and model revision that served it.

  • ☐ Distinguish valid output structure from independently reviewed correctness.

  • ☐ Identify whether startup, queueing, inference, or an external dependency delayed work.

  • ☐ Give every alert an owner and a useful next investigation step.

If an item is missing, I would write down the blind spot before choosing a tool to fill it. This keeps AI observability focused on decisions. Collecting a metric because a dashboard supports it is less useful than collecting the evidence needed to explain a missed deadline.

For an asynchronous service, “accepted” and “completed” belong to different moments. I would monitor pending work and its age as well as submission success. An API can accept every job while the queue quietly stops draining.

Give logs, metrics, and traces different jobs

When someone asks what is AI observability, I explain it through those jobs. Metrics describe aggregate behavior over time, logs preserve individual events, and traces connect work across participating components. The OpenTelemetry primer provides the broader vocabulary; a small service can start with limited instrumentation and expand as its unanswered questions grow.

For the extraction endpoint, I would use a request identifier to find the relevant events, a latency distribution to see whether delays are widespread, and stage records to locate where a slow request waited. One isolated error line cannot establish a failure rate.

Beam’s logs and metrics documentation describes application, task, container, and system views. I would retain the deployment identifier when investigating a version-specific regression, rather than assume an application name always identifies one version.

These commands illustrate an investigation; my-api must be replaced with the actual application target:

beam logs my-api --since 30m --tail 200
beam logs my-api --source system
beam logs my-api --follow --timestamps

System records are useful when work fails before application code runs. The absence of a handler log could mean the handler was never reached, the record was filtered out, or collection failed. I would check those possibilities before concluding that nothing happened.

Person checking a phone beside stacked books in a home study with a laptop and server behind.

Add a small completion event before a large logging framework

I would make one structured event readable without the surrounding console text. Here is a standard-library helper for a synthetic service:

import json
from datetime import datetime, timezone

def emit_completion(request_id, model_revision, elapsed_ms,
                    output_valid, error_class=None):
    event = {
        "event": "inference_finished",
        "timestamp": datetime.now(timezone.utc).isoformat(),
        "request_id": request_id,
        "model_revision": model_revision,
        "handler_elapsed_ms": round(elapsed_ms, 3),
        "output_valid": output_valid,
        "error_class": error_class,
    }
    print(json.dumps(event), flush=True)

The caller supplies controlled identifiers, a measured duration, and a validation result. The helper deliberately does not accept the full prompt, response, or exception message. It writes JSON to standard output; it does not install a metrics exporter or create a distributed trace.

I would call it on both success and handled failure paths, using a sanitized error category. Failures before the process can emit anything still need platform evidence. A completion event alone also cannot reveal a hung request until another signal identifies work that never completed.

For that gap, I would preserve request acceptance and final outcome as separate states, joined by the same controlled identifier. A watchdog or pending-work query can then find operations that outlive the permitted window. The absence of a completion becomes something to investigate, rather than a success omitted from the denominator. I would account for cancellations and duplicate deliveries explicitly so the apparent unfinished count remains meaningful.

For shared application logging, Python’s logging cookbook offers patterns for adding context. I would configure logging deliberately instead of adding duplicate handlers every time a request arrives. The format can evolve; stable field meanings matter more than a particular library.

Keep aggregate labels small and request details searchable

A request identifier is useful in logs. Making every identifier a metric label creates a new time series for each request. Prometheus’s label guidance explains why unbounded dimensions are costly. I would aggregate by small, controlled categories and use logs or traces for individual identities.

My first service view would remain compact:

Question

Initial signal

Important boundary

Is work arriving and completing?

Request and completion counts

Separate logical requests from retry attempts

Is the deadline being missed?

Client duration and timeout count

Successful-only latency omits failed waits

Is capacity constrained?

Queue age and resource use

GPU occupancy does not establish useful work

Is output usable?

Validation failures and reviewed quality sample

Valid JSON does not prove correct content

I would document units and aggregation windows beside those signals. A resource average can hide a short spike. A percentile computed from buckets may have a different interpretation from a percentile over retained individual durations. Comparing them without reading their definitions can create a false regression.

For output quality, I would maintain a separate, approved evaluation process with reviewed labels or a clear acceptance rubric. Operational telemetry can point to suspicious changes, but it cannot certify factual correctness just because every request returned HTTP success.

For LLM observability specifically, I would add input and output token counts and relevant model-call boundaries. An ordinary classifier may not need those fields. Inference monitoring should describe the work the service actually performs.

Protect the evidence from becoming another data leak

Logging rule: collect the context needed to diagnose the operation, and decide deliberately which content must stay out.

For a transcript service, I would avoid recording raw conversations by default. Even a short exception can contain an input fragment, access token, or external service URL. I would review error formatting as carefully as the happy-path event.

Access and retention deserve explicit choices. Who can see request-level records? How long are they retained? Can a debugging export be shared without exposing private content? Those questions apply even when a provider handles storage, because the application chooses what enters the record.

If correlation requires an external identifier, I would prefer an opaque internal reference and keep any sensitive mapping in the appropriate protected system. Hashing a recognizable or low-entropy value is not automatically anonymization. I would not use a quick transformation as a substitute for a data-handling decision.

Alert on a symptom someone can act on

I would start alerts around a sustained deadline violation, a meaningful increase in failures, or pending work that stops progressing. Thresholds should follow the service’s actual requirements and traffic. A handful of requests needs different interpretation from a busy endpoint with a stable baseline.

An actionable alert should include the affected service, time window, deployment context, signal definition, and the first place to investigate. The notification should help someone distinguish an input problem from a deployment regression or dependency outage.

I would treat the telemetry path as a dependency too. If collection stops, a flat zero-error chart can look reassuring while providing no evidence. A recent-event timestamp or a controlled synthetic check helps distinguish no failures from no observations. Sampling and retention choices should be visible in the view, especially when someone tries to investigate an individual request that was never retained.

For a new release, I would compare like traffic windows and preserve the version boundary. An increase in long inputs can change latency even when code is unchanged; a new model revision can change validation failures without a resource spike. The monitoring should let me separate those explanations before I roll back or buy capacity. I would keep the initial view small enough that someone can make that comparison without opening ten unrelated dashboards.

Hand masking lines on a sample worksheet with a black marker before filing it.

I would test the monitoring with controlled synthetic failures: reject an invalid fixture, simulate a dependency error in a test environment, and verify that the expected event and aggregate count appear. The test should also confirm that sensitive strings remain absent from exported records.

I would postpone a full tracing rollout if one worker and one model call are already explainable with these signals. Add tracing when cross-service boundaries become the missing evidence. Before your next release, choose one failed synthetic request and verify that you can follow it from submission to its final recorded outcome.

Last revised · 2026-10-30 14:48
Letters
Readers Write

No letters yet — be the first to write.

Write a letter
© 2026 Logs in the Sky. Logs in the Sky