0
0
Djangoframework~20 mins

Monitoring and error tracking in Django - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Monitoring Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Django Logging Configuration Output
Given the following Django logging configuration snippet, what will be the output when a warning message is logged using logger.warning('Disk space low')?
Django
LOGGING = {
    'version': 1,
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
            'formatter': 'simple'
        },
    },
    'formatters': {
        'simple': {
            'format': '%(levelname)s: %(message)s'
        }
    },
    'loggers': {
        'django': {
            'handlers': ['console'],
            'level': 'ERROR',
        },
        'myapp': {
            'handlers': ['console'],
            'level': 'WARNING',
        },
    },
}

import logging
logger = logging.getLogger('myapp')
logger.warning('Disk space low')
ADisk space low
BNo output
CWARNING: Disk space low
DERROR: Disk space low
Attempts:
2 left
💡 Hint
Check the logger name and its level in the configuration.
🧠 Conceptual
intermediate
1:30remaining
Purpose of Middleware in Django Monitoring
What is the primary purpose of adding custom middleware for monitoring in a Django application?
ATo track and log request and response data for performance and error monitoring
BTo modify HTTP responses before sending them to clients
CTo handle database migrations automatically
DTo serve static files more efficiently
Attempts:
2 left
💡 Hint
Think about what middleware can observe during request processing.
Troubleshoot
advanced
2:30remaining
Diagnosing Missing Error Logs in Django
A Django application is configured to send error logs to Sentry, but no errors appear in the Sentry dashboard after exceptions occur. Which of the following is the most likely cause?
AThe Sentry DSN is incorrect or missing in the Django settings
BThe Django DEBUG setting is set to False
CThe database migrations are not applied
DThe static files are not collected
Attempts:
2 left
💡 Hint
Check the connection details for the error tracking service.
🔀 Workflow
advanced
3:00remaining
Order of Steps to Enable Monitoring with Prometheus in Django
Arrange the steps in the correct order to enable Prometheus monitoring for a Django application.
A2,1,3,4
B1,2,3,4
C1,3,2,4
D1,2,4,3
Attempts:
2 left
💡 Hint
Think about installation before configuration steps.
Best Practice
expert
2:30remaining
Best Practice for Handling Sensitive Data in Django Error Tracking
Which practice is best to ensure sensitive user data is not exposed in error tracking tools like Sentry when monitoring a Django application?
ADisable error tracking in production environments
BSend error reports only during business hours
CLog all request data including passwords for full context
DUse Sentry's data scrubbing features to filter sensitive fields before sending
Attempts:
2 left
💡 Hint
Think about how to protect user privacy while still getting useful error info.