Commit Graph

561 Commits

Author SHA1 Message Date
Piotr Surowiec
bc1e9afe4b feat: allow overriding unit icons (#21433)
This:
1. Introduces a new override using the `pluggable_override` decorator.
It is now possible to specify a custom way of getting XBlock's icon
by defining `GET_UNIT_ICON_IMPL` in settings.
2. Introduces a way to add custom `XBLOCK_MIXINS` by defining
`XBLOCK_EXTRA_MIXINS` in settings. This allows, e.g. to add
new fields to XBlocks.
2021-04-07 09:42:12 -04:00
M. Zulqarnain
072b6b8875 Revert "chore: Unpin python-dateutil (#27196)" (#27217)
This reverts commit 40878cd554.
2021-04-01 23:32:51 +05:00
M. Zulqarnain
40878cd554 chore: Unpin python-dateutil (#27196) 2021-04-01 19:53:02 +05:00
Robert Raposa
d4bbd9d03e fix: move ignored error message custom attribute (#27047)
The `error_expected` custom attribute used to contain
both the class name and the error message. This had
the following issues:

* Combining data in the same custom attribute limits
the ability to query.
* The additional error class and message data is only
needed for ignored errors, since this data isn't
available elsewhere.

The following changes were made:
* `error_expected` will always have the value True
if present.
* `error_ignored` no longer exists.
* `error_ignored_class` will contain the error module
and class for ignored errors.
* `error_ignored_message` will contain the error message
for ignored errors.

ARCHBOM-1708
2021-03-18 10:37:47 -04:00
Robert Raposa
2c0a8242f7 ARCHBOM-1708: feat: monitor and log expected errors (#26980)
Adds logging and monitoring capabilities for expected
errors. See the ADR and how-to  documentation for
details of how to configure and use the EXPECTED_ERRORS
setting and new monitoring and logging.

ARCHBOM-1708

Co-authored-by: Tim McCormack <tmccormack@edx.org>
2021-03-17 07:27:13 -04:00
Usman Khalid
23d1e5b654 Remove unused RawDescriptor and EmptyDataRawDescriptor. 2021-03-11 22:20:33 +05:00
Usman Khalid
dd96a2aa72 Convert Course, Section and Sequence XModules to XBlocks. (#25965) 2021-03-02 10:29:33 -05:00
Feanil Patel
d2343b1f07 doc: Correctly annotate the setting name.
The `setting_name` annotation needed a space before it so that it's
picked up properly by the toggle annotations tooling.
2021-03-01 16:35:41 -05:00
Aarif
813064ad49 replaced unittest assertions pytest assertions (#26574) 2021-02-22 20:04:51 +05:00
usamasadiq
96f0915b0f Fixed new pylint warnings.
use generator in any/all()
disable not-callable warnings
disable no-member warnings
Suppressed smaller pylint warnings
Pin edx-proctoring==3.5.0
2021-02-22 16:36:53 +05:00
David Ormsbee
843668a011 Revert "feat: 403 logging for exchange_access_token (#26511)" (#26608)
This reverts commit 0517603b6d.

This was masking a LabXchange error by blowing up with:
"Stack trace builtins:AttributeError: 'NoneType' object has no attribute 'status_code'"
2021-02-17 17:08:44 -05:00
Robert Raposa
0517603b6d feat: 403 logging for exchange_access_token (#26511)
The mobile app is getting unexpected 403s from
/oauth2/exchange_access_token/, but we have been unable
to pinpoint from where they are coming. This commit
introduces a temporary exception handler to provide stack info
for 403s on this endpoint to try to track down the source.

Requires the ENABLE_403_MONITORING setting to be set to
True to enable the logging.

ARCHBOM-1667
2021-02-12 15:34:55 -05:00
Jawayria
fc08dd3ff5 Resolved error 2021-02-03 17:13:09 +05:00
Jawayria
9909b933a7 Applied pylint-amnesty to openedx/core/{djangolib, lib, tests, *.py 2021-02-02 21:13:24 +05:00
Kyle McCormick
e3cfaab487 Merge pull request #25955 from open-craft/symbolist/convert-hidden-module-to-xblock
[BD-04] [SE-3708] Convert HiddenDescriptor to an XBlock.
2021-01-26 13:56:06 -05:00
Robert Raposa
cf626667d6 annotate cookie monitoring toggle
* Annotate cookie monitoring toggle and settings.
* Refactor to replace LegacyWaffleFlag.
2021-01-25 14:42:44 -05:00
Matthew Piatetsky
84ba4ec635 Only set due dates on subsections that contain graded assignments with a score and a nonzero weight
Previously we were only checking the graded attribute which doesn't account for ungraded assignments
https://openedx.atlassian.net/browse/AA-497
2021-01-20 16:30:20 -05:00
Robert Raposa
8b4ea05d5e fix cookie monitoring middleware
The cases of no cookies or no cookie groups
found would cause an error. This was fixed
and additional test coverage was added.
2021-01-15 15:07:22 -05:00
Feanil Patel
4047a72701 Merge pull request #26065 from edx/feanil/update_cookie_metrics
Add more cookie logging code.
2021-01-14 16:30:34 -05:00
Feanil Patel
e5e2b7f7b6 Only capture the top N cookies and cookie groups.
Instead of adding new attributes for each cookie name we create
consistent attribute names.  This should prevent any issues where we
have too many different unique attribute names because the cookie names
are unique to the user.

We added two new settings to make the number of cookies and groups
capture configurable:

- TOP_N_COOKIES_CAPTURED
- TOP_N_COOKIE_GROUPS_CAPTURED
2021-01-14 15:49:15 -05:00
Feanil Patel
1a1da89f55 Drop setting attributes for the size of each cookie.
Setting a new metric per cookie name resulted in a lot of metrics
getting added to New Relic.  In some cases, this was causing other
more important metrics to not get registered.
2021-01-14 11:03:28 -05:00
Feanil Patel
1ae50fc466 Add more cookie logging code.
We want to be able to easily figure out what our biggest cookies are and we
want to also group cookies by prefix because certain services create multiple
cookies and then put unique identifiers in the cookie name.

For example braze cookie names use the following pattern:
    ab.storage.<userId>
    ab.storage.<deviceId>
    ab.storage.<sessionId>

In this case we want to group all the `ab` cookies together so we can see
their total size.

New attributes:

cookies.<group_prefix>.group.size: The size of a group of cookies. For example
	the sum of the size of all braze cookies would be the value of the
	`cookies.ab.group.size` attribute.
cookies.max.name: The name of the largest cookie sent by the user.
cookies.max.size: The size of the largest cookie sent by the user.
cookies.max.group.name: The name of the largest group of cookies. A single cookie
	counts as a group of one for this calculation.
cookies.max.group.size: The sum total size of all the cookies in the largest group.
2021-01-14 09:55:49 -05:00
Usman Khalid
9116599f00 Convert HiddenDescriptor to an XBlock.
The class name has been retained because the class path is
specified in the modulestore config in a number of places.
2021-01-14 01:22:08 +05:00
Ahtisham Shahid
b2466c8c2b Error incase of disabled user social login
Updated status code and manage user func

update auth verification

Fixed auth condition

fixed test failuers

fixed style issues

fixed style issues

Created test for auth disabled use

Code refactor

Fixed form ain auth exchange

Fixed oauth apps with disabled user fail

applied quality fixes

Refactored tests

fixed quality issues

removed extra files

Fixed linter issues

Fixed linter issues
2021-01-06 20:37:01 +05:00
Muhammad Soban Javed
bd601cf3a6 Update celery routing for celery 4+ (#25567)
* Update celery routing

- Used routing function instead of class
- Move task queues dictionary to Django settings
- Removed routing_key parameter
- Refactored routing for singleton celery instantiation

Co-authored-by: Awais Qureshi <awais.qureshi@arbisoft.com>
2020-12-16 13:40:47 +05:00
Dillon Dumesnil
d58a080236 Merge pull request #25865 from edx/ddumesnil/aa-260
AA-260/AA-500: Improvements to in course shift deadlines
2020-12-14 12:25:23 -08:00
Dillon Dumesnil
3c1de16eba AA-260/AA-500: Improvements to in course shift deadlines
As part of AA-500, we added a completeness check to showing the
banner since we didn't before. As part of AA-260, we now take into
account if a learner has more attempts left on a problem (regardless
of completeness) and allow them to shift their dates to try again.
2020-12-14 19:05:30 +00:00
Tim McCormack
0c57a02119 Enforce a Celery singleton across cms and lms by using shared module (#25840)
This should prevent the issues we've seen recently where cms modules are
imported by the running lms process, resulting in two celery instances
being created and tasks intermittently being registered to the wrong
instance (and therefore effectively lost.)

In commit ab6bf348d4/PR #25822 we tried to ensure that only one or the
other of the instances was created by adding a startup check.
Unfortunately, there's an external shared library that refers directly
to the lms celery, causing a startup failure in cms, so we had to revert
it. Rather than waiting to fix that library, this commit collapses
the two instances together so that there is only ever one.
2020-12-10 17:54:31 +00:00
Régis Behmo
a16cd71046 Start waffle namespace deprecation
By explicitly importing the legacy namespace classes, we make it clear
that we are using soon-to-be-deprecated classes. We will then be able to
start removing the legacy classes, one module at a time.
2020-12-03 16:06:14 +01:00
Awais Qureshi
7201edb11d Revert "Update routing config" (#25536)" (#25549)" (#25553)" (#25561)
This reverts commit db4c3b1210.
2020-11-11 00:13:47 +05:00
Awais Qureshi
db4c3b1210 Revert "Revert ""Update routing config" (#25536)" (#25549)" (#25553)
This reverts commit c1fe3c3a93.
2020-11-10 23:23:09 +05:00
Kyle McCormick
151bd13666 Use full names for common.djangoapps imports; warn when using old style (#25477)
* Generate common/djangoapps import shims for LMS
* Generate common/djangoapps import shims for Studio
* Stop appending project root to sys.path
* Stop appending common/djangoapps to sys.path
* Import from common.djangoapps.course_action_state instead of course_action_state
* Import from common.djangoapps.course_modes instead of course_modes
* Import from common.djangoapps.database_fixups instead of database_fixups
* Import from common.djangoapps.edxmako instead of edxmako
* Import from common.djangoapps.entitlements instead of entitlements
* Import from common.djangoapps.pipline_mako instead of pipeline_mako
* Import from common.djangoapps.static_replace instead of static_replace
* Import from common.djangoapps.student instead of student
* Import from common.djangoapps.terrain instead of terrain
* Import from common.djangoapps.third_party_auth instead of third_party_auth
* Import from common.djangoapps.track instead of track
* Import from common.djangoapps.util instead of util
* Import from common.djangoapps.xblock_django instead of xblock_django
* Add empty common/djangoapps/__init__.py to fix pytest collection
* Fix pylint formatting violations
* Exclude import_shims/ directory tree from linting
2020-11-10 07:02:01 -05:00
Muhammad Soban Javed
c1fe3c3a93 Revert ""Update routing config" (#25536)" (#25549)
This reverts commit 39a22734c1.
2020-11-09 23:43:47 +05:00
Awais Qureshi
39a22734c1 "Update routing config" (#25536)
* Revert "Revert "Update routing config"

* Removed settings from lms/celery.py and cms/celery.py

* Moved settings import from top-level to function's scopes

Co-authored-by: Soban Javed <iamsobanjaved@gmail.com>
2020-11-09 19:06:55 +05:00
Muhammad Soban Javed
5a2ea1f954 Revert "Update routing config" 2020-11-06 02:05:48 +05:00
Muhammad Soban Javed
bfa8f71f33 Update routing config #25419 2020-11-06 01:00:29 +05:00
Régis Behmo
4586002956 Import waffle classes from edx_toggles instead of waffle_utils
Those classes were ported to edx_toggles. The imports remain in
waffle_utils.__init__ for backward compatibility.
2020-11-03 19:25:37 +01:00
Mike OConnell
dbf6ef22df Using logging filters from edx-django-utils (#25492)
The UserIdFilter and RemoteIpFilter logging filter classes
were moved from edx-platform to edx-django-utils for more
distributed use. This updated removes those classes from
edx-platform, and references their counterparts in
edx-django-utils.

ENT-3494
2020-11-02 21:40:59 -05:00
Soban Javed
3206d9cb9a Update celery routing
- Used routing function istead of class
- Move task queues to Djano settings
- Removed routing_key parameter
2020-11-02 15:03:53 +05:00
Tim McCormack
5b331b2d4d Merge branch 'master' into timmc/misc-metric-attribute
# Conflicts:
#	cms/envs/common.py
#	lms/envs/common.py
2020-09-28 13:56:08 +00:00
Tim McCormack
f29e418264 Revert "Revert "ARCHBOM-1494: Refer to custom attributes, not metrics, especially with edx-django-utils (#25010)" (#25025)" (#25055)
This reverts commit 986a448d9e.
2020-09-28 13:53:57 +00:00
Tim McCormack
92135ad567 Avoid direct use of newrelic (while we're in there) 2020-09-22 23:25:50 +00:00
Tim McCormack
0f33afc20a Fix my weird typo 2020-09-22 22:59:28 +00:00
Ahtisham Shahid
986a448d9e Revert "ARCHBOM-1494: Refer to custom attributes, not metrics, especially with edx-django-utils (#25010)" (#25025)
This reverts commit ba9ee4e151.

Fixed Style lint issue
2020-09-21 13:48:00 +05:00
Sid Verma
78045115ab Add filtering and search support to library APIs 2020-09-18 10:25:59 -04:00
Tim McCormack
328e790e8a Rename CookieMetricsMiddleware to CookingMonitoringMiddleware
This fixes a misuse of New Relic terminology. Here we are in fact using
custom attributes; custom metrics are a different thing that we may start
using in the future.
2020-09-18 14:25:50 +00:00
Tim McCormack
ba9ee4e151 ARCHBOM-1494: Refer to custom attributes, not metrics, especially with edx-django-utils (#25010)
This uses the new names introduced in edx-django-utils
3.8.0 (edx/edx-django-utils#59), which we're already using, as
well as updating a few other locations where we incorrectly refer
to New Relic custom metrics instead of custom attributes.

Includes a couple of unrelated lint fixes in a file I modified.
2020-09-18 13:33:50 +00:00
Feanil Patel
d264490fb7 Merge pull request #24952 from regisb/regisb/simplify-waffle-module-name
[BD-21] Simplify hack to obtain waffle module names
2020-09-15 11:19:43 -04:00
Mike OConnell
11e4cab622 Added remote IP to logging (#24932)
* Add remote IP to logging config

Add a new filter to get the remote IP for the current
request and include it in log statements

SEG-34

* Added line for formatting

Added line for formatting

SEG-34
2020-09-14 11:22:11 -04:00
Régis Behmo
307457a255 Simplify hack to obtain waffle module names
Instead of going up the stacktrace to find the module names of waffle
flags and switches, we manually pass the module __name__ whenever the
flag is created. This is similar to `logging.getLogger(__name__)`
standard behaviour.

As the waffle classes are used outside of edx-platform, we make the new
module_name argument an optional keyword argument. This will change once
we pull waffle_utils outside of edx-platform.

Note that the module name is normally only required to view the list of
existing waffle flags and switches. The module name should not be
necessary to verify if a flag is enabled. Thus, maybe it would make
sense to create a `add` class methor similar to:

    class WaffleFlag:
        @classmethod
        def add(cls, namespace, flag, module):
            instance = cls(namespace, flag)
            cls._class_instances.add((instance, module))
2020-09-14 09:30:24 +02:00