Repository navigation
feat(telemetry): report the content-safety provider and categories (#1183) - #1187
Merged
Merged
Conversation
…1183) ContentSafetyBlocked gains .provider, a stable slug (azure-content-safety, bedrock-guardrails, google-model-armor, crowdstrike-aidr) carried in _CONTENT_SAFETY_VENDORS beside the display name. The refusal span gains donkey.policy.provider and donkey.policy.categories, emitted only for a violation that carries a provider, so a PII or budget refusal omits both. The names are generic so the federated-guardrail types (#313, #1177) reuse them. errors.py and telemetry.py stay at their ratchet ceilings: the growth is offset by reflowing docstrings and comments, with no wording dropped. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Oct 20, 2026
5 tasks
5 tasks
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.
Closes #1183
Summary
ContentSafetyBlocked.provideris a stable slug:azure-content-safety,bedrock-guardrails,google-model-armororcrowdstrike-aidr. The slug sits next to the display name in_CONTENT_SAFETY_VENDORS, andcontent_safety_reject()returns(provider, vendor, categories). The message text is unchanged.donkey.policy.provider(the slug) anddonkey.policy.categories(a string array of flagged categories). The constants areDONKEY_POLICY_PROVIDERandDONKEY_POLICY_CATEGORIESincore/telemetry.py, added to__all__.build_genai_attributestakes them aspolicy_providerandpolicy_categories._policy_detailintransport/policy.pykeys on the attribute, not the class. Any refusal that carriesproviderreports it, withcategorieswhen they're non-empty. When the federated-guardrail types (refusals: type the Akamai federated guardrail verdict #313, refusals: detect the F5 Guardrails block, which returns HTTP 200 #1177) set those two fields, they get the same span attributes with no transport change. A PII or budget refusal emits neither attribute.errors.py(1031) andtelemetry.py(630) stay at their ceilings. I offset the growth by rewrapping docstrings and comments to the 100-column limit, so no wording was dropped.telemetry.mdx(the attribute list plus a paragraph on grouping refusals by provider) anderrors.mdx, then regeneratedwebsite/public.Tests
reject.content-safety-*fixture (Azure, Bedrock, Model Armor, CrowdStrike AIDR):.providerand.categorieson the exception;DonkeyAsyncClient.donkey.policy.providerordonkey.policy.categories.PIIDetectedhas no.provider.build_genai_attributescovers the new keys and leaves them out when unset.nox -s typecheck-and-lint test-3.11 new-dependencies commit-identitiespasses locally.Follow-up
The live acceptance telemetry group asserts only
donkey.policy.type=content_safety. It still passes, and assertingdonkey.policy.providerlive is a small follow-up there.🤖 Generated with Claude Code