Skip to content

Conversation

@acured
Copy link
Collaborator

@acured acured commented Nov 5, 2025

No description provided.

@acured acured marked this pull request as ready for review November 20, 2025 07:10
@acured acured requested a review from ultmaster November 20, 2025 07:10
@ultmaster
Copy link
Contributor

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 init_worker(), which is added in a PR merged yesterday. If the store has such capability, you can use initialize the tracer so that it writes to the store.

You can inject the rollout_id and attempt_id if you have control over get_tracer(), or you can use the augmented OTLP exporter to modify the traces when export.

@acured acured marked this pull request as draft November 21, 2025 09:58
@acured acured marked this pull request as ready for review November 27, 2025 08:58

async def add_span(self, span: Span) -> Span:
self.spans.append(span)
return span # 返回同类型
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove chinese comment

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

"exclude": [
"**/data",
"**/assets",
"agentlightning/tracer/weave.py"
Copy link
Contributor

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted

output = getattr(call, "output", {}) # type: ignore
attributes = sanitize(inputs, output)

def is_success(summary: dict) -> bool:
Copy link
Contributor

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

Copy link
Collaborator Author

@acured acured Dec 5, 2025

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.


if self._store and self._rollout_id and self._attempt_id:
try:
for span in spans:
Copy link
Contributor

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.

Copy link
Collaborator Author

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():
Copy link
Contributor

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

self._loop_thread: Optional[threading.Thread] = None

def instrument(self, worker_id: int):
instrument_all()
Copy link
Contributor

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.

Copy link
Collaborator Author

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:
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants