fix(models): default HardwareUsage fields to 0 to tolerate partial server responses#1164
fix(models): default HardwareUsage fields to 0 to tolerate partial server responses#1164s-zx wants to merge 1 commit intoqdrant:masterfrom
Conversation
…rver responses When QDRANT__SERVICE__HARDWARE_REPORTING=true is set, the server starts returning hardware usage statistics in API responses. Different qdrant server versions may include different subsets of these counter fields (e.g. payload_index_io_read / payload_index_io_write were added later). Because all HardwareUsage fields were marked required (Field(...)), any server that omits even one field triggers a Pydantic ValidationError: Field required [type=missing] for payload_index_io_read / io_read / … Changing every field to Field(default=0) preserves semantics (these are unsigned counters; 0 is the natural absent-value) while making the client resilient to both older and newer server versions regardless of which subset of metrics the server chooses to report.
✅ Deploy Preview for poetic-froyo-8baba7 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis change modifies the Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This chage should be done in qdrant core, as proposed changes are targetting autogenerated code. Also hardware reporting is an expetimental undocumented feature, not expected to be used in production |
|
@generall Understood — makes sense to fix this in qdrant core since the client models are autogenerated. Happy to close this PR and open the issue upstream if that would be helpful, or defer to your team to handle it in the next codegen cycle. |
Problem
When
QDRANT__SERVICE__HARDWARE_REPORTING=trueis set and any API call is made (e.g.upsert), the server includes hardware usage statistics in the response. Because different qdrant server versions may not include all usage fields, the Python client raises aValidationError:All seven fields in
HardwareUsagewere declared withField(...)(required), so any server that omits even one field (e.g. an older server that doesn't yet reportpayload_index_io_read/payload_index_io_write, or a future server that adds new aggregate fields) causes a crash.Fix
Change all
HardwareUsagefield declarations fromField(...)(required) toField(default=0). These are unsigned hardware counters;0is the natural value when a counter is absent or not applicable. This makes the client robust to both older and newer server versions regardless of which subset of metrics the server reports.Testing
Closes #935