Skip to content

Conversation

Copy link

Copilot AI commented Dec 3, 2025

Description

Addresses reviewer feedback to reduce documentation duplication in the Django example README.

Changes:

  • Remove code block (lines 55-74) duplicating manage.py content—readers can view the file directly
  • Update line 49 to point readers to manage.py which already has explanatory comments
  • Remove redundant TracerProvider/SpanProcessor explanation (lines 76-77)
  • Clarify auto-instrumentation section: both TracerProvider setup AND DjangoInstrumentor().instrument() must be commented out

Type of change

  • This change requires a documentation update

How Has This Been Tested?

  • rstcheck --report-level warning docs/examples/django/README.rst passes

Does This PR Require a Contrib Repo Change?

  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated
Original prompt

Make these changes seguested:

docs/examples/django/README.rst
Comment on lines +55 to +74
The manage.py example includes this setup:

.. code-block:: python
from opentelemetry import trace
from opentelemetry.instrumentation.django import DjangoInstrumentor
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import (
BatchSpanProcessor,
ConsoleSpanExporter,
)
# Set up tracing with console exporter to see spans in stdout
trace.set_tracer_provider(TracerProvider())
trace.get_tracer_provider().add_span_processor(
BatchSpanProcessor(ConsoleSpanExporter())
)
# This call is what makes the Django application be instrumented
DjangoInstrumentor().instrument()
Contributor
@tammy-baylis-swi
tammy-baylis-swi
last week
Thanks for this PR!

To avoid repeating, I'd suggest not including this code block in the Readme and just encourage readers to look at manage.py. Maybe: remove this block, then update L49 to say something like

Once there, open the manage.py file which uses the OpenTelemetry SDK to set up tracing with console exporter and manual instrumentation of Django:
@BrianPetkovsek Reply...
tammy-baylis-swi
tammy-baylis-swi reviewed last week
docs/examples/django/README.rst
Comment on lines +76 to +77
Without the TracerProvider and SpanProcessor setup, the instrumentation will
capture traces but they won't be exported anywhere (no output will be visible).
Contributor
@tammy-baylis-swi
tammy-baylis-swi
last week
I suggest removing this because manage.py already says

Set up tracing with console exporter to see spans in stdout

@BrianPetkovsek Reply...
xrmx
xrmx reviewed last week
docs/examples/django/README.rst
@xrmx xrmx added this to @xrmx's Python PR digest last week
tammy-baylis-swi
tammy-baylis-swi reviewed last week
docs/examples/django/README.rst
Contributor
@tammy-baylis-swi
tammy-baylis-swi
last week
Please could you also update https://github.com/open-telemetry/opentelemetry-python/blob/main/docs/examples/django/README.rst?plain=1#L113-L114 to say that the TracerProvider calls should also be commented out when doing auto-instrumentation.

Contributor
@xrmx
xrmx
5 days ago
Can we make the code handling tracing already setup instead?


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…mentation

Co-authored-by: BrianPetkovsek <16124109+BrianPetkovsek@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove code example from Django README Update Django README.rst to avoid duplication and clarify auto-instrumentation Dec 3, 2025
Copilot AI requested a review from BrianPetkovsek December 3, 2025 22:48
@BrianPetkovsek BrianPetkovsek marked this pull request as ready for review December 3, 2025 23:01
Copilot AI review requested due to automatic review settings December 3, 2025 23:01
@BrianPetkovsek BrianPetkovsek merged commit a9aa015 into DjangoFix Dec 3, 2025
2 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces documentation duplication in the Django example README by removing redundant code blocks and explanations, while clarifying the auto-instrumentation setup instructions.

Key Changes:

  • Simplified line 49 to reference manage.py directly instead of duplicating its code
  • Removed 20+ lines of duplicated code block showing TracerProvider setup
  • Clarified auto-instrumentation instructions to specify that both TracerProvider setup and DjangoInstrumentor call must be commented out

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Without the ``TracerProvider`` and ``SpanProcessor`` setup, the instrumentation will
capture traces but they won't be exported anywhere (no output will be visible).
Once there, open the ``manage.py`` file, which uses the OpenTelemetry SDK to set up tracing with console exporter and manual instrumentation of Django.
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor grammar improvement: "tracing with console exporter" should be "tracing with a console exporter" for better readability.

Suggested change
Once there, open the ``manage.py`` file, which uses the OpenTelemetry SDK to set up tracing with console exporter and manual instrumentation of Django.
Once there, open the ``manage.py`` file, which uses the OpenTelemetry SDK to set up tracing with a console exporter and manual instrumentation of Django.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants