-
Notifications
You must be signed in to change notification settings - Fork 794
datadog example #406
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?
datadog example #406
Conversation
| self.span_start_time: float = 0.0 | ||
| print(f"[DataDogTracer] Initialized for service: {service}") | ||
|
|
||
| def start_span(self, name: str, **attributes) -> Any: |
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.
Who is responsible for calling this method?
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.
Agent-Lightning's Runner calls this automatically.
The call flow is:
- Runner.step() begins → calls tracer.start_span()
- Agent executes and calls agl.emit_reward()→ triggers tracer.add_event()
- Runner.step()` completes → calls tracer.end_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.
The runner doesn't call those methods automatically as far as I can remember.
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.
youre right - the tracer methods aren't called automatically by Runner.
Looking at the existing examples (apo, calc_x, etc.), I see the pattern now:
The tracer is passed to LitAgentRunner and used within runner.run_context(). The Runner manages the tracer lifecycle during runner.step() calls.
Let me revise the DataDog example to follow the correct pattern shown in apo_debug.py and calc_agent.py
‘’’
runner = agl.LitAgentRunner(DataDogTracer())
with runner.run_context(agent=my_agent, store=store):
await runner.step(task, resources=resources)
‘’’
|
revised the example acc to changes mentioned |
|
I'm not sure I understood why and how this tracer works since it didn't even implement the core abstract methods of tracer. Could you show some proof (screenshots or whatever) to prove it works in action? |
As discussed on PR #358 and PR #353 :
Add DataDog integration example
Shows how to plug Agent-Lightning into DataDog APM for production monitoring.
What it does: