opentelemetry-instrumentation-discord-py: add prefix and app command tracing#4842
Open
nikitagrover19 wants to merge 3 commits into
Open
opentelemetry-instrumentation-discord-py: add prefix and app command tracing#4842nikitagrover19 wants to merge 3 commits into
nikitagrover19 wants to merge 3 commits into
Conversation
|
|
Instruments discord.py prefix commands and app commands via BaseInstrumentor, wrapping Bot.invoke and CommandTree._call. Relates to open-telemetry#4492
nikitagrover19
force-pushed
the
ng/discord-py-instrumentation
branch
from
July 20, 2026 08:19
e23df50 to
8dda0a8
Compare
- Docs stub now matches the official _template/autodoc_entry.rst (includes README content before the automodule directive) - Add .changelog/4842.added towncrier fragment - Regenerate bootstrap_gen.py to register discord.py for auto-instrumentation
Per CONTRIBUTING.md guidance, async tests should inherit IsolatedAsyncioTestCase rather than being manually driven via asyncio.run(), which can lead to tests passing without properly exercising the async code path.
Author
|
Marking this ready for review. Summary of what's been done since
pylint: 10.00/10, all tests passing, CLA signed. @laggron42 @xrmx would appreciate a review whenever you have time. |
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.
Instruments discord.py prefix commands and app commands via BaseInstrumentor, wrapping Bot.invoke and CommandTree._call.
Relates to #4492
Description
Adds a new
opentelemetry-instrumentation-discord-pypackage. Every prefixcommand invocation produces a span named
discord.command, and everyapp/slash command produces
discord.app_command. Both carrydiscord.command.name,discord.guild.id,discord.channel.id, anddiscord.user.idas attributes. Errors during command execution arerecorded on the span with
Status(ERROR).Package name is
opentelemetry-instrumentation-discord-py(not-discordpy) since that name is already taken on PyPI by an unrelatedproject.
This is a draft to get early feedback on the approach before going
further — cc @laggron42 @xrmx. Scope follows what we discussed on the
issue: prefix commands and app commands only, no span-linking across
interactions (dropped per feedback on the issue). Changelog entry still
to be added.
Type of change
How Has This Been Tested?
error status recording (3 tests, all passing).
confirm the wrapt patch targets (
Bot.invoke,CommandTree._call) andthe
Context/Interactionattributes used are correct against theactual library.
pylint --rcfile .pylintrc: 10.00/10Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.