Fix Metrics for Oracle DPI errors #3944
Merged
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.
Stacktrace:
[20/Dec/2024 08:23:00 -0500] metrics ERROR Could not get active_users
Traceback (most recent call last):
File "/opt/cloudera/parcels/CDH-7.1.9-1.cdh7.1.9.p1015.59425156/lib/hue/build/env/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/opt/cloudera/parcels/CDH-7.1.9-1.cdh7.1.9.p1015.59425156/lib/hue/build/env/lib/python3.8/site-packages/django/db/backends/oracle/base.py", line 521, in execute
self._guess_input_sizes([params])
File "/opt/cloudera/parcels/CDH-7.1.9-1.cdh7.1.9.p1015.59425156/lib/hue/build/env/lib/python3.8/site-packages/django/db/backends/oracle/base.py", line 467, in _guess_input_sizes
self.setinputsizes(**sizes)
cx_Oracle.DatabaseError: DPI-1010: not connected
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/cloudera/parcels/CDH-7.1.9-1.cdh7.1.9.p1015.59425156/lib/hue/apps/useradmin/src/useradmin/metrics.py", line 33, in active_users
count = UserProfile.objects.filter(
File "/opt/cloudera/parcels/CDH-7.1.9-1.cdh7.1.9.p1015.59425156/lib/hue/build/env/lib/python3.8/site-packages/django/db/models/query.py", line 412, in count
return self.query.get_count(using=self.db)
File "/opt/cloudera/parcels/CDH-7.1.9-1.cdh7.1.9.p1015.59425156/lib/hue/build/env/lib/python3.8/site-packages/django/db/models/sql/query.py", line 528, in get_count
number = obj.get_aggregation(using, ['__count'])['__count']
File "/opt/cloudera/parcels/CDH-7.1.9-1.cdh7.1.9.p1015.59425156/lib/hue/build/env/lib/python3.8/site-packages/django/db/models/sql/query.py", line 513, in get_aggregation
result = compiler.execute_sql(SINGLE)
File "/opt/cloudera/parcels/CDH-7.1.9-1.cdh7.1.9.p1015.59425156/lib/hue/build/env/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql
cursor.execute(sql, params)
File "/opt/cloudera/parcels/CDH-7.1.9-1.cdh7.1.9.p1015.59425156/lib/hue/build/env/lib/python3.8/site-packages/django/db/backends/utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/opt/cloudera/parcels/CDH-7.1.9-1.cdh7.1.9.p1015.59425156/lib/hue/build/env/lib/python3.8/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/opt/cloudera/parcels/CDH-7.1.9-1.cdh7.1.9.p1015.59425156/lib/hue/build/env/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/opt/cloudera/parcels/CDH-7.1.9-1.cdh7.1.9.p1015.59425156/lib/hue/build/env/lib/python3.8/site-packages/django/db/utils.py", line 90, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/cloudera/parcels/CDH-7.1.9-1.cdh7.1.9.p1015.59425156/lib/hue/build/env/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/opt/cloudera/parcels/CDH-7.1.9-1.cdh7.1.9.p1015.59425156/lib/hue/build/env/lib/python3.8/site-packages/django/db/backends/oracle/base.py", line 521, in execute
self._guess_input_sizes([params])
File "/opt/cloudera/parcels/CDH-7.1.9-1.cdh7.1.9.p1015.59425156/lib/hue/build/env/lib/python3.8/site-packages/django/db/backends/oracle/base.py", line 467, in _guess_input_sizes
self.setinputsizes(**sizes)
django.db.utils.DatabaseError: DPI-1010: not connected.
Testing:
Manually tested and was also tested at customer end.