feat(consts): Add updated span convention constants to SPANDATA#6093
Open
ericapisani wants to merge 1 commit intomasterfrom
Open
feat(consts): Add updated span convention constants to SPANDATA#6093ericapisani wants to merge 1 commit intomasterfrom
ericapisani wants to merge 1 commit intomasterfrom
Conversation
Align sentry_sdk.consts.SPANDATA with the current Sentry conventions at https://getsentry.github.io/sentry-conventions/attributes/. Upstream has deprecated a number of attribute names that the SDK still exposes as the canonical constants, and several replacement attributes had no constant at all. Mark the following existing constants as deprecated and add their replacements: - code.filepath -> code.file.path - code.function -> code.function.name - code.lineno -> code.line.number - code.namespace -> code.function.name (consolidated) - db.name -> db.namespace - db.operation -> db.operation.name - db.system -> db.system.name - http.method -> http.request.method - gen_ai.request.available_tools -> gen_ai.tool.definitions - gen_ai.request.messages -> gen_ai.input.messages - gen_ai.response.text -> gen_ai.output.messages - gen_ai.response.tool_calls -> gen_ai.output.messages - gen_ai.system -> gen_ai.provider.name - gen_ai.tool.input -> gen_ai.tool.call.arguments - gen_ai.tool.output -> gen_ai.tool.call.result Existing string values are preserved so current emitters are unaffected. Integration call sites can migrate to the new constants in follow-up work. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Contributor
Codecov Results 📊✅ 12 passed | Total: 12 | Pass Rate: 100% | Execution Time: 2.21s All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 14336 uncovered lines. Files with missing lines (1)
Generated by Codecov Action |
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.
Summary
Aligns
sentry_sdk.consts.SPANDATAwith the current Sentry conventions athttps://getsentry.github.io/sentry-conventions/attributes/. Several
attribute names the SDK exposed as the canonical constants have been
deprecated upstream, and several active replacements had no SDK constant.
Changes are purely additive:
.. deprecated::docstring note (matching the existingAI_*pattern) to 15 existing
SPANDATAconstants, naming the replacement.descriptions/examples grounded in the conventions page.
and consumers are unaffected.
Deprecation + replacement map
CODE_FILEPATHcode.filepathCODE_FILE_PATHcode.file.pathCODE_FUNCTIONcode.functionCODE_FUNCTION_NAMEcode.function.nameCODE_LINENOcode.linenoCODE_LINE_NUMBERcode.line.numberCODE_NAMESPACEcode.namespaceCODE_FUNCTION_NAME(consolidated)code.function.nameDB_NAMEdb.nameDB_NAMESPACEdb.namespaceDB_OPERATIONdb.operationDB_OPERATION_NAMEdb.operation.nameDB_SYSTEMdb.systemDB_SYSTEM_NAMEdb.system.nameHTTP_METHODhttp.methodHTTP_REQUEST_METHODhttp.request.methodGEN_AI_REQUEST_AVAILABLE_TOOLSgen_ai.request.available_toolsGEN_AI_TOOL_DEFINITIONSgen_ai.tool.definitionsGEN_AI_REQUEST_MESSAGESgen_ai.request.messagesGEN_AI_INPUT_MESSAGESgen_ai.input.messagesGEN_AI_RESPONSE_TEXTgen_ai.response.textGEN_AI_OUTPUT_MESSAGESgen_ai.output.messagesGEN_AI_RESPONSE_TOOL_CALLSgen_ai.response.tool_callsGEN_AI_OUTPUT_MESSAGESgen_ai.output.messagesGEN_AI_SYSTEMgen_ai.systemGEN_AI_PROVIDER_NAMEgen_ai.provider.nameGEN_AI_TOOL_INPUTgen_ai.tool.inputGEN_AI_TOOL_CALL_ARGUMENTSgen_ai.tool.call.argumentsGEN_AI_TOOL_OUTPUTgen_ai.tool.outputGEN_AI_TOOL_CALL_RESULTgen_ai.tool.call.resultFollow-up (not in this PR)
Integration call sites still reference the deprecated constants; migrating
emitters to the new ones is scoped for follow-up PRs.
CODE_NAMESPACEinparticular is a non-1:1 rename (the namespace should be merged into the
function name string at the producer side).
Test plan
tox -e ruffpassestox -e mypypassesFixes PY-2380
Fixes #6092