Find a failure and prove recovery

Use application state, logs, sensor freshness, and a repeatable check to debug a deployment.

Exercise brief·Intermediate·3 min read
Requirements and learning goals

Before you start

  • The hello-wendy Node project from the first three lessons
  • A known successful request or sensor observation

You will be able to

  • Distinguish build, startup, connectivity, and functional failures
  • Write a recovery check for a demo runbook

The project brief below assumes the listed prerequisites and gives you a task and checks to perform. Need a guided first project?

Observability means making an application explain what it is doing through logs, state, and measurements. It helps you tell whether a frozen dashboard comes from a dead sensor, a crashed app, or a network problem. Recovery means restoring the actual behavior, not merely restarting a process.

Debug the last boundary that worked. A build error, crashing process, unreachable endpoint, and stale camera feed require different checks.

For intermittent failures, pair logs with sensor recordings so you can inspect the input that caused the failure.

Return to hello-wendy if you tried the separate multi-service exercise. Deploy it using its existing build format and use its printed HTTP URL as the functional check.

Establish a baseline

Save one successful request or sensor observation. Then inspect the selected target:

wendy device info
wendy device apps list
wendy device logs --app YOUR_APP

Use the exact app name from the list. A stopped one-shot program may have completed successfully; a long-running server that repeatedly exits needs investigation.

Inject and repair one fault

In src/index.ts, temporarily change the counter path from /data/starts.txt to /missing-directory/starts.txt. Deploy and expect an ENOENT startup error. Save that error, restore /data/starts.txt, and redeploy. Check the HTTP response again and confirm the startup count increases.

Then rehearse stopping and restarting:

wendy device apps stop YOUR_APP
wendy device apps start YOUR_APP

Inspect state and application output after each operation. An acknowledgement establishes that a request was accepted, not that the full application recovered.

Checkpoint 1 of 2

You run wendy device apps stop YOUR_APP and then wendy device apps start YOUR_APP. Both are acknowledged. Which check shows the application actually recovered?

Commit to an answer. Every choice explains itself.

Make stale data visible

Track receipt age with a monotonic clock:

import time
last_received = time.monotonic()
def sample_is_fresh():
    return time.monotonic() - last_received < 1.0

Update the timestamp for each valid sample. Choose the timeout for your sensor rate. Receipt age detects silence; checking capture age also requires understanding the source clock.

Checkpoint 2 of 2

A source keeps delivering valid samples every 0.1 seconds, but each sample was captured several seconds before it arrived. What does sample_is_fresh() report?

Commit to an answer. Every choice explains itself.

Finish with a runbook containing target, app name, startup command, expected output, stop command, and recovery check. Optional extension: trigger a Wendy Data episode when a fault occurs.

Source: Application states and lifecycle.

Can you do each of these?

  • Distinguish build, startup, connectivity, and functional failures
  • Write a recovery check for a demo runbook

0 of 2 checkpoints solved. Try checkpoint 1

Previous: Split a robot application into services
All lessons in this topic
  1. 1. Discover a device and deploy your first app
  2. 2. Build with a Dockerfile or an optional Stagefile
  3. 3. Give an app hardware access and persistent storage
  4. 4. Split a robot application into services
  5. 5. Find a failure and prove recovery

Ask Wendy

Answers about Wendy and WendyOS

What would you like to know?

Ask about devices, development, and deployment.

Check linked docs for technical details.