-
Notifications
You must be signed in to change notification settings - Fork 300
gen-ai: add security guardian (apply_guardrail) span + finding event #3233
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?
gen-ai: add security guardian (apply_guardrail) span + finding event #3233
Conversation
|
@nagkumar91 We have a similar use-case and when a security incident happens for a chat span we create a new span as a chat span and add an attributed called Here's the sample of how we add it as of now - https://github.com/signalfx/splunk-otel-python-contrib/tree/main/instrumentation-genai/opentelemetry-instrumentation-aidefense#trace-integration |
|
Also, it will be great if we can have another entry in the |
| `span.gen_ai.inference.client` or `span.gen_ai.execute_tool.internal`). | ||
| Multiple guardian spans MAY exist under a single operation span if multiple guardians are chained. | ||
| attributes: |
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.
Can we add an attribute called gen_ai.security.event_id?
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 event being proposed would be a gen_ai.security.finding
Apply guardrail span will have these for IDs:
- gen_ai.guardian.id
- gen_ai.security.target.id
- gen_ai.security.policy.id
Would any of those fit your need?
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.
Would this be better as an event (security finding event as proposed in this span)? Wondering why its a chat span?
Currently, the domain team is using event_id and it's as per their requirement. Also, in our case the event is generated elsewhere and not instrumentation side. We used chat span to use existing types in the genai-utils for now and manage span life cycle using it.
Would this be better as an event (security finding event as proposed in this span)? Wondering why its a chat span? |
Motivation
GenAI semantic conventions cover model, agent, and tool operations, but they don’t provide a vendor-neutral way to observe security guardian/
guardrail evaluations (allow/deny/modify decisions) and the specific security findings produced during those evaluations. This limits
auditability, incident investigation, and cross-provider correlation for systems using guardrails across different vendors and frameworks.
What this PR adds
apply_guardrailto thegen_ai.operation.nameenum for guardrail/guardian evaluations.gen_ai.guardian.*andgen_ai.security.*to describe:gen_ai.guardian.*)gen_ai.security.decision.*)gen_ai.security.target.*)gen_ai.security.risk.*,gen_ai.security.policy.*)gen_ai.security.content.*)gen_ai.security.risk.categoryis a free-formstringwith suggested values aligned with OWASP LLM Top 10 2025.span.gen_ai.apply_guardrail.internal(guardian evaluation).gen_ai.security.finding(individual findings under a guardian evaluation).docs/gen-ai/gen-ai-security.md(linked fromdocs/gen-ai/README.md).References
Prototypes / instrumentation links
Tests
make table-generation registry-generationmake markdown-tocmake SED=sed check-policies(macOS note: the repo defaults togsed)Changelog
This is user-facing (new conventions). Add a
.chloggen/*.yamlentry withcomponent: gen-ai, or apply the “Skip Changelog” label ifmaintainers agree it’s not required for this proposal stage.