We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

What Is Observability?

Observability is the ability to understand what a system is doing, usually with logs, metrics, and traces. With good observability in place, you can quickly tell whether a system is healthy, and when it's not, identify the cause so you can fix it.

There are several primary tools that most professional teams use to achieve good observability in production:

  • Logs: Event records from your system. Each log usually includes a timestamp, a severity ("ERROR", "INFO", etc.), and a message.
  • Metrics: Aggregate measurements over time, like request count, error rate, and latency.
  • Traces: Per-request execution paths (often across services) that show where time is spent and where failures happen.
  • Alerts: Notifications sent when an important signal crosses a threshold (for example, an error-rate spike).

Assignment

Add basic lifecycle logs so Linko tells you when it starts and shuts down.

  1. Linko is running on http://localhost:%d
    

    If you need guidance getting the port number, check the Tips section.

  2. Linko is shutting down
    
  3. go run . 2>&1 | sh -c 'trap "" INT; tee linko.out.log'
    

There will be lessons, including this one, where the CLI tests intentionally trigger the Linko server to shut down. In that case, remember to restart it between running and submitting the tests.

Run and submit the CLI tests from the root of the Linko repo.

Tips

In start, ln is the listener returned by net.Listen. Since ln.Addr() returns a net.Addr interface, type assert it to *net.TCPAddr before reading its Port.