25-Apr-2018 13:33:27 [World Community Grid] Temporarily failed upload of MCM1_0141526_9856_0_r1232334159_0: transient HTTP error
(that's not very helpful...)
| import locale | |
| def convert_number_to_human_readable_string(data, fmt=None, grouping=True, **kwargs): | |
| """Convert number to human-readable string based on locale. Additional kwargs passed to locale.format(). | |
| :param data: Some kind of number. | |
| :type data: int, float, long | |
| :param fmt: (optional) Number format. (default: None) | |
| :param grouping: (optional) Take grouping into account. (default: True) | |
| :type grouping: bool |
| import logging.config | |
| import time | |
| TZ_NAME = time.tzname[0] if not time.localtime().tm_isdst else time.tzname[1] | |
| # Alternatively, convert the localtime to UTC/GMT but if you use this then update | |
| # the logging formatter because this example is using the local timezone. | |
| # logging_handler.formatter.converter = time.gmtime | |
| # This is kept separate as it can be used to apply a default log level to your | |
| # loggers otherwise you can use a method to change this to debug and apply the |
25-Apr-2018 13:33:27 [World Community Grid] Temporarily failed upload of MCM1_0141526_9856_0_r1232334159_0: transient HTTP error
(that's not very helpful...)
____ ___ ____ ____ _ _ ___ __ __ _____ ____
| _ \_ _/ ___| / ___| | / \ |_ _| \/ | ____| _ \
| | | | |\___ \| | | | / _ \ | || |\/| | _| | |_) |
| |_| | | ___) | |___| |___ / ___ \ | || | | | |___| _ <
|____/___|____/ \____|_____/_/ \_\___|_| |_|_____|_| \_\
This is meant as one real-world example of setting up the SignalFx SmartAgent and is not intended to be a replacement for the official documentation. Please make sure that you have read the Kubernetes setup instructions available at https://github.com/signalfx/signalfx-agent/blob/master/docs/kubernetes-setup.md. I am not responsible if you don't read the documentation, you screw something up, or something spontaneously combusts.
| import json | |
| import gzip | |
| import logging | |
| import os | |
| logger = logging.getLogger(os.path.splitext(os.path.basename(__file__))[0]) | |
| def write_gzip_file(path, data, overwrite_existing=False, compression_level=9): |
| import codecs | |
| import logging | |
| import os | |
| logger = logging.getLogger(os.path.splitext(os.path.basename(__file__))[0]) | |
| # NOTE: Python 3.x doesn't have a `unicode()` built-in function. |
| import datetime | |
| import pytz | |
| def convert_dt_to_milliseconds(dt_obj): | |
| """Convert datetime object to a Unix epoch timestamp in milliseconds. | |
| :param dt_obj: Datetime object to be converted. | |
| :type dt_obj: instance | |
| :return: Milliseconds since the Unix epoch. |
| import locale | |
| import logging | |
| import os | |
| logger = logging.getLogger(os.path.splitext(os.path.basename(__file__))[0]) | |
| def set_locale(desired_locale=('en_US', 'UTF-8')): | |
| """Set the local for proper formatting. |
| def flatten(obj, parent_key=None, sep='.'): | |
| """Flattens multi-level dictionary to a single-level dictionary. | |
| :param obj: Dictionary object to flatten. | |
| :type obj: dict | |
| :param parent_key: (optional) Prefix for the flattened key. (default: None) | |
| :type parent_key: basestring, str, or unicode | |
| :param sep: (optional) Separator for the nested key names. (default: '.') | |
| :type sep: basestring, str, or unicode | |
| :return: Sexy flattened dictionary. |