# Path: collectors/lib/utils.py
# PY3 = sys.version_info[0] > 2
# USER = "nobody"
# def drop_privileges(user=USER):
# def is_sockfile(path):
# def err(msg):
#     def is_numeric(value):
#     def is_numeric(value):
# 
# Path: collectors/etc/g1gc_conf.py
# def get_interval():
# def get_gc_config():


import calendar
import glob
import re
import os
import sys
import time
import traceback
from datetime import datetime, timedelta
from subprocess import Popen, PIPE
from collectors.lib import utils
from collectors.etc import g1gc_conf
            file_handler.seek(pos)

            # Do not use foreach loop because inside function process_gc_record
            # will call file_handler.readline(). The reason is that some GC
            # event are multiline and need to be processed as a whole
            while True:
                line = file_handler.readline()
                if len(line) == 0:
                    break
                pattern_name, matcher = match_pattern(line)
                if pattern_name == GC_START_TIME_PATTERN:
                    year, month, day, hour, minute, second, timezone = [int(matcher.group(i)) for i in range(1, 8)]
                    cause = matcher.group(8)
                    timestamp = true_unix_timestamp(year, month, day, hour, minute, second, timezone)
                    process_gc_record(prefix, file_handler, timestamp, cause, collector)
                else:
                    unmatched_gc_log(line)

        current_timestamp_in_sec = int(time.time())

        if not collector['timestamp'] is None:
            for gen, value in collector['gensize'].items():
                print("%s.gc.g1.gensize %s %s gen=%s" % (prefix, current_timestamp_in_sec, value, gen))

        # publish gc event count metrics
        for event, value in collector['count'].items():
            print("%s.gc.g1.event.count %s %s event=%s" % (prefix, current_timestamp_in_sec, value, event))

    except Exception:
        exc_type, exc_value, exc_traceback = sys.exc_info()

# Path: collectors/lib/utils.py
# PY3 = sys.version_info[0] > 2
# USER = "nobody"
# def drop_privileges(user=USER):
# def is_sockfile(path):
# def err(msg):
#     def is_numeric(value):
#     def is_numeric(value):
# 
# Path: collectors/etc/g1gc_conf.py
# def get_interval():
# def get_gc_config():


# Path: collectors/0/g1gc.py
import calendar
import glob
import re
import os
import sys
import time
import traceback
from datetime import datetime, timedelta
from subprocess import Popen, PIPE
from collectors.lib import utils
from collectors.etc import g1gc_conf

            file_handler.seek(pos)

            # Do not use foreach loop because inside function process_gc_record
            # will call file_handler.readline(). The reason is that some GC
            # event are multiline and need to be processed as a whole
            while True:
                line = file_handler.readline()
                if len(line) == 0:
                    break
                pattern_name, matcher = match_pattern(line)
                if pattern_name == GC_START_TIME_PATTERN:
                    year, month, day, hour, minute, second, timezone = [int(matcher.group(i)) for i in range(1, 8)]
                    cause = matcher.group(8)
                    timestamp = true_unix_timestamp(year, month, day, hour, minute, second, timezone)
                    process_gc_record(prefix, file_handler, timestamp, cause, collector)
                else:
                    unmatched_gc_log(line)

        current_timestamp_in_sec = int(time.time())

        if not collector['timestamp'] is None:
            for gen, value in collector['gensize'].items():
                print("%s.gc.g1.gensize %s %s gen=%s" % (prefix, current_timestamp_in_sec, value, gen))

        # publish gc event count metrics
        for event, value in collector['count'].items():
            print("%s.gc.g1.event.count %s %s event=%s" % (prefix, current_timestamp_in_sec, value, event))

    except Exception:
        exc_type, exc_value, exc_traceback = sys.exc_info()

        utils.err(''.join(