Quick revision
The short answer
The standard should make metrics and traces the default for every outbound call, produced by Micrometer Observation with method, host, status, outcome and duration, instead of a log line per call. Logs are written at WARN or ERROR for failures with the trace id, INFO only for a few important business calls, and all of it goes through a shared library that redacts sensitive headers and query parameters. Body logging is forbidden in production unless approved and sampled, and logs that may hold personal data get defined retention and access control.
What to remember
In this answer, we defined a standard for outbound HTTP telemetry. Every call produces a Micrometer observation, which becomes a timer and a span with method, host, URI template, status, outcome and duration. Logs are only for failures at WARN or ERROR with the trace id, plus a few named business events at INFO. Redaction of headers and query parameters lives in a shared starter so it is fixed once for everyone, body logging is off in production except for approved, sampled windows, and logs that may hold personal data have short retention and controlled access.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
The standard should make metrics and traces the default for every outbound call, produced by Micrometer Observation with method, host, status, outcome and duration, instead of a log line per call. Logs are written at WARN or ERROR for failures with the trace id, INFO only for a few important business calls, and all of it goes through a shared library that redacts sensitive headers and query parameters. Body logging is forbidden in production unless approved and sampled, and logs that may hold personal data get defined retention and access control.
Why this question is asked
With 100 services, outbound HTTP calls are where most incidents start: a slow dependency, a partner returning 503, a token that expired. If each team logs calls its own way, one service floods the log system with every request, another logs nothing, and a third writes bearer tokens into files that the whole company can search. Interviewers ask this design question to see whether we can turn good habits into a standard that is cheap to follow, safe by default and useful during an incident. In this answer, we will separate the three kinds of telemetry, define what every call produces, set the logging rules, design redaction, decide on body logging, cover retention, and finish with how to roll it out across 100 services.
1A Quick Recap of Metrics, Traces and Logs
Telemetry is the data a service emits about itself. It comes in three forms, and each answers a different question. Metrics are numbers aggregated over time, such as "calls to the payments host per second, split by status". They are cheap because 10,000 calls produce the same few counters as 10 calls. Traces follow one request across services: each outbound call becomes a span, a timed record with a start, an end and a parent, so we can see that a checkout took 3 seconds because one call to the tax service took 2.8. Logs are individual text or structured events, best for details that only matter in rare cases.
Micrometer Observation is the API Spring uses to produce the first two from one piece of instrumentation. An observation wraps an operation such as an HTTP call; Micrometer turns it into a timer metric and, when tracing is on, into a span. Spring Boot already instruments RestClient, WebClient and RestTemplate when they are built from the auto-configured builders, producing the http.client.requests metric.
2What Every Outbound Call Produces
The heart of the standard is that every call is measured, and almost no call is logged. Each outbound call records an observation tagged with the HTTP method, the target host or client name, the URI template, the status code, the outcome (SUCCESS, CLIENT_ERROR, SERVER_ERROR and so on) and the duration. The same call creates a client span and propagates the trace context to the next service in the W3C traceparent header, so the trace continues downstream.
Notice the URI template. The tag must be /orders/{id}, not /orders/48213, because every distinct tag value creates a separate time series. A raw URL with ids would create millions of series and break the metrics backend. That is one of the reasons the standard requires building clients from the shared builders: they record the template automatically, while a client built by hand records nothing or the raw URL.
| Signal | When | Contents |
|---|---|---|
| Metric (timer) | Every call | method, host, uri template, status, outcome, duration |
| Trace span | Every call (sampled export) | same tags, parent span, traceparent propagated |
| Log at WARN or ERROR | Failures, retries exhausted, timeouts | trace id, host, uri template, status, duration |
| Log at INFO | Named business calls only | e.g. payment captured, no payloads |
| Body log | Never in production by default | approved, sampled, time-limited exception |
With this in place, dashboards and alerts come for free: error rate and p99 latency per dependency, for every service, with the same names everywhere. That consistency is worth more than any single clever dashboard, because an on-call engineer can read any team's service the same way.
3Logging Rules: Levels and Correlation
Logs are kept for what metrics cannot say. A failed call, a timeout or a retry that finally gave up is logged at WARN, or ERROR when the failure reaches the user, with the trace id, the host, the URI template, the status and the duration. The trace id is the important part: it lets anyone jump from a log line to the full trace and to the logs of every other service involved. Spring Boot with Micrometer Tracing puts traceId and spanId into the logging MDC, the per-thread context that log patterns can print, so the standard only has to require that the shared log pattern includes them.
INFO is reserved for a short, named list of important business calls, such as "payment captured" or "order sent to warehouse", where support staff need a durable record. Successful routine calls are never logged one by one. A service making 2,000 calls a second would otherwise write 170 million lines a day that nobody reads, and pay to store them.
4Redaction in a Shared Library
Rules written in a wiki are not followed by 100 teams. So the standard ships as a small internal library, a Spring Boot starter, that customises the RestClient and WebClient builders. It registers the observation conventions, the log format for failures and, most importantly, the redaction.
Redaction means replacing sensitive values before anything is written. The library has a deny list of headers (Authorization, Proxy-Authorization, Cookie, Set-Cookie, X-Api-Key and any header ending in -Token) and of query parameter names (token, access_token, api_key, password, signature). Their values become [REDACTED]. Teams can add names, but they cannot remove the defaults. The library also never puts full URLs with query strings into metric tags or span names, which closes the other common leak.
The reason the library matters more than the rules is upgrades. When security finds a new leak, for example a partner that puts a signature in a header we did not know, we fix it once in the starter and every service gets the fix with its next dependency bump.
5Body Logging, Retention and Access
Request and response bodies are where personal data lives, so the default is simple: no body logging in production. When a team genuinely needs it, for example to debug a partner integration, they get an approved exception that is sampled (say 1 in 1,000 calls), limited to one client, time-boxed to a few days and passes through field-level masking. The approval is recorded, so we know which logs may contain personal data.
Logs that might contain personal data need rules of their own. The standard sets retention, for example 30 days for application logs and 7 days for any approved body logs, and restricts who can search them through access control in the log platform, with access itself logged. Metrics and traces, which by construction hold no payloads, can be kept longer. This split is what lets us answer a data protection officer's question "where could a customer's address end up?" with a short, true answer.
6Rolling It Out Across 100 Services
A standard only exists when services follow it. We start by building the starter with a few teams that own busy services, prove it on their dashboards, and then make it part of the company's service template so new services get it by default. For existing services we track adoption: the metrics backend can show which services emit http.client.requests with the expected tags, and a simple scan can find RestTemplate or WebClient instances built without the shared builder. We publish that as a list per team rather than as a mandate, and review it quarterly.
- Service codeuses
RestClientor WebClient from the builders - Shared starterobservations, redaction, failure log format
- Micrometer Observationtimers and spans from one instrumentation
- Backendsmetrics store, trace store, log platform with retention
4 layers, from the top down. Step through them one at a time.
Teams write only the top layer; everything below is shared.
7Follow-up questions
Why not just log every call at INFO and build dashboards from logs?
Because it is expensive and fragile. Logs cost storage per line, while a metric costs the same whether we make 10 calls or 10 million. Parsing log text into dashboards breaks when someone changes a message, and every log line is another place where a token or personal data can leak. Metrics and traces give the same answers with fixed cost and no payloads.
How do you stop high-cardinality tags from breaking the metrics backend?
Tag with the URI template, never the expanded URL, and keep the host or a client name rather than full URLs. The shared builder records the template when the call is written as uri("/orders/{id}", id); calls that build the string by hand lose the template, so the starter can add a meter filter that caps distinct uri values per client and maps the rest to a constant like UNKNOWN.
What do you do when a team says it must log bodies to debug a partner?
We grant a time-boxed, sampled exception in a non-production environment first. If it must be production, the interceptor logs only selected, masked fields at a low sample rate, to a log index with short retention and restricted access, and the exception expires automatically. The goal is to answer the debugging question, not to keep a copy of the traffic.
8Conclusion
In this answer, we defined a standard for outbound HTTP telemetry. Every call produces a Micrometer observation, which becomes a timer and a span with method, host, URI template, status, outcome and duration. Logs are only for failures at WARN or ERROR with the trace id, plus a few named business events at INFO. Redaction of headers and query parameters lives in a shared starter so it is fixed once for everyone, body logging is off in production except for approved, sampled windows, and logs that may hold personal data have short retention and controlled access.
Open with
I would make metrics and traces the default and logs the exception. Every outbound call goes through RestClient or WebClient built from the auto-configured builders, so Micrometer Observation records a timer and a span tagged with method, host, the URI template rather than the raw URL, status, outcome and duration, and the traceparent header carries the trace downstream.
Then, if they want more
That gives every team the same dependency dashboards and alerts for free. Logging is for what metrics cannot tell: failures, timeouts and exhausted retries at WARN or ERROR, always with the trace id from the MDC so we can jump to the trace.
INFO is only for a short list of important business calls like a payment capture, never for routine successful calls. All of this ships as a shared starter, because a wiki page is not followed by 100 teams.
The starter redacts a fixed list of headers such as Authorization, Cookie and API keys, and query parameters like access_token, and teams can add to the list but not remove from it. Body logging is forbidden in production unless it is approved, sampled, limited to one client and time-boxed.
Finally, logs that might contain personal data get short retention and access control in the log platform, and I would track adoption per service rather than just announce the rule.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Framework reference, Spring Web MVC
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Define a standard for outbound HTTP logging and telemetry across 100 services.": https://scrivio-interview-library.netlify.app/spring-boot/http-clients/81d4b6709c/