Open
Conversation
…ctions Add ERROR and LOG span kinds to the SDK, each available as: - Decorators: @error / @log for wrapping functions - Standalone functions: agentops.error() / agentops.log() for one-shot events Changes: - Add ERROR and LOG to AgentOpsSpanKindValues enum and SpanKind class - Create error/log decorators via create_entity_decorator factory - Add agentops.error(name, message) standalone function (sets error status) - Add agentops.log(name, message, level) standalone function - Add 14 unit tests covering decorators, standalone functions, and attributes Closes AgentOps-AI#1025, closes AgentOps-AI#1024
This was referenced Mar 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📥 Pull Request
📘 Description
Add
ERRORandLOGspan kinds to the SDK, addressing both #1025 and #1024.Each span kind is available in two forms:
Decorators — wrap functions to trace them as error/log spans:
Standalone functions — create one-shot event spans:
Changes:
agentops/semconv/span_kinds.py: AddERRORandLOGtoAgentOpsSpanKindValuesenum andSpanKindclassagentops/sdk/decorators/__init__.py: Createerror/logdecorators viacreate_entity_decoratorfactoryagentops/__init__.py: Add standaloneerror()andlog()functions using_create_as_current_span, update exports🧪 Testing
Added 14 unit tests in
tests/unit/sdk/test_error_log_spans.pycovering:error(): span creation, error status code, extra attributes, default namelog(): span creation, log level, default INFO level, extra attributes, default nameAll 164 tests pass (including existing tests). Ruff lint clean.