示例#1
0
def add_flags(subparsers, name, run_default_func, is_deprecated=False):
    """adds the flags so legacy commands can share code"""
    help_text = 'Tries to summarize queries in the debug ' + \
            'log based on score that attempts to ' + \
            'estimate the relative potential cost ' + \
            'of queries. DSE Search 5.0-6.7'
    if is_deprecated:
        help_text = help_text + ". DEPRECATED use 'sperf search queryscore' instead"
    queryscore_parser = subparsers.add_parser(name,
                                              help=help_text,
                                              formatter_class=flags.LineWrapRawTextHelpFormatter)

    queryscore_parser.add_argument('-s', '--scorethreshold', type=int, default=1, \
                help="The score threshold to list a 'bad query'")
    queryscore_parser.add_argument('-t', '--top', type=int, default=5, \
                help="show the top N worst queries by score.")
    queryscore_parser.add_argument('-u', '--uniquereasons', action='store_true', \
                help="show only queries with a unique score and combination of reasons.")
    queryscore_parser.add_argument('-l', '--log_prefix',
                                   default='debug.log',
                                   help='if debug.log in the diag tarball has a different, ' + \
                                            'name, sperf can still look based on this prefix ' + \
                                         '(default "debug.log")')
    flags.files_and_diag(queryscore_parser)
    queryscore_parser.set_defaults(func=run_default_func)
示例#2
0
文件: schema.py 项目: rsds143/sperf
def add_flags(subparsers, run_default_func):
    """for code sharing between deprecated and supported commands"""
    help_text = "Analyze schema for summary. DSE 5.0-6.8"
    schema_parser = subparsers.add_parser(
        "schema",
        help=help_text,
        formatter_class=flags.LineWrapRawTextHelpFormatter)
    flags.files_and_diag(schema_parser)
    schema_parser.set_defaults(func=run_default_func)
示例#3
0
def build(subparsers):
    """add jarcheck flags"""
    jarcheck_parser = subparsers.add_parser('jarcheck',
                                            help='Checks jar versions in output.logs. ' + \
                                            'Supports tarballs and files. DSE 5.0-6.7',
                                            formatter_class=flags.LineWrapRawTextHelpFormatter)
    jarcheck_parser.set_defaults(func=run)
    flags.files_and_diag(jarcheck_parser)
    jarcheck_parser.add_argument('-o', '--diffonly', dest="diff_only", action='store_true',
                                 help='only report on the jars that are different')
示例#4
0
def add_flags(subparsers, run_default_func, is_deprecated=False):
    """for code sharing of flags between deprecated and supported"""
    csv_stages = ','.join(s for s in WANTED_STAGES_PREFIXES)
    help_text = "Provides analysis of StatusLogger log lines. DSE 5.0-6.7"
    if is_deprecated:
        help_text = help_text + ". DEPRECATED use 'sperf core statuslogger' instead"
    statuslogger_parser = subparsers.add_parser(
        'statuslogger',
        help=help_text,
        formatter_class=flags.LineWrapRawTextHelpFormatter)
    statuslogger_parser.add_argument(
        '-r',
        '--reporter',
        type=str,
        nargs='?',
        const='summary',
        default='summary',
        help="report to run, either summary or histogram (default summary)")
    statuslogger_parser.add_argument(
        '-s',
        '--stages',
        type=str,
        nargs='?',
        const=csv_stages,
        default=csv_stages,
        help="csv list of stage prefixes to collect, or 'all' (default: %s)" %
        csv_stages)
    statuslogger_parser.add_argument('-st',
                                     '--start',
                                     type=str,
                                     nargs='?',
                                     const=None,
                                     default=None,
                                     help="start date/time to begin parsing")
    statuslogger_parser.add_argument('-et',
                                     '--end',
                                     type=str,
                                     nargs='?',
                                     const=None,
                                     default=None,
                                     help="end date/time to stop parsing")

    statuslogger_parser.add_argument('-dl', '--debug_log_prefix',
                                     default='debug.log',
                                     help='if debug.log in the diag tarball has an oddball name, ' + \
                                         'can still look based on this prefix ' + \
                                         '(default "debug.log")')
    statuslogger_parser.add_argument('-sl', '--system_log_prefix',
                                     default='system.log',
                                     help='if system.log in the diag tarball has an oddball name, ' + \
                                         'can still look based on this prefix ' + \
                                         '(default "system.log")')
    flags.files_and_diag(statuslogger_parser)
    statuslogger_parser.set_defaults(func=run_default_func)
示例#5
0
def add_flags(subparsers, run_default_func, is_deprecated=True):
    """add flags used to share code between deprecated and supported commands"""
    help_text = "Generates a report of slow queries in debug log. DSE 6.0-6.8"
    if is_deprecated:
        help_text = help_text + ". DEPRECATED use 'sperf core slowquery' instead"
    slowquery_parser = subparsers.add_parser(
        "slowquery", help=help_text, formatter_class=flags.LineWrapRawTextHelpFormatter
    )
    flags.files_and_diag(slowquery_parser)
    slowquery_parser.add_argument(
        "-i",
        "--interval",
        type=int,
        nargs="?",
        const=3600,
        default=3600,
        help="interval to report on in seconds (default 3600)",
    )
    slowquery_parser.add_argument(
        "-t",
        "--top",
        type=int,
        nargs="?",
        const=3,
        default=3,
        help="number of top queries to show (default 3)",
    )
    slowquery_parser.add_argument(
        "-st",
        "--start",
        type=str,
        nargs="?",
        const=None,
        default=None,
        help="start date/time to begin parsing (format: YYYY-MM-DD hh:mm:ss,SSS)",
    )
    slowquery_parser.add_argument(
        "-et",
        "--end",
        type=str,
        nargs="?",
        const=None,
        default=None,
        help="end date/time to stop parsing (format: YYYY-MM-DD hh:mm:ss,SSS)",
    )
    slowquery_parser.set_defaults(func=run_default_func)
示例#6
0
def add_flags(subparsers, run_func, is_deprecated=False):
    """add_flags is so we can share logic between deprecated and new commands"""
    help_text = (
        "Generates a report of filter cache evictions. DSE Search 5.0.5+,5.1-6.7."
    )
    if is_deprecated:
        help_text = help_text + " DEPRECATED for 'sperf search filtercache'"
    filtercache_parser = subparsers.add_parser(
        "filtercache",
        help=help_text,
        formatter_class=flags.LineWrapRawTextHelpFormatter,
    )
    flags.files_and_diag(filtercache_parser)
    filtercache_parser.add_argument(
        "-s",
        "--system_log_prefix",
        default="system.log",
        help="if system.log in the diag tarball has a different, " +
        "name, sperf can still look based on this prefix " +
        '(default "system.log")',
    )
    filtercache_parser.add_argument(
        "-a",
        "--after",
        default="0001-01-01 00:00:00,000000",
        help=
        "optional filter for log times to only look at logs after this time " +
        "(format: YYYY-MM-DD hh:mm:ss,SSS)",
    )
    filtercache_parser.add_argument(
        "-b",
        "--before",
        default="9999-12-31 23:59:59,999999",
        help=
        "optional filter for log times to only look at logs before this time "
        + "(format: YYYY-MM-DD hh:mm:ss,SSS)",
    )
    filtercache_parser.add_argument(
        "-r",
        "--report",
        default="summary",
        help="type of report to display (summary, time_series)",
    )
    filtercache_parser.set_defaults(func=run_func)
示例#7
0
def add_flags(subparsers, name, run_default_func, is_deprecated=False):
    """adds the flags so legacy commands can share code"""
    help_text = (
        "Tries to summarize queries in the debug "
        + "log based on score that attempts to "
        + "estimate the relative potential cost "
        + "of queries. DSE Search 5.0-6.7"
    )
    if is_deprecated:
        help_text = help_text + ". DEPRECATED use 'sperf search queryscore' instead"
    queryscore_parser = subparsers.add_parser(
        name, help=help_text, formatter_class=flags.LineWrapRawTextHelpFormatter
    )

    queryscore_parser.add_argument(
        "-s",
        "--scorethreshold",
        type=int,
        default=1,
        help="The score threshold to list a 'bad query'",
    )
    queryscore_parser.add_argument(
        "-t",
        "--top",
        type=int,
        default=5,
        help="show the top N worst queries by score.",
    )
    queryscore_parser.add_argument(
        "-u",
        "--uniquereasons",
        action="store_true",
        help="show only queries with a unique score and combination of reasons.",
    )
    queryscore_parser.add_argument(
        "-l",
        "--log_prefix",
        default="debug.log",
        help="if debug.log in the diag tarball has a different, "
        + "name, sperf can still look based on this prefix "
        + '(default "debug.log")',
    )
    flags.files_and_diag(queryscore_parser)
    queryscore_parser.set_defaults(func=run_default_func)
示例#8
0
def add_flags(subparsers, run_default_func, is_deprecated=True):
    """add flags used to share code between deprecated and supported commands"""
    help_text = 'Generates a report of slow queries in debug log. DSE 6.0-6.7'
    if is_deprecated:
        help_text = help_text + ". DEPRECATED use 'sperf core slowquery' instead"
    slowquery_parser = subparsers.add_parser(
        'slowquery',
        help=help_text,
        formatter_class=flags.LineWrapRawTextHelpFormatter)
    flags.files_and_diag(slowquery_parser)
    slowquery_parser.add_argument(
        '-i',
        '--interval',
        type=int,
        nargs='?',
        const=3600,
        default=3600,
        help="interval to report on in seconds (default 3600)")
    slowquery_parser.add_argument(
        '-t',
        '--top',
        type=int,
        nargs='?',
        const=3,
        default=3,
        help="number of top queries to show (default 3)")
    slowquery_parser.add_argument('-st',
                                  '--start',
                                  type=str,
                                  nargs='?',
                                  const=None,
                                  default=None,
                                  help="start date/time to begin parsing")
    slowquery_parser.add_argument('-et',
                                  '--end',
                                  type=str,
                                  nargs='?',
                                  const=None,
                                  default=None,
                                  help="end date/time to stop parsing")
    slowquery_parser.set_defaults(func=run_default_func)
示例#9
0
def add_flags(subparsers, run_func, is_deprecated=False):
    """add_flags is so we can share logic between deprecated and new commands"""
    help_text = 'Generates a report of filter cache evictions. DSE Search 5.0.5+,5.1-6.7.'
    if is_deprecated:
        help_text = help_text + " DEPRECATED for 'sperf search filtercache'"
    filtercache_parser = subparsers.add_parser(
        'filtercache',
        help=help_text,
        formatter_class=flags.LineWrapRawTextHelpFormatter)
    flags.files_and_diag(filtercache_parser)
    filtercache_parser.add_argument('-s', '--system_log_prefix',
                                    default='system.log',
                                    help='if system.log in the diag tarball has a different, ' + \
                                            'name, sperf can still look based on this prefix ' + \
                                         '(default "system.log")')
    filtercache_parser.add_argument('-a', '--after',
                                    default='0001-01-01 00:00:00,000000',
                                    help='optional filter for log times to only look at ' + \
                                            'logs after this time')
    filtercache_parser.add_argument('-b', '--before',
                                    default='9999-12-31 23:59:59,999999',
                                    help='optional filter for log times to only look at ' + \
                                            'logs before this time')
    filtercache_parser.set_defaults(func=run_func)
示例#10
0
def add_flags(subparsers, run_default_func, is_deprecated=False):
    """for code sharing of flags between deprecated and supported"""
    help_text = "Provides analysis of StatusLogger log lines. DSE 5.0-6.8"
    if is_deprecated:
        help_text = help_text + ". DEPRECATED use 'sperf core statuslogger' instead"
    statuslogger_parser = subparsers.add_parser(
        "statuslogger",
        help=help_text,
        formatter_class=flags.LineWrapRawTextHelpFormatter,
    )
    statuslogger_parser.add_argument(
        "-r",
        "--reporter",
        type=str,
        nargs="?",
        const="summary",
        default="summary",
        help="report to run, either summary or histogram (default summary)",
    )
    statuslogger_parser.add_argument(
        "-s",
        "--stages",
        type=str,
        nargs="?",
        default="all",
        help="csv list of stage prefixes to collect, or 'all' (default: all)",
    )
    statuslogger_parser.add_argument(
        "-st",
        "--start",
        type=str,
        nargs="?",
        const=None,
        default=None,
        help=
        "start date/time to begin parsing (format: YYYY-MM-DD hh:mm:ss,SSS)",
    )
    statuslogger_parser.add_argument(
        "-et",
        "--end",
        type=str,
        nargs="?",
        const=None,
        default=None,
        help="end date/time to stop parsing (format: YYYY-MM-DD hh:mm:ss,SSS)",
    )

    statuslogger_parser.add_argument(
        "-dl",
        "--debug_log_prefix",
        default="debug.log",
        help="if debug.log in the diag tarball has an oddball name, " +
        "can still look based on this prefix " + '(default "debug.log")',
    )
    statuslogger_parser.add_argument(
        "-sl",
        "--system_log_prefix",
        default="system.log",
        help="if system.log in the diag tarball has an oddball name, " +
        "can still look based on this prefix " + '(default "system.log")',
    )
    flags.files_and_diag(statuslogger_parser)
    statuslogger_parser.set_defaults(func=run_default_func)