Observability for LLM Applications

Teaching kit

From Edition 2026.11.2, the book's current edition. It changes when the book does. Use and adapt it freely, with credit to the book.

Syllabus

Reading times are for the chapter's text. Students also run its examples, in the Lab or on their own machine.

A chapter a week: 12 weeks

In 5 weeks

Objectives and outlines

Each chapter's objectives are its first sentence. Each outline follows the chapter's sections, with the terms it defines, the predictions it asks for before an example runs, and the rule each section ends on.

1. Trace a request, then ask where its time went

About 17 minutes to read, 6 examples.

By the end, students can build one message's trace by hand, print it as a tree, and say where its time and tokens went.

Lecture outline: 7 sections
  1. One message, one trace
    • Working rule Make one trace for each user message, with a root that covers the message's whole time and one span for each step its work went through. A trace that covers a run of several messages, or only some of the steps, cannot answer a question about one message, and a log line that lacks the trace ID cannot be joined to the others.
  2. Replay and the virtual clock
    • Run replay-one-message.py
    • Working rule Let the recording move the clock, and never add a step's time by hand. Put an assertion beside the clock that checks its movement against the steps, so that a step which drops its time fails its run and does not reach a reader as a short total.
  3. Spans by hand
    • Run build-one-trace.py
    • Working rule In a replay, end every span with an explicit end time from the replay's clock. In live code, let the SDK take both times from the machine's clock. Either way, check each trace for its root, exactly one span with no parent, because a trace without one is what a crash leaves, and it reads as a few short steps, not as a failure.
  4. The tree of one trace
    • Run print-trace-tree.py
    • Run figure-dev-day-waterfall.py
    • Working rule Print a trace as a tree of parent links, and check that its children neither overlap nor leave gaps before you add their times. When they do, report the parent's time and the children's separately.
  5. Where the time went in twenty messages
    • Run sum-dev-day-steps.py
    • Run figure-dev-day-step-shares.py
    • Working rule Sum each step's recorded time and tokens over the messages, and print each share beside its denominator. Name any step whose time is not recorded and leave it out of the shares, so that a reader can see which part of the day the sums do not cover.
  6. What this version does not do yet
  7. The decisions this chapter made
    • Working rule Answer a question about one message from that message's trace alone. Every span of the message shares the trace ID, and the root covers its whole time, so the trace holds that message's steps and no other message's. A span or log line without the ID cannot be placed in the answer, so leave it out and say so, rather than guess which message it belongs to. A guess would put one message's time into another message's total.

2. Name spans the way the standard does

About 18 minutes to read, 5 examples.

By the end, students can give each span in the assistant's traces the name, the kind and the attributes that OpenTelemetry's GenAI conventions expect for its step.

Lecture outline: 8 sections
  1. The standard at a Development version
    • Working rule Pin the conventions' version beside every name you publish. A dashboard built on a Development name needs a check that runs when the name changes.
  2. Span types for each step
    • Run inference-span-names.py
    • Working rule Name each span from its registry pattern, not from the function that made it, and take the operation name from the registry's well-known values. Where the registry gives no value for something you run, use the value the client and its official instrumentation would write, and say that it's a judgement.
  3. The span kind follows the process
    • Run span-kinds-by-process.py
    • Working rule Give a model span CLIENT when the call goes to a server, even one on the same machine. Give it INTERNAL only when the model runs in your process and the span names no server, and let the validator check each kind you set.
  4. Which attributes a span must carry
    • Working rule Read a span's requirement levels before you read its name. A missing required attribute is a defect in the span. A missing conditionally required attribute is a defect only when its condition holds, so read the condition in the registry before you file it.
  5. Who made the span
    • Run resource-and-schema.py
    • Working rule Set service.name and service.version on the resource yourself, and give service.instance.id a value unique to the instance, as the production section explains. Then give the tracer the schema URL of the core release your conventions depend on, from the registry's manifest and not from the SDK's constants, which can lag behind the conventions. Pin the GenAI conventions' version beside the validator, because at v0.1.0 they have no schema URL to stamp.
  6. Validating against the registry
  7. Name spans in production
    • Working rule Run the validator in the pipeline that exports your spans, and fail the build on a finding. Pin the conventions' version beside the check, and read the changelog before you raise it.
  8. What this chapter decided

3. Let the client library instrument the calls

About 18 minutes to read, 5 examples.

By the end, students can read what the official OpenAI instrumentation writes for one chat call, say which of its names differ from the GenAI conventions version 0.1.0 that this book follows, and name the variable that decides whether prompts and replies are recorded, with its default.

Lecture outline: 8 sections
  1. A call through the client
    • Run instrumented-chat-call.py
    • Working rule Wrap the client once, at start-up, and make your own spans only for work the library cannot see, such as the message's root, its tool calls and its fallback reply. When no package wraps a client, or the one that does writes names the table can't map, make the call's span by hand, as chapter 1 did. Then check the call's parent in a test, as the script does, because the parent is what places the call in its message's trace.
  2. What the package emits
    • Working rule Count a package's spans and its instruments in a test, and read each name, unit and point count from its output. Do not assert a value from an instrument whose timer your tests do not control, because the count holds on every run and the value does not.
  3. Hand-made spans against the instrumented ones
    • Run diff-hand-and-instrumented.py
    • Working rule Keep one table of the names a package emits, generated from its output and checked against the registry, and read the package's data through it. A query for a name the table lacks should fail in the test, as the book's examples fail, and not return nothing in production. Regenerate the table when the package's version changes, not when a chart goes quiet.
  4. Three packages called openai
    • Run three-openai-packages.py
    • Working rule Read each instrumentation package's content switch and its default from that package's own source or documentation at the version you pin, and not from the spec alone. The defaults differ between packages, so a service that adds a second package changes what its telemetry can hold.
  5. The capture switch
    • Run capture-switch-names.py
    • Working rule Set a package's content variable by the name its own source reads, at the version you pin, and check the setting in a test that asserts the span holds content exactly when the variable names a mode that records it. Leave content capture off in any service that has not named a purpose for it, and read the default of every package the service loads.
  6. Two other naming schemes
    • Run openinference-mapping.py
    • Working rule Map each scheme's names onto the registry's once, in a table in code, and fail the run for any name the table does not hold, as the mapping example above does. Choose one scheme for a service's spans before the first span is sent, and keep the names of the others out of its traces.
  7. What goes wrong in production
  8. The decisions this chapter made
    • Working rule Pin the instrumentation package at its exact version, generate its name table from its own output, and read its content switch from its source at that version before you trust the content a span holds. A package that changes its names or its defaults changes what your traces hold, and its version and its scopes' schema URL are the signals you get that it has.

4. Follow a request across processes

About 19 minutes to read, 7 examples.

By the end, students can make a span that another team's server writes join the trace of the message that caused it, check that it has joined, and find the spans that have not.

Lecture outline: 8 sections
  1. The contacts server is another process
    • Run server-span-without-context.py
    • Working rule Give each server process its own tracer provider and exporter, and read its span file only after the process has exited. The server uses SimpleSpanProcessor, which hands each span to the exporter when the span ends, so a file read after exit holds every span the server made. A BatchSpanProcessor keeps spans in a queue until a flush or a shutdown, so with one, the file is complete only after one of those.
  2. The MCP SDK writes traceparent into _meta
    • Run propagate-into-the-tool.py
    • Working rule With an OpenTelemetry tracer provider configured, let the MCP SDK write traceparent, and never put traceparent, tracestate or baggage into _meta by hand. The SDK replaces a hand-written traceparent, but a hand-written tracestate or baggage survives beside the SDK's, so the server reads a value the SDK did not make. Write the header yourself only in code that runs without the SDK, and there the server reads it as written.
  3. The server span joins the trace
    • Run server-span-joins.py
    • Run figure-cross-process-tree.py
    • Working rule After any call that crosses a process, check that each server span names a client span from the caller's trace as its parent, and count the links that cross. A link count of zero on a call you expected to cross means the header did not reach the server, so look at the request before you look at the server.
  4. Context is lost at a thread boundary
    • Run orphan-span-demo.py
    • Working rule Wrap every function that a thread, a thread pool or run_in_executor runs in carry(), and start asyncio tasks with new_task(), so each one starts from a copy of the caller's context. A span that finds no parent raises no error and changes no status, so the context has to be carried at every hand-off.
  5. What goes in baggage
    • Run baggage-keys.py
    • Working rule Put a value in baggage only when a process downstream needs it to label its own spans, and only under a key on the allowed list. A value that identifies a person stays out, however short or harmless it looks in one message.
  6. A timeout is raised, not returned
    • Run contacts-timeout-live.py
    • Working rule Record each attempt of a call as its own span, with its own status and error type, and never let one error span stand for a call whose earlier attempts also failed. Read the error type from the exception the caller receives, and read the code from the error the client raises.
  7. What goes wrong in production
    • Working rule Run the cross-process link count and the detached-root and orphan counts after any change to tool or worker code, and on every release. Treat a change in any of them as a broken join until someone has explained it.
  8. The decisions this chapter made

5. Send traces to a backend you can run

About 18 minutes to read, 5 examples.

By the end, students can send the spans of both processes to one receiver that you run on one machine, check that it stores the rows the exporter sent, query those rows with SQL, and say what each named backend accepts and what its page does not say.

Lecture outline: 7 sections
  1. The exporter sends each span over OTLP
    • Run otlp-export-loopback.py
    • Working rule Give each process the endpoint of its receiver, and send production spans with the batch processor that chapter 1 recommends, so the request is not made on the thread that ends the span. In production we recommend that processor, because its export runs on its own schedule and not on the thread that ends a span. The trade is the one chapter 1 named: spans still in its queue are lost if the process dies.
  2. The book's receiver holds both processes' spans
    • Run two-processes-one-receiver.py
    • Run query-stored-spans.py
    • Working rule Send every process's spans to one receiver, and check the join, the detached roots and the orphan count before you read a query over one process. Leave the contacts startup span out of the detached-root count by its name. If no server span sits under an assistant span, or any orphan is stored, the halves did not join or a span was lost, and the other queries cannot yet be trusted. For a team, we recommend one receiver for every process, because a trace split over two stores cannot be read whole; the trade is one more place to run and keep.
  3. MLflow on SQLite takes the same spans
    • Run mlflow-search-traces.py
    • Run same-spans-two-receivers.py
    • Working rule Give each backend its own exporter, and check its stored span IDs and attributes against the exporter's before you trust its queries. Set the experiment header on the OTLP exporter, search with locations, decode the span IDs, and read the trace's total from its metadata. In production we recommend a backend that keeps its rows on disk and is checked against the exporter, because a query is only as good as the rows it reads. The cost is one more service to run and keep.
  4. What the other backends say
    • Working rule When a backend says it reads the OpenTelemetry names, find out which names it maps, at what version, and on what date, before a team relies on the claim. When the page gives no version or date, say so beside the claim.
  5. Changing the backend
    • Working rule Set the endpoint and headers on the exporter, and leave the span code alone, so that changing a backend is a settings change. Add a Collector when a rule has to see whole traces or change data before it leaves, and not before. A small setup can do without one. We add no Collector until a rule needs whole traces, because a Collector is one more hop to run and keep working, and the book pays that cost only when a rule needs it.
  6. What goes wrong in production
    • Working rule In production, keep the batch processor, make sure each server flushes before it exits, and read the exporter's log for dropped batches. Do not rely on the application to report a loss, because the exporter does not raise one to it.
  7. What this chapter decided

6. Attribute tokens and cost to each step

About 22 minutes to read, 8 examples.

By the end, students can split a day's model calls into input tokens, cached input tokens and output tokens, total them without counting any token twice, and say which step, route and user the money went to.

Lecture outline: 9 sections
  1. Three counts for each call
    • Run token-counts-per-step.py
    • Working rule Report a call's input as the whole prompt, cached part included, and report cached input beside it, never added to it. Give output on its own. Name the count's source beside any token total, because the same text takes a different number of tokens in a different vocabulary.
  2. Summing spans double counts
    • Run totals-metric-against-spans.py
    • Working rule Take a day's token total from the counters, or sum usage over inference spans only, filtered by operation name. Usage on an agent span is that agent's total over its calls, so never add it to the calls' usage. In production we read totals from the counters, because a sampler cannot thin them.
  3. Cached input, derived from the counters
    • Run cached-tokens-from-replay.py
    • Working rule Derive cached input at each call from the runtime's counters, never from a release's label. When a release changes the cache, we compare cost on the same messages, because the input count will not move.
  4. The same utterances in other languages
    • Run count-locales-with-the-tokenizer.py
    • Working rule Count each locale with the tokenizer that serves it, after the same normalisation, and name the counter beside every figure. Budget input in the locale's own tokens, and measure the locale's ratio on your own traffic before you rely on a multiple.
  5. The price table
    • Run price-one-request.py
    • Working rule Attach a price table's version and its date to every money figure. Price each call at its own timestamp, and name the provider when you use a listing. Never take a provider from a span to choose the price. We key the book's table by model, and never by the span's provider.
  6. Cost by route and step
    • Run cost-by-route-and-user.py
    • Run figure-route-token-mix.py
    • Working rule Attribute each call's cost to its step, route and user from each call's recorded counts, print each share beside its total, and name the denominator of every per-unit rate. Read a route's rate with its message count beside it, because a route with a handful of messages can move a lot from one day to the next. For the finance question we report each route's rate, not one mean over the day, because the money differs by route.
  7. The expensive tail
    • Run expensive-tail-share.py
    • Working rule Report the top 1% of messages as a count and as a share of the day's total, with the day named. Do not call a share small or large until a second day gives something to compare it with.
  8. What goes wrong in production
    • Working rule Keep totals on the counters, cost on the table with its version, and each locale's count on its own tokenizer. When a release changes the prompt or the cache, read its cost next to its tokens, because the two can move apart.
  9. What this chapter decided

7. Find where the latency comes from

About 22 minutes to read, 9 examples.

By the end, students can say which step sets a message's time, at the median and in the tail, and print each number with its count and an interval around it.

Lecture outline: 9 sections
  1. The critical path sets the end time
    • Run critical-path-one-message.py
    • Working rule Walk the critical path before you tune a trace, and change only the spans on it. Read the path's share of the message time first. A low share means the spans you have do not explain the time, and the rest belongs to no span. A replay's path always covers its message, so a replay cannot tell you which of two overlapping calls matters.
  2. Time to first chunk
    • Run time-to-first-chunk-by-route.py
    • Working rule Print time to first chunk beside the total time of the same call, and read the two together. An early first chunk means the user sees output early. It does not mean the call was cheap. Compare routes on their intervals and on the share, and do not name a route's first chunk from a handful of messages.
  3. Prefill against generation
    • Run prefill-generation-split.py
    • Working rule Split a model call's time into prefill and generation before you change its prompt or its reply length. Take the split from the counters, on the same machine and the same calls, and read it beside the total. When prefill is most of the time to first chunk, the prompt is where the wait is. When generation is most of the call, the reply's length is.
  4. Retrieved context against prefill
    • Run context-against-prefill.py
    • Working rule Measure a prompt's extra prefill on the same messages as the release it changes, and read tokens evaluated beside input tokens. Input tokens say how large the prompt is. Tokens evaluated say how much work the model did, and when a prefix is cached the two counts part company. Act on the work.
  5. Tail percentiles with intervals
    • Ask first Predict before you run it. How many messages does a route need before its 95th percentile is anything but its slowest message?
    • Run percentiles-by-route.py
    • Run figure-latency-tail-by-route.py
    • Working rule Print each percentile with its count and its interval, and rank two routes only when their intervals do not overlap. Collect more messages before you name a tail.
  6. Histogram buckets and what they hide
    • Run bucket-edges-hide-tail.py
    • Run figure-bucket-hides-tail.py
    • Working rule Set bucket edges from the question you will ask, and put an edge near each threshold you alert on. When a percentile falls inside a wide bucket, report the bucket and its count rather than an estimate to the millisecond, and keep the raw values whenever you can. An estimate from buckets is one rule applied to one set of edges, and it moves when the edges move.
  7. Queueing on recorded service times
    • Run queue-on-service-times.py
    • Working rule Read a queue at the load you expect and at a higher one before you accept a tail or add capacity. Use recorded service times when you have them, label every number the simulation computes, and check the simulation against a formula only where the formula's assumptions hold.
  8. What goes wrong in production
    • Working rule Before you publish a latency number from production, print its count and its interval beside it, and say which kind of time it is: a span's time, a bucket's estimate, or a replay's sum. When the path's share or the bucket's edges are unknown, state that with the number instead of letting the number stand alone.
  9. The decisions this chapter made

8. Find the step that failed

About 22 minutes to read, 7 examples.

By the end, students can find which step of a message failed, how often, and why, and print each count with the rows it came from.

Lecture outline: 9 sections
  1. How a span records failure
    • Run error-status-by-step.py
    • Working rule Count failures by span status, and print each error.type beside its count. A span with no error.type is still an error, so never filter on the attribute to find failures. Keep real and injected counts in separate rows, and label each injected row where it appears.
  2. Replies cut at the cap
    • Run truncated-replies.py
    • Working rule Count the length finish reasons for each step on every release, before you call its replies complete, and print the cap beside the count. A zero on one recording says nothing about another. Read a cut reply as a quality finding, and never file it as an error.
  3. Tool calls that do not parse
    • Run malformed-tool-calls.py
    • Working rule Parse every reply that could carry a tool call, and count malformed replies with the parser's own count, never with a finish reason. Print the replies that carry a call beside that count, so a reader can see how small a sample of tool use it is.
  4. Retries under a timeout
    • Run retries-under-incident.py
    • Working rule Count a failed attempt as a failure even when the call later succeeds, and name its window before you count it as injected.
  5. MCP errors
    • Working rule Count a failed operation once, on the span the caller made, and read the server's span beside it for the cause. With the MCP SDK at this version, expect the client's span to stay unset for an error result, though the conventions ask for tool_error; count by the caller's attempt either way.
  6. Wrong routes against the labels
    • Run wrong-routes-by-label.py
    • Run figure-failure-modes-by-route.py
    • Working rule Check each route against the scenario table on the trace, count fallback replies to other scenarios apart from the other wrong routes, and print every rate with its interval. Compare two releases only on the same messages, and name any suffix or prompt change beside the comparison.
  7. Querying each failure mode
    • Run failure-modes-query.py
    • Working rule Write one query for each failure mode, name the attribute or event it reads, and run it on a day that has the mode before you trust its zero. A query on an attribute that no span carries returns zero on every day, and that zero is a bug in the query, not a rate.
  8. Failures in production
    • Working rule Before you publish a failure rate from production, print its count, the window it covers, and how many of its failures recovered. Name the error type for each kind of failure, and say which kinds carry no type at all. When the number is what users saw, count by message outcome, as chapter 9's objective does.
  9. What this chapter decided

9. Set alerts on the assistant's metrics

About 21 minutes to read, 8 examples.

By the end, students can set two alerts on a service's metrics, test each one on a normal day and on an incident day, and say what each one misses.

Lecture outline: 8 sections
  1. The metrics the assistant exports
    • Run assistant-metrics-export.py
    • Working rule Take an alert's counts from the meter, which records each operation as it ends. Assert once, in a test, that the meter's sums equal the spans' sums, and after that query the metric every time the alert runs.
  2. Cardinality
    • Key terms cardinality
    • Run cardinality-of-attributes.py
    • Working rule Label a metric only with values from a set you can list before launch. Count the series with each candidate attribute on a day of real traffic, and reject any attribute whose count grows with the users.
  3. Service-level objectives
    • Key terms objective, error budget, burn rate
    • Run slo-and-budget.py
    • Working rule Set each objective from the numbers of a normal day, and check that the normal day meets it before any alert reads it. Print the objective's error rule beside its count, so a reader can tell it from chapter 8's span rule.
  4. Burn rate
    • Run burn-rate-by-window.py
    • Run tool-attempts-by-window.py
    • Working rule Compute each window's burn from the counts inside that window, and print the count beside each burn. A reader who sees 0.0 needs to know whether it means no failures among many messages, or no messages at all.
  5. One page on the incident day, none on a quiet one
  6. Test the same alert on a quiet day
    • Run alert-quiet-on-baseline-day-two.py
    • Working rule Test an alert on two days, one that must page and one that must not, and print the ticks it could not read beside the verdicts it gave.
  7. Where a burn-rate alert goes blind
    • Working rule Recompute the burn on your own traffic before the first page, and set the minimum from the messages an hour actually holds on your service.
  8. What this chapter decided

10. Catch a regression in the traces

About 21 minutes to read, 7 examples.

By the end, students can say whether a release moved a number, by how much, and whether that move is bigger than the day's noise.

Lecture outline: 7 sections
  1. Release markers in the spans
    • Run release-markers-query.py
    • Working rule Mark every trace with its release and its prompt version, and split each query by both before you read a number.
  2. Paired comparison on messages
  3. Prompt versions
    • Working rule Read a release's prompt version with the prompt's differences beside it. Say beside any model comparison whether the prompt changed as well.
  4. The CI gate
  5. Gating the other changes
  6. What the gate misses
    • Working rule Name in each gate's report what it does not read, beside its verdict, so a pass is not taken for a clean release.
  7. The decisions this chapter made
    • Working rule Read a difference only with its interval beside it, on the same messages, and with the gate's blind spots printed beside its verdict.

11. Choose which traces to keep

About 18 minutes to read, 6 examples.

By the end, students can choose which traces a backend keeps, say what each choice drops, and scale a total from the traces it kept, with an interval around the result.

Lecture outline: 7 sections
  1. Head sampling decides before the trace runs
    • Run head-sample-ratio.py
    • Working rule Pick a head ratio only for traffic whose rare cases you can afford to lose. Run the ratio sampler at the root only, under ParentBased, and leave every other service on the default sampler or another parent-based one. The trace SDK specification recommends the ratio sampler "only for root spans", since different SDKs, and different versions of one SDK, can give inconsistent results for the same input. Print the kept share beside its count, as the example does, and never read the share as a count.
  2. Children follow the root's decision
    • Run parent-based-follows-root.py
    • Working rule Sample at the root only, and leave every other service on the default sampler or another parent-based one. Two halves of one trace survive apart when another service runs its own ratio, algorithm or SDK version, since two identical samplers at one ratio agree. We would not give a server its own ratio.
  3. Tail sampling reads the whole trace
    • Ask first Predict how many of those messages the head sample keeps: all of them, about a tenth of them, or none.
    • Run tail-rule-keeps-errors.py
    • Run tail-rule-span-budget.py
    • Working rule Keep errors first, and set the budget above the spans they take on a day you have measured, not from a guess. Count the messages that are costly but neither erroneous nor slow before you trust a cost class, and say what a smaller budget would drop.
  4. Estimate the day's totals from a sample
    • Run estimate-totals-error.py
    • Run figure-sampling-error-by-ratio.py
    • Working rule Scale only the traces the head ratio kept, by the inverse of its ratio, print the interval beside the estimate, and check the estimate against the counter total for the same day when one exists. Use a sampled estimate only for a split that the counters cannot make, and never for a total the counters already hold.
  5. What a kept trace costs to hold
    • Working rule Measure bytes per message on your own export, without content and then with any content you plan to keep, before you set a period. Keep the period beside the bytes it multiplies, and name what the bytes leave out.
  6. Where sampling goes wrong in production
    • Working rule Judge a rule by what it keeps on the days that went wrong, not on a quiet day, and read each threshold again after a release that changes what it measures.
  7. The decisions this chapter made
    • Working rule Before you copy a sampling setting, run its example on a day you have recorded yourself, and keep each setting with the example that tests it.

12. Keep private data out of telemetry

About 25 minutes to read, 7 examples.

By the end, students can keep personal data out of the assistant's telemetry by default, turn content capture on for a stated purpose and count what that leaks, and say which leaks redaction can remove and which it cannot reach.

Lecture outline: 10 sections
  1. Capture off comes first
    • Run capture-modes.py
    • Working rule Keep content capture off in every service, and read the default of each loaded package before you deploy it. Turn capture on only for a purpose you can name, and only where a redactor runs on every span before the backend keeps it.
  2. What leaks when capture is on
    • Run leak-with-capture-on.py
    • Run content-bytes-per-message.py
    • Working rule Measure a message's bytes with content on, as well as with it off, before you choose a retention period. Count the bytes against the export the period will keep, and do not assume that a limit leaves a readable value.
  3. Stack traces leak without capture
    • Working rule Treat a stack trace as sensitive in every service, and keep it out of any backend. Remove it where every service's spans pass. At the source, ask the team that owns the server to set record_exception=False on the span and to set the exception's class and message by hand, since the client's traces can only be removed downstream.
  4. Redaction is defence in depth
    • Run scan-after-redaction.py
    • Working rule Run redaction in every process, so that it covers what that process writes, and run it again where every service's spans pass, so that it covers what the other processes write. Count the items after both. A non-zero count of a synthetic kind is a failure, and a non-zero count of a personal-looking value is the redactor's reach.
  5. Keyed user pseudonyms
    • Run redact-and-hash.py
    • Working rule Key every pseudonym with a secret that the telemetry's readers never hold, and keep the key outside the code. Change the key only with a plan, since a new key starts every user's pseudonym again, and the traces made before the change no longer join the ones made after it.
  6. Keep content by reference
    • Run content-by-reference.py
    • Working rule Do not turn on the upload hook as a way to keep content out of spans. Turn it on only with a store that has its own access and retention rules, and check the store as carefully as the spans, including the spans that sampling drops. Where spans pass, rewrite a reference's machine path, or use a store address that holds no machine path.
  7. Count what redaction leaves
    • Run figure-personal-items-before-after.py
    • Working rule Assert zero only for the kinds the redactor is built to remove, and print every other kind as a measure. A count the redactor cannot reach is a fact to report, and it does not count against the check that passed.
  8. Who may read what is left
    • Working rule Before you turn capture on, write down who may read the raw content, for what purpose and until when. Give every other reader the redacted rows, and apply the same rule to the content store.
  9. Keeping private data out in production
    • Working rule After each release, run the scan on a day of traffic, and treat any kind that counts above zero after redaction as a finding until someone can say why it may remain. Count the stack traces and the items in the same scan, so that a new source of either shows up in one report.
  10. The decisions this chapter made

Quiz bank

Questions on every chapter, with answer keys, for verified educators. Each answer is tied to its section. How to get them