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
In the awx_display callback plugin we need to capture per host/task/loop connection stats, and then include those connection stats in the event data created by v2_playbook_on_stats
Basically for all reachable, non skipped tasks, we need to count the number of times a host uses an individual connection plugin.
A PoC of what that would look like in a standalone callback plugin:
callback plugin poc...
# Copyright: Contributors to the Ansible project# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)from __future__ importannotationsDOCUMENTATION=''' name: track_connections short_description: Track connection plugins used for hosts description: - Track connection plugins used for hosts type: aggregate'''importjsonfromcollectionsimportdefaultdictfromansible.plugins.callbackimportCallbackBaseclassCallbackModule(CallbackBase):
CALLBACK_VERSION=2.0CALLBACK_TYPE='aggregate'CALLBACK_NAME='track_connections'def__init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._conntrack=defaultdict(lambda : defaultdict(int))
def_track(self, result, *args, **kwargs):
host=result._host.get_name()
task=result._taskself._conntrack[host][task.connection] +=1v2_runner_on_ok=v2_runner_on_failed=_trackv2_runner_on_async_poll=v2_runner_on_async_ok=v2_runner_on_async_failed=_trackv2_runner_item_on_ok=v2_runner_item_on_failed=_trackdefv2_playbook_on_stats(self, stats):
self._display.display(json.dumps(self._conntrack, indent=4))
The text was updated successfully, but these errors were encountered:
Dependent on ansible/ansible#83354
In the
awx_display
callback plugin we need to capture per host/task/loop connection stats, and then include those connection stats in the event data created byv2_playbook_on_stats
Basically for all reachable, non skipped tasks, we need to count the number of times a host uses an individual connection plugin.
A PoC of what that would look like in a standalone callback plugin:
callback plugin poc...
The text was updated successfully, but these errors were encountered: