CodeRigor

COURSE / REAL PRACTICE

Instrument a tiny service

Connect a running Go notes service to structured logs, server-owned request IDs, bounded counters and honest latency distributions.

Lessons & exercises7 authored lessons3 units
Start with the first lesson.

Read the explanation and diagrams, then work through the practice. Your browser profile supplies your saved progress.

What you’ll work toward

Add tested instrumentation to the working notes API, reproduce a fixture failure and connect an actual request to its emitted log, counter series and latency distribution. Run an owned loopback service with local telemetry and explicit cleanup.

Read an explanation, inspect the diagrams and work through the available checks, debugging exercises and builds. Feedback and prerequisite links guide the next step.

Before you start

This course builds on these skills:

Individual lessons can add prerequisites. Your lesson progress shows your actual readiness.

A look inside the first lesson

Define the telemetry contract and inject a clock

Go
package main
import ("fmt";"time")
func main(){
start:=time.Unix(0,0);for _,d:=range []time.Duration{0,999*time.Microsecond,12*time.Millisecond}{fmt.Println(start.Add(d).Sub(start).Milliseconds())}
}

Your lesson sequence

Follow the same units and lessons in either view. Prerequisite links and your practice progress stay with each lesson.

UNIT 013 lessons Timing, correlation and safe events
  1. LESSON 01.01

    Define the telemetry contract and inject a clock

    Measure whole elapsed milliseconds with a replaceable clock and distinguish a measured zero from invalid timing.

    Open lesson
  2. LESSON 01.02

    Carry a server-owned request ID through context

    Use a private context key, preserve cancellation and correlate one response without trusting incoming identity claims or creating metric labels.

    Open lesson
  3. LESSON 01.03

    Emit a structured event with an allowlist

    Serialize only approved bounded fields, omit sensitive source data and preserve null versus measured zero timing.

    Open lesson
UNIT 023 lessons Metrics and incident evidence
  1. LESSON 02.01

    Count requests with bounded labels and precise error semantics

    Aggregate normalized method/route/status classes, separate server statuses from aborted/write-error outcomes and prevent cardinality from growing with IDs.

    Open lesson
  2. LESSON 02.02

    Measure a distribution and report honest tail bounds

    Observe cumulative inclusive buckets, retain count/sum for weighted means and distinguish an empty or unbounded p95 from an exact quantile.

    Open lesson
  3. LESSON 02.03

    Connect an incident to emitted evidence

    Reconcile each log event with its counter series, identify a failing route and exemplar, and keep correlation distinct from a proven root cause.

    Open lesson
UNIT 031 lesson The instrumented service
  1. LESSON 03.01

    Instrument the actual handler and reproduce an incident

    Connect real handler execution to safe events, bounded counters and latency samples while preserving response/error/panic semantics.

    Open lesson