Add privacy-minimized OpenTelemetry events - #37
Conversation
|
Warning Review limit reached
Next review available in: 50 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Summary by CodeRabbit
WalkthroughThe package adds bounded ordered audit fan-out and an optional OpenTelemetry sink for metadata-only decision events. It also adds pinned integration validation, a no-network demo, public exports, and documentation for configuration, privacy, failure behavior, and release checks. ChangesAudit and OpenTelemetry integration
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant ToolGate
participant OpenTelemetryDecisionEventSink
participant CurrentSpan
participant Exporter
ToolGate->>OpenTelemetryDecisionEventSink: deliver AuditRecord
OpenTelemetryDecisionEventSink->>CurrentSpan: add decision event
CurrentSpan->>Exporter: export span when tracing shuts down
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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: 4
🤖 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 `@RELEASING.md`:
- Around line 34-41: Update the release validation steps so the OpenAI Agents
and OpenTelemetry contracts run in separate environments, each installing
requirements-dev.lock with only its corresponding optional lock. Keep each
integration’s pytest and demo commands in its matching environment, rather than
installing both optional lock graphs together.
In `@SECURITY.md`:
- Around line 44-50: Update the OpenTelemetry metadata statement in SECURITY.md
to clarify that the sink emits versioned event attributes derived from
AuditRecord, along with the event version and record version attributes.
Preserve the surrounding ownership, export, and durability guidance.
In `@src/samsarix_ethics/otel.py`:
- Around line 19-20: Update OpenTelemetryIntegrationError to inherit from
AuditLogError instead of SamsarixEthicsError, preserving its existing diagnostic
messages through _deliver_audit_record() and the ToolGate execution paths.
In `@tests/test_otel.py`:
- Around line 105-133: Add an assertion in
test_opentelemetry_sink_validates_dependency_and_api_shape using monkeypatched
import_module returning SimpleNamespace() without get_current_span, then
construct OpenTelemetryDecisionEventSink and assert
OpenTelemetryIntegrationError with the existing \[opentelemetry\]
install-guidance match. Keep the existing missing-import and non-callable API
cases unchanged.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: dc2de88f-57e5-4e23-a533-5e097c52d4e2
⛔ Files ignored due to path filters (1)
requirements-opentelemetry.lockis excluded by!**/*.lock
📒 Files selected for processing (21)
.github/workflows/ci.ymlCHANGELOG.mdCONTRIBUTING.mdREADME.mdRELEASING.mdROADMAP.mdSECURITY.mddocs/ADOPTION.mddocs/API.mddocs/ARCHITECTURE.mddocs/OPENTELEMETRY.mddocs/PRODUCTIZATION.mdexamples/opentelemetry_decision_event_demo.pyintegration_tests/test_opentelemetry_sdk.pypyproject.tomlrequirements-opentelemetry.txtsrc/samsarix_ethics/__init__.pysrc/samsarix_ethics/audit.pysrc/samsarix_ethics/otel.pytests/test_otel.pytests/test_public_api.py
What changed
OpenTelemetryDecisionEventSinkthat emits a versionedsamsarix.policy.decisionevent on the current recording spanCompositeAuditSinkfanout for pairing durable audit storage with trace correlationWhy
Operators need to correlate policy outcomes with existing agent and request traces without turning authorization telemetry into a second copy of sensitive tool payloads. The base package remains dependency-free, while applications opt into the API and continue to own their SDK/exporter configuration.
Impact
samsarix-agent-ethics[opentelemetry]Validation