-
Notifications
You must be signed in to change notification settings - Fork 64
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
chore: add derived summary fields #2213
Conversation
Preview this PR with FeatureBee: https://beta.wandb.ai/?betaVersion=3731fb7246cc78bcbd91deb3b3d6eeaba3fdbb21 |
6cd0a28
to
8f29990
Compare
@@ -45,7 +45,7 @@ class LLMCostSchema(LLMUsageSchema): | |||
|
|||
class WeaveSummarySchema(ExtraKeysTypedDict, total=False): | |||
status: Optional[Literal["success", "error", "running"]] | |||
nice_trace_name: Optional[str] | |||
trace_name: Optional[str] | |||
latency: Optional[int] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you comment what fidelity latency is? It is an int, so i am hoping it is at least ms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the past, i have favored using a suffix like latency_[UNIT]
to make this very clear
@@ -105,7 +116,7 @@ def test_trace_server_call_start_and_end(client): | |||
start = tsi.StartedCallSchemaForInsert( | |||
project_id=client._project_id(), | |||
id=call_id, | |||
op_name="test_name", | |||
op_name="weave:///test_entity/test_project/op/test_name:test", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: it should very much be allowed for op_name to NOT be a ref - does that still work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, removing this change to make that explicit.
started_at_dt = _make_datetime_from_any(call_dict["started_at"]) | ||
ended_at_dt = _make_datetime_from_any(call_dict.get("ended_at")) | ||
|
||
status = "success" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
recommend that you use constants over magic strings
weave_summary["latency"] = latency | ||
|
||
summary["weave"] = weave_summary | ||
return cast(tsi.SummaryMap, summary) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of casting, can you directly construct this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't seem to construct this while keeping mypy happy, because while we control the weave
key in the summary, there are also arbitrary user controlled keys. tsi.SummaryMap
allows this (with some special pydantic foo) but mypy doesn't know that...
def _make_datetime_from_any( | ||
dt: Optional[Union[str, datetime.datetime]], | ||
) -> Optional[datetime.datetime]: | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we dealing with two different formats here? under what conditions are they different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ripped this out
2fdd502
to
24a6dc3
Compare
FeedbackQueryRes, | ||
Query, | ||
) | ||
from weave.trace_server import trace_server_interface as tsi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe just add SummaryMap and TraceStatus
https://wandb.atlassian.net/browse/WB-20561
Add derived fields to the summary under the
weave
key, immediately after db read.When a call is running, the derived fields will look like:
When completed: