Repository navigation
feat: add agentkit observability core - #188
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR introduces a provider-neutral observability infrastructure for agentkit. It defines immutable domain models for observations, a pluggable sink protocol for recording, a ChangesObservability Infrastructure
Sequence Diagram(s)sequenceDiagram
participant Code as Business Logic
participant RecordSpan as record_span Context
participant ActiveSpan as ActiveSpan
participant Sink as ObservationSink
Code->>RecordSpan: enter context (with name, attributes)
RecordSpan->>RecordSpan: start timer
RecordSpan->>ActiveSpan: create with name, copied attributes
RecordSpan->>Code: yield ActiveSpan
Code->>ActiveSpan: set_attribute(key, value)
Code->>RecordSpan: success or exception
alt Success
RecordSpan->>RecordSpan: compute duration_ms
RecordSpan->>RecordSpan: create SpanRecord(status="ok")
else Exception
RecordSpan->>RecordSpan: capture error_type, error_message (truncated)
RecordSpan->>RecordSpan: create SpanRecord(status="error")
end
RecordSpan->>Sink: record_span(SpanRecord)
Sink->>Sink: record or drop
RecordSpan->>Code: re-raise if exception
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@coding-agent/src/agentkit/observability/spans.py`:
- Around line 29-32: The bare except in the try/except around
sink.record_span(span) is intentional (fail-open for observability) but raises
ruff BLE001; update the except clause in spans.py to include an inline comment
"noqa: BLE001" and a short note like "intentional bare except to prevent sink
failures from impacting business logic" so the warning is suppressed and the
intent is documented (target the try/except that calls sink.record_span(span)).
In `@coding-agent/tests/agentkit/observability/test_core.py`:
- Line 78: The pytest.raises call uses a normal string for the regex pattern;
update the call to pass a raw string literal for the match parameter (replace
match="x+" with match=r"x+"), i.e., edit the pytest.raises(...) expression so
the regex is written as r"x+" to satisfy RUF043 and ensure the pattern is
interpreted correctly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 82b6b7b1-4ff2-4bba-a821-a8e004c6d2c5
📒 Files selected for processing (5)
coding-agent/src/agentkit/observability/__init__.pycoding-agent/src/agentkit/observability/models.pycoding-agent/src/agentkit/observability/sinks.pycoding-agent/src/agentkit/observability/spans.pycoding-agent/tests/agentkit/observability/test_core.py
abb6d2c to
c67ade5
Compare
Summary
Verification
Summary by CodeRabbit