Esempio n. 1
0
def message_produced(logger, value, key, headers, record_metadata):
    status = "PRODUCED"
    offset = record_metadata.offset
    timestamp = record_metadata.timestamp
    topic = record_metadata.topic
    extra = {
        "status": status,
        "offset": offset,
        "timestamp": timestamp,
        "topic": topic,
        "key": key
    }

    info_extra = {**extra, "headers": headers}
    info_message = "Message %s offset=%d timestamp=%d topic=%s, key=%s"
    logger.info(info_message,
                status,
                offset,
                timestamp,
                topic,
                key,
                extra=info_extra)

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

    event_producer_success.labels(event_type=headers["event_type"],
                                  topic=topic).inc()
Esempio n. 2
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)
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)
Esempio n. 4
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])