fix(metrics): handle new Metric types in set_metrics and HTTPValidationError string detail#554
Draft
AnkushMalaker wants to merge 2 commits into
Draft
fix(metrics): handle new Metric types in set_metrics and HTTPValidationError string detail#554AnkushMalaker wants to merge 2 commits into
AnkushMalaker wants to merge 2 commits into
Conversation
…l in HTTPValidationError - Add isinstance check for galileo.metric.Metric in create_metric_configs so LogStream.set_metrics() works with objects from Metric.get() - Guard HTTPValidationError.from_dict against string detail from GalileoServerException (was iterating characters as dicts) - Handle HTTPValidationError response in CodeMetric.create() with proper error message (same pattern as jobs.py and experiments.py) sc-62865
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #554 +/- ##
==========================================
- Coverage 82.55% 82.52% -0.03%
==========================================
Files 119 119
Lines 10041 10049 +8
==========================================
+ Hits 8289 8293 +4
- Misses 1752 1756 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Summary
LogStream.set_metrics()crashes withMetric.get()objects:create_metric_configscheckedisinstanceagainst the legacygalileo.schema.metrics.Metric, butMetric.get()returnsgalileo.metric.Metricsubclasses (LlmMetric,CodeMetric). Added a check for the new type, routing by.idwhen available.HTTPValidationError.from_dictcrashes on stringdetail: The API returns{"detail": "some string"}fromGalileoServerException, but the parser iterateddetailassuming it was a list of dicts — iterating characters instead. Added a guard for string detail.CodeMetric.create()doesn't handleHTTPValidationErrorresponse: Addedisinstancecheck and raisesValidationErrorwith a formatted message (same pattern asjobs.pyandexperiments.py).Fixes sc-62865
Test plan
LogStream.set_metrics([Metric.get(name="Conciseness")])no longer raisesValueErrorCodeMetric(name="existing_name", ...).create()raisesValidationError("already exists")instead of crashingGenerated description
Below is a concise technical summary of the changes proposed in this PR:
Update
create_metric_configsused byLogStream.set_metricsto recognize newgalileo.metric.Metricsubclasses and route requests byidor name/version. NormalizeHTTPValidationErrorparsing andCodeMetric.createerror handling so stringdetailpayloads becomeValidationErrors with formatted messages.HTTPValidationError.from_dictagainst stringdetailpayloads and haveCodeMetric.createraise formattedValidationErrors when the API responds with validation errors.Modified files (2)
Latest Contributors(2)
LogStream.set_metricsroutes by supportinggalileo.metric.Metricinstances increate_metric_configs, routing via.idwhen present and falling back to name/version searches.Modified files (1)
Latest Contributors(2)