-
Notifications
You must be signed in to change notification settings - Fork 237
IPIP-513: Delegated Routing V1 returns 200 for empty results #513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🚀 Build Preview on IPFS ready
|
Changes HTTP Delegated Routing V1 API to improve empty result handling: - servers SHOULD return 200 instead of 404 for empty results - clients MUST handle both 200 and 404 for backward compatibility - improves semantic correctness (404 means "endpoint not found", not "no data") - prevents browser console errors that confuse users Follows robustness principle for maximum interoperability. Related to ipfs/boxo#1024
291a0fc
to
1d072cc
Compare
return HTTP 200 with empty results instead of 404 when no records found, while maintaining backward compatibility in clients to handle both response codes Fixes: #1024 Spec: ipfs/specs#513
This makes sense to me. I'll just flag briefly my (perhaps incorrect) historical recollection that in Reframe these responses were 200s, and the switch to 404s with routing-v1 was partially motivated by people being annoyed they couldn't just look at error codes in grafana to see the percentage of requests that had no providers. Seems like doing the thing that follows HTTP semantics is the thing to do though so 👍 |
@aschmahmann indeed, 404 are a lazy way of tracking "no results" that abuses HTTP semantics and creates more problems for down the stack. These days we have way better way of tracking success rate. We have histograms of response latency and results list length, but if that is too complex, I also added simpler counter of total/success in ipfs/boxo#1032. It shows you don't need 404 for visibility into this. |
* feat: implement IPIP-513 for routing v1 endpoints return HTTP 200 with empty results instead of 404 when no records found, while maintaining backward compatibility in clients to handle both response codes Fixes: #1024 Spec: ipfs/specs#513 * docs: add IPIP-513 changes to changelog * fix: correct off-by-one error in routing_http_client_length metric the metric now correctly reports: - 0 for empty results (instead of 1) - n for n results (instead of n+1) * feat: add metrics for IPNS operations - GetIPNS now records latency, status code, and length (0 or 1) - PutIPNS now records latency and status code - uses consistent pattern with httpReq.Host for host extraction * docs: explain histogram bucket interpretation for metrics - document how OpenCensus bucket selection works (value < boundary) - explain mapping to Prometheus le buckets for both latency and length - provide examples of how to extract meaningful data from metrics * feat: add simple counter metrics for requests and positive responses - routing_http_client_requests_total: counts all requests including errors - routing_http_client_positive_responses_total: counts requests with 1+ results - avoids confusing histogram bucket math for common queries - documented with simple Grafana query examples * fix: drain response body for connection reuse in 404 cases ensure http connection can be reused by draining response body before closing
Changes HTTP Delegated Routing V1 API to improve empty result handling:
Follows robustness principle for maximum interoperability (strict server, liberal and robust client).
Implementations: