Exemplo n.º 1
0
class GraphiteBackendConfig(MetricsBackend.config_class):
    graphite_url = ConfigText(
        "Url for the graphite web server to query",
        default='http://127.0.0.1:8080')

    prefix = ConfigText(
        "Prefix for all metric names. Defaults to 'go.campaigns'",
        default='go.campaigns')

    persistent = ConfigBool(
        ("Flag given to treq telling it whether to maintain a single "
         "connection for the requests made to graphite's web app."),
        default=True)

    username = ConfigText(
        "Basic auth username for authenticating requests to graphite.",
        required=False)

    password = ConfigText(
        "Basic auth password for authenticating requests to graphite.",
        required=False)

    max_response_size = ConfigInt(
        ("Maximum number of data points to return. If a request specifies a "
         "time range and interval that contains more data than this, it is "
         "rejected."),
        default=10000)

    amqp_hostname = ConfigText(
        "Hostname for where AMQP broker is located",
        default='127.0.0.1')

    amqp_port = ConfigInt(
        "Port to connect to the AMQP broker",
        default=5672)

    amqp_username = ConfigText(
        "Username to connect to the AMQP broker",
        default="guest")

    amqp_password = ConfigText(
        "Password to connect to the AMQP broker",
        default="guest")

    amqp_vhost = ConfigText(
        "Virtualhost for AMQP broker",
        default="/")

    amqp_spec = ConfigText(
        "Spec file for AMQP",
        default="amqp-spec-0-8.xml")

    def post_validate(self):
        auth = (self.username, self.password)
        exists = [x is not None for x in auth]

        if any(exists) and not all(exists):
            raise ConfigError(
                "Either both a username and password need to be given or "
                "neither for graphite backend config")
Exemplo n.º 2
0
class BaseRouterWorkerConfig(BaseWorker.CONFIG_CLASS):
    destinations = ConfigList(
        "The list of configs for the configured destinations of this router",
        required=True, static=True)
    redis_manager = ConfigDict(
        "Redis config.",
        required=True, static=True)
    inbound_ttl = ConfigInt(
        "Maximum time (in seconds) allowed to reply to messages",
        required=True, static=True)
    outbound_ttl = ConfigInt(
        "Maximum time (in seconds) allowed for events to arrive for messages",
        required=True, static=True)
    metric_window = ConfigFloat(
        "Size of the buckets to use (in seconds) for metrics",
        required=True, static=True)
Exemplo n.º 3
0
class SessionLengthMiddlewareConfig(BaseMiddlewareConfig):
    """
    Configuration class for the session length middleware.
    """

    redis = ConfigDict("Redis config", default={}, static=True)
    timeout = ConfigInt("Redis key timeout (secs)", default=600, static=True)
    field_name = ConfigText(
        "Field name in message helper_metadata", default="session",
        static=True)
Exemplo n.º 4
0
class SessionLengthMiddlewareConfig(BaseMiddlewareConfig):
    """
    Configuration class for the session length middleware.
    """

    redis_manager = ConfigDict("Redis config", default={}, static=True)
    timeout = ConfigInt("Redis key timeout (secs)", default=600, static=True)
    namespace_type = ConfigText(
        "Namespace to use to lookup and set the (address, timestamp) "
        "key-value pairs in redis. Possible types: "
        "    - transport_name: the message's `transport_name` field is used."
        "    - tag: the tag associated to the message is used. *Note*: this "
        "      requires the `TaggingMiddleware` to be earlier in the "
        "      middleware chain.",
        default='transport_name',
        static=True)
    field_name = ConfigText("Field name in message helper_metadata",
                            default="session",
                            static=True)
Exemplo n.º 5
0
class JunebugConfig(Config):
    interface = ConfigText(
        "Interface to expose the API on",
        default='localhost')

    port = ConfigInt(
        "Port to expose the API on",
        default=8080)

    logfile = ConfigText(
        "File to log to or `None` for no logging",
        default=None)

    sentry_dsn = ConfigText(
        "DSN to send exceptions",
        default=None)

    redis = ConfigDict(
        "Config to use for redis connection",
        default={
            'host': 'localhost',
            'port': 6379,
            'db': 0,
            'password': None
        })

    amqp = ConfigDict(
        "Config to use for amqp connection",
        default={
            'hostname': '127.0.0.1',
            'vhost': '/',
            'port': 5672,
            'db': 0,
            'username': '******',
            'password': '******'
        })

    inbound_message_ttl = ConfigInt(
        "Maximum time (in seconds) allowed to reply to messages",
        default=60 * 10)

    outbound_message_ttl = ConfigInt(
        "Maximum time (in seconds) allowed for events to arrive for messages",
        default=60 * 60 * 24 * 2)

    allow_expired_replies = ConfigBool(
        "If `True` messages with a reply_to that arrive for which the "
        "original inbound cannot be found (possible of the TTL expiring) are "
        "sent as normal outbound messages. ",
        default=False)

    channels = ConfigDict(
        "Mapping between channel types and python classes.",
        default={})

    replace_channels = ConfigBool(
        "If `True`, replaces the default channels with `channels`. If `False`,"
        " `channels` is added to the default channels.",
        default=False)

    routers = ConfigDict(
        "Mapping between router types and python classes.",
        default={})

    replace_routers = ConfigBool(
        "If `True`, replaces the default routers with `routers`. If `False`,"
        "`routers` is added to the default routers.",
        default=False)

    plugins = ConfigList(
        "A list of dictionaries describing all of the enabled plugins. Each "
        "item should have a `type` key, with the full python class name of "
        "the plugin.", default=[])

    metric_window = ConfigFloat(
        "The size of the buckets (in seconds) used for metrics.", default=10.0)

    logging_path = ConfigText(
        "The path to place log files in.", default="logs/")

    log_rotate_size = ConfigInt(
        "The maximum size (in bytes) of a log file before it gets rotated.",
        default=1000000)

    max_log_files = ConfigInt(
        "The maximum amount of log files allowed before old files start to "
        "get deleted. 0 is unlimited.", default=5)

    max_logs = ConfigInt(
        "The maximum amount of logs that is allowed to be retrieved via the "
        "API.", default=100)

    rabbitmq_management_interface = ConfigText(
        "This should be the url string of the rabbitmq management interface."
        "If set, the health of each individual queue will be checked. "
        "This is only available for RabbitMQ",
        default=None)
Exemplo n.º 6
0
class JunebugConfig(Config):
    interface = ConfigText(
        "Interface to expose the API on",
        default='localhost')

    port = ConfigInt(
        "Port to expose the API on",
        default=8080)

    logfile = ConfigText(
        "File to log to or `None` for no logging",
        default=None)

    redis = ConfigDict(
        "Config to use for redis connection",
        default={
            'host': 'localhost',
            'port': 6379,
            'db': 0,
            'password': None
        })

    amqp = ConfigDict(
        "Config to use for amqp connection",
        default={
            'hostname': '127.0.0.1',
            'vhost': '/',
            'port': 5672,
            'db': 0,
            'username': '******',
            'password': '******'
        })

    inbound_message_ttl = ConfigInt(
        "Maximum time (in seconds) allowed to reply to messages",
        default=60 * 10)

    outbound_message_ttl = ConfigInt(
        "Maximum time (in seconds) allowed for events to arrive for messages",
        default=60 * 60 * 24 * 2)

    channels = ConfigDict(
        "Mapping between channel types and python classes.",
        default={})

    replace_channels = ConfigBool(
        "If `True`, replaces the default channels with `channels`. If `False`,"
        " `channels` is added to the default channels.",
        default=False)

    plugins = ConfigList(
        "A list of dictionaries describing all of the enabled plugins. Each "
        "item should have a `type` key, with the full python class name of "
        "the plugin.", default=[])

    metric_window = ConfigFloat(
        "The size of the buckets (in seconds) used for metrics.", default=10.0)

    logging_path = ConfigText(
        "The path to place log files in.", default="logs/")

    log_rotate_size = ConfigInt(
        "The maximum size (in bytes) of a log file before it gets rotated.",
        default=1000000)

    max_log_files = ConfigInt(
        "The maximum amount of log files allowed before old files start to "
        "get deleted. 0 is unlimited.", default=5)

    max_logs = ConfigInt(
        "The maximum amount of logs that is allowed to be retrieved via the "
        "API.", default=100)
Exemplo n.º 7
0
 class ConfigWithFallback(Config):
     text_field = ConfigText("text_field", default="foo")
     int_field = ConfigInt("int_field")
Exemplo n.º 8
0
 class ConfigWithFallback(Config):
     text_field = ConfigText("text_field")
     int_field = ConfigInt("int_field")
Exemplo n.º 9
0
class ToyMiddlewareConfig(BaseMiddlewareConfig):
    """
    Config for the toy middleware.
    """
    param_foo = ConfigInt("Foo parameter", static=True)
    param_bar = ConfigInt("Bar parameter", static=True)
Exemplo n.º 10
0
 class FooConfig(Config):
     foo = ConfigInt("foo")
Exemplo n.º 11
0
        class FooConfig(Config):
            foo = ConfigInt("foo", required=True)

            def post_validate(self):
                if self.foo < 0:
                    self.raise_config_error("'foo' must be non-negative")
Exemplo n.º 12
0
 class FooConfig(Config):
     "Test config."
     foo = ConfigField("foo", required=True, static=True)
     bar = ConfigInt("bar", required=True)