-
Notifications
You must be signed in to change notification settings - Fork 758
add weave tracer #277
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?
add weave tracer #277
Conversation
|
Generally I don't think it's necessary to support non-OTLP path for advanced tracers. You can first check whether the store has OTLP capability within You can inject the rollout_id and attempt_id if you have control over |
tests/tracer/test_weave.py
Outdated
|
|
||
| async def add_span(self, span: Span) -> Span: | ||
| self.spans.append(span) | ||
| return span # 返回同类型 |
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.
remove chinese comment
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.
Removed.
pyrightconfig.json
Outdated
| "exclude": [ | ||
| "**/data", | ||
| "**/assets", | ||
| "agentlightning/tracer/weave.py" |
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.
weave.py should not be excluded in pyrightconfig full.
revert the file.
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.
reverted
agentlightning/tracer/weave.py
Outdated
| output = getattr(call, "output", {}) # type: ignore | ||
| attributes = sanitize(inputs, output) | ||
|
|
||
| def is_success(summary: dict) -> bool: |
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.
test this logic in unit-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.
removed, there was a bug here, change to read another var.
agentlightning/tracer/weave.py
Outdated
|
|
||
| if self._store and self._rollout_id and self._attempt_id: | ||
| try: | ||
| for span in spans: |
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.
there is an add_many_spans interface now.
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.
Cool, changed
| return self.spans | ||
|
|
||
|
|
||
| def _func_without_exception(): |
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.
The weave tests should at least cover a real @weave.op. Otherwise I'm not sure whether it will 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.
added
agentlightning/tracer/weave.py
Outdated
| self._loop_thread: Optional[threading.Thread] = None | ||
|
|
||
| def instrument(self, worker_id: int): | ||
| instrument_all() |
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 think I'll sunset instrument_all soon. Don't use _all(), instrument_weave() instead.
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.
changed
| weave_client.finish_call(trace_call) # type: ignore | ||
| await self._on_finish_handler(trace_call) # type: ignore | ||
|
|
||
| def shutdown(self) -> None: |
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 do we need the shutdown here?
No description provided.