コード例 #1
0
def initialize_metrics(config):
    topic_name = config.event_topic
    for event_type in EventType:
        event_producer_failure.labels(event_type=event_type.name, topic=topic_name)
        event_producer_success.labels(event_type=event_type.name, topic=topic_name)

    rbac_access_denied.labels(required_permission=Permission.READ.value)
    rbac_access_denied.labels(required_permission=Permission.WRITE.value)
コード例 #2
0
def initialize_metrics(config):
    topic_names = {Topic.egress: config.host_egress_topic, Topic.events: config.event_topic}
    for event_type in EventType:
        for topic in Topic:
            event_producer_failure.labels(event_type=event_type.name, topic=topic_names[topic])
            event_producer_success.labels(event_type=event_type.name, topic=topic_names[topic])

    rbac_access_denied.labels(required_permission=Permission.READ.value)
    rbac_access_denied.labels(required_permission=Permission.WRITE.value)
コード例 #3
0
def initialize_metrics(config):
    topic_names = {
        Topic.egress: config.host_egress_topic,
        Topic.events: config.event_topic
    }
    for event_type in EventType:
        for topic in Topic:
            event_producer_failure.labels(event_type=event_type.name,
                                          topic=topic_names[topic])
            event_producer_success.labels(event_type=event_type.name,
                                          topic=topic_names[topic])
コード例 #4
0
def message_not_produced(logger, topic, value, key, headers, error):
    status = "NOT PRODUCED"
    error_message = str(error)
    extra = {"status": status, "topic": topic, "key": key}

    info_extra = {**extra, "headers": headers, "error": error_message}
    info_message = "Message %s topic=%s, key=%s, headers=%s, error=%s"
    logger.error(info_message, status, topic, key, headers, error, extra=info_extra)

    debug_message = "Message topic=%s key=%s value=%s"
    debug_extra = {**extra, "value": value}
    logger.debug(debug_message, topic, key, value, extra=debug_extra)

    event_producer_failure.labels(event_type=headers["event_type"], topic=topic).inc()