05 Feb 2020 12:54 PM
Plugin simulator raises exception instead of providing collected measurements. Details:
python version - 3.8.1
Dynatrace plugin SDK - 1.183
Installation:
pip3.8 install plugin_sdk-1.183.163.20200203.165724-py3-none-any.whl --user
Running demo:
python3.8 -m plugin_sdk.demo_app
Starting plugin simulator in demo plugin directory:
cd ~/tmp/dynatrace/sdk/examples/demo_oneagent_pluginit runs for some time
~/.local/bin/oneagent_sim
and after stopping with CTRL-C an exception raised:
^CPlugin simulator was stopped with a Keyboard interrupt
Traceback (most recent call last):
File "/home/andriis/.local/bin/oneagent_sim", line 10, in <module>
sys.exit(main())
File "/home/andriis/.local/lib/python3.8/site-packages/plugin_sdk/plugin_simulator.py", line 154, in main
_main(args)
File "/home/andriis/.local/lib/python3.8/site-packages/plugin_sdk/plugin_simulator.py", line 165, in _main
run_simulator(
File "/home/andriis/.local/lib/python3.8/site-packages/plugin_sdk/plugin_simulator.py", line 374, in run_simulator
all_events = list(itertools.chain(results, statuses))
File "/home/andriis/.local/lib/python3.8/site-packages/plugin_sdk/plugin_simulator.py", line 489, in _get_results
yield MeasurementsEvent(m[0], m[1][1][1].measurements)
AttributeError: 'collections.defaultdict' object has no attribute 'measurements'
How to fix:
cd ~/.local/lib/python3.8/site-packages/plugin_sdk
$ diff plugin_simulator.py plugin_simulator.py.orig
489,491c489
< yield MeasurementsEvent(m[0], m[1][1][0].measurements)
< if m[1][1][1]:
< yield PropertiesEvent(m[0], m[1][1][1])
---
> yield MeasurementsEvent(m[0], m[1][1][1].measurements)
493c491,493
< yield EventsEvent(m[0], m[1][1][2])
---
> yield PropertiesEvent(m[0], m[1][1][2])
> if m[1][1][3]:
> yield EventsEvent(m[0], m[1][1][3])
Solved! Go to Solution.
05 Feb 2020 02:20 PM
You should use Python 3.6, as stated in documentation