You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like the JSON decoder fails with AttributeError: 'str' object has no attribute 'items'
Full output:
$ mloginfo server2.log --queries
source: server2.log
host: unknown
start: 2019 Dec 03 15:38:58.089
end: 2019 Dec 03 16:48:23.534
date format: iso8601-local
length: 200000
binary: unknown
version: >= 3.0 (iso8601 format, level, component)
storage: unknown
QUERIES
[= ] 2.8 % Traceback (most recent call last):
File "/apps/mongodb/sysmngtlab1/instance/anaconda3/bin/mloginfo", line 11, in <module>
load_entry_point('mtools==1.5.3', 'console_scripts', 'mloginfo')()
File "/apps/mongodb/sysmngtlab1/instance/anaconda3/lib/python3.6/site-packages/mtools-1.5.3-py3.6.egg/mtools/mloginfo/mloginfo.py", line 95, in main
tool.run()
File "/apps/mongodb/sysmngtlab1/instance/anaconda3/lib/python3.6/site-packages/mtools-1.5.3-py3.6.egg/mtools/mloginfo/mloginfo.py", line 90, in run
section.run()
File "/apps/mongodb/sysmngtlab1/instance/anaconda3/lib/python3.6/site-packages/mtools-1.5.3-py3.6.egg/mtools/mloginfo/sections/query_section.py", line 81, in run
pattern=le.pattern, duration=le.duration)
File "/apps/mongodb/sysmngtlab1/instance/anaconda3/lib/python3.6/site-packages/mtools-1.5.3-py3.6.egg/mtools/util/logevent.py", line 439, in pattern
self._pattern = self._find_pattern('filter: ')
File "/apps/mongodb/sysmngtlab1/instance/anaconda3/lib/python3.6/site-packages/mtools-1.5.3-py3.6.egg/mtools/util/logevent.py", line 769, in _find_pattern
return json2pattern(search_str)
File "/apps/mongodb/sysmngtlab1/instance/anaconda3/lib/python3.6/site-packages/mtools-1.5.3-py3.6.egg/mtools/util/pattern.py", line 87, in json2pattern
doc = json.loads(s, object_hook=_decode_pattern_dict)
File "/apps/mongodb/sysmngtlab1/instance/anaconda3/lib/python3.6/json/__init__.py", line 367, in loads
return cls(**kw).decode(s)
File "/apps/mongodb/sysmngtlab1/instance/anaconda3/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/apps/mongodb/sysmngtlab1/instance/anaconda3/lib/python3.6/json/decoder.py", line 355, in raw_decode
obj, end = self.scan_once(s, idx)
File "/apps/mongodb/sysmngtlab1/instance/anaconda3/lib/python3.6/site-packages/mtools-1.5.3-py3.6.egg/mtools/util/pattern.py", line 40, in _decode_pattern_dict
return _decode_pattern_dict(value)
File "/apps/mongodb/sysmngtlab1/instance/anaconda3/lib/python3.6/site-packages/mtools-1.5.3-py3.6.egg/mtools/util/pattern.py", line 31, in _decode_pattern_dict
for key, value in six.iteritems(data):
File "/apps/mongodb/sysmngtlab1/instance/anaconda3/lib/python3.6/site-packages/six.py", line 581, in iteritems
return iter(d.items(**kw))
AttributeError: 'str' object has no attribute 'items'
@niccottrell Thanks for narrowing down the log line to repro this. The issue is caused by a field called query which triggers trying to decode the value as a dictionary when it is a string: query: "latestVersionForTheSameDateAndClassifier".
The current (incorrect) assumption appears to be that query: is only used for query params. Will fix the logic & add a test.
Actual/current behavior
It looks like the JSON decoder fails with
AttributeError: 'str' object has no attribute 'items'
Full output:
Steps to reproduce the actual/current behavior
Environment
The text was updated successfully, but these errors were encountered: