Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix profile outputter docs #50878

Merged
merged 1 commit into from
Jan 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions doc/ref/cli/_includes/output-options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ Output Options
Pass in an alternative outputter to display the return of data. This
outputter can be any of the available outputters:

``grains``, ``highstate``, ``json``, ``key``, ``overstatestage``, ``pprint``, ``raw``, ``txt``, ``yaml``

Some outputters are formatted only for data returned from specific
functions; for instance, the ``grains`` outputter will not work for non-grains
data.
``highstate``, ``json``, ``key``, ``overstatestage``, ``pprint``, ``raw``, ``txt``, ``yaml``, and :ref:`many others <all-salt.output>`.

Some outputters are formatted only for data returned from specific functions.
If an outputter is used that does not support the data passed into it, then
Salt will fall back on the ``pprint`` outputter and display the return data
using the Python ``pprint`` standard library module.
Expand Down
1 change: 1 addition & 0 deletions doc/ref/output/all/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Follow one of the below links for further information and examples
overstatestage
pony
pprint_out
profile
progress
raw
table_out
Expand Down
6 changes: 6 additions & 0 deletions doc/ref/output/all/salt.output.profile.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
===================
salt.output.profile
===================

.. automodule:: salt.output.profile
:members:
4 changes: 4 additions & 0 deletions doc/topics/troubleshooting/master.rst
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ configuration file: ``/etc/salt/master`` and setting the ``timeout`` value to
change the default timeout for all commands, and then restarting the
salt-master service.

If a ``state.apply`` run takes too long, you can find a bottleneck by adding the
:py:mod:`--out=profile <salt.output.profile>` option.


Salt Master Auth Flooding
=========================

Expand Down
3 changes: 3 additions & 0 deletions doc/topics/troubleshooting/minion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,6 @@ salt-minion service.
Modifying the minion timeout value is not required when running commands
from a Salt Master. It is only required when running commands locally on
the minion.

If a ``state.apply`` run takes too long, you can find a bottleneck by adding the
:py:mod:`--out=profile <salt.output.profile>` option.
50 changes: 28 additions & 22 deletions salt/output/profile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@
# -*- coding: utf-8 -*-
'''
Display profiling data in a table format
========================================

Show profile data for returners that would normally show a highstate output.

salt MINION state.apply something --out=profile

Attempt to output the returns of state.sls and state.highstate as a table of
names, modules and durations that looks somewhat like the following::

name mod.fun duration (ms)
--------------------------------------------------------
I-fail-unless-stmt other.function -1.0000
old-minion-config grains.list_present 1.1200
salt-data group.present 48.3800
/etc/salt/minion file.managed 63.1450


To get the above appearance, use settings something like these::

out.table.separate_rows: False
out.table.justify: left
out.table.delim: ' '
out.table.prefix: ''
out.table.suffix: ''
'''
from __future__ import absolute_import, print_function, unicode_literals
import salt.output.table_out as table_out

Expand Down Expand Up @@ -39,28 +66,7 @@ def _find_durations(data, name_max=60):

def output(data, **kwargs):
'''

Show profile data for returners that would normally show a highstate output.

salt globhere state.sls something --out=profile

Attempt to output the returns of state.sls and state.highstate as a table of
names, modules and durations that looks somewhat like the following:

name mod.fun duration (ms)
--------------------------------------------------------
I-fail-unless-stmt other.function -1.0000
old-minion-config grains.list_present 1.1200
salt-data group.present 48.3800
/etc/salt/minion file.managed 63.1450


To get the above appearance, use settings something like these:
out.table.separate_rows: False
out.table.justify: left
out.table.delim: ' '
out.table.prefix: ''
out.table.suffix: ''
Display the profiling data in a table format.
'''

rows = _find_durations(data)
Expand Down