Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 19, 2025

Adds staff-only endpoints to verify logging integrations work after deployments or package upgrades.

Changes

  • New endpoints: /operations/sentry/ and /operations/newrelic/

    • Require authentication + is_staff=True
    • Generate log.info() and log.error() messages with service name and user context
    • Return JSON status response
    • Only available when ALLOW_ADMIN=True
  • Implementation:

    • Base class OperationsLogView in readthedocs/core/views/__init__.py
    • Subclasses SentryOperationsView and NewRelicOperationsView
    • URL routing in readthedocs/urls.py under operations_urls
  • Tests: Full coverage for access control and log generation in test_operations_views.py

Example

# Staff user hits endpoint
GET /operations/sentry/

# Response:
{"status": "ok", "service": "sentry", "message": "Log messages sent to sentry"}

# Logs generated:
# INFO: Operations test: sentry logging check [service=sentry, user=staff_username]
# ERROR: Operations test error: sentry error logging check [service=sentry, user=staff_username]

Non-staff users receive 403 with error message.

Original prompt

This section details on the original issue you should resolve

<issue_title>Ops: add URLs to report log into Sentry and/or New Relic</issue_title>
<issue_description>When deploying it's useful to know if Sentry and New Relic services keep working fine, in particular, when there is an upgrade on any of these packages and their dependencies.

It would be good to be able to hit /operations/sentry/ and /operations/newrelic/ as a staff=True user and report/log into these services.</issue_description>

<agent_instructions>Add a view that does a log.info and log.error which goes to these services. </agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add URLs to report log into Sentry and New Relic Add operations endpoints for testing Sentry and New Relic logging Nov 19, 2025
Copilot AI requested a review from ericholscher November 19, 2025 17:21
Copilot finished work on behalf of ericholscher November 19, 2025 17:22
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.

Ops: add URLs to report log into Sentry and/or New Relic

2 participants