# Path: monasca_notification/common/utils.py
# def get_statsd_client(dimensions=None):
#     local_dims = dimensions.copy() if dimensions else {}
#     local_dims.update(NOTIFICATION_DIMENSIONS)
#     if CONF.statsd.enable:
#         LOG.debug("Establishing connection with statsd on {0}:{1}"
#                   .format(CONF.statsd.host, CONF.statsd.port))
#         client = monascastatsd.Client(name='monasca',
#                                       host=CONF.statsd.host,
#                                       port=CONF.statsd.port,
#                                       dimensions=local_dims)
#     else:
#         LOG.warn("StatsD monitoring disabled. Overriding monascastatsd.Client to use it offline")
#         client = OfflineClient(name='monasca',
#                                host=CONF.statsd.host,
#                                port=CONF.statsd.port,
#                                dimensions=local_dims)
#     return client
# 
# Path: monasca_notification/processors/alarm_processor.py
# CONF = cfg.CONF
# class AlarmProcessor(object):
#     def __init__(self):
#     def _parse_alarm(alarm_data):
#     def _alarm_is_valid(self, alarm):
#     def _build_notification(self, alarm):
#     def to_notification(self, raw_alarm):
# 
# Path: monasca_notification/processors/notification_processor.py
# class NotificationProcessor(object):
#     def __init__(self):
#     def _remaining_plugin_types(self):
#     def insert_configured_plugins(self):
#     def send(self, notifications):


import time
from oslo_config import cfg
from oslo_log import log as logging
from monasca_common.kafka import client_factory
from monasca_notification.common.utils import get_statsd_client
from monasca_notification.processors import alarm_processor as ap
from monasca_notification.processors import notification_processor as np
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.




log = logging.getLogger(__name__)
CONF = cfg.CONF


class NotificationEngine(object):
    def __init__(self):
        self._statsd = get_statsd_client()
        self._consumer = client_factory.get_kafka_consumer(
            CONF.kafka.url,
            CONF.kafka.group,
            CONF.kafka.alarm_topic,
            CONF.zookeeper.url,
            CONF.zookeeper.notification_path,
            CONF.kafka.legacy_kafka_client_enabled)
        self._producer = client_factory.get_kafka_producer(
            CONF.kafka.url,
            CONF.kafka.legacy_kafka_client_enabled)

# Path: monasca_notification/common/utils.py
# def get_statsd_client(dimensions=None):
#     local_dims = dimensions.copy() if dimensions else {}
#     local_dims.update(NOTIFICATION_DIMENSIONS)
#     if CONF.statsd.enable:
#         LOG.debug("Establishing connection with statsd on {0}:{1}"
#                   .format(CONF.statsd.host, CONF.statsd.port))
#         client = monascastatsd.Client(name='monasca',
#                                       host=CONF.statsd.host,
#                                       port=CONF.statsd.port,
#                                       dimensions=local_dims)
#     else:
#         LOG.warn("StatsD monitoring disabled. Overriding monascastatsd.Client to use it offline")
#         client = OfflineClient(name='monasca',
#                                host=CONF.statsd.host,
#                                port=CONF.statsd.port,
#                                dimensions=local_dims)
#     return client
# 
# Path: monasca_notification/processors/alarm_processor.py
# CONF = cfg.CONF
# class AlarmProcessor(object):
#     def __init__(self):
#     def _parse_alarm(alarm_data):
#     def _alarm_is_valid(self, alarm):
#     def _build_notification(self, alarm):
#     def to_notification(self, raw_alarm):
# 
# Path: monasca_notification/processors/notification_processor.py
# class NotificationProcessor(object):
#     def __init__(self):
#     def _remaining_plugin_types(self):
#     def insert_configured_plugins(self):
#     def send(self, notifications):


# Path: monasca_notification/notification_engine.py
import time
from oslo_config import cfg
from oslo_log import log as logging
from monasca_common.kafka import client_factory
from monasca_notification.common.utils import get_statsd_client
from monasca_notification.processors import alarm_processor as ap
from monasca_notification.processors import notification_processor as np

#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.




log = logging.getLogger(__name__)
CONF = cfg.CONF


class NotificationEngine(object):
    def __init__(self):
        self._statsd = get_statsd_client()
        self._consumer = client_factory.get_kafka_consumer(
            CONF.kafka.url,
            CONF.kafka.group,
            CONF.kafka.alarm_topic,
            CONF.zookeeper.url,
            CONF.zookeeper.notification_path,
            CONF.kafka.legacy_kafka_client_enabled)
        self._producer = client_factory.get_kafka_producer(
            CONF.kafka.url,
            CONF.kafka.legacy_kafka_client_enabled)

        self._alarms = ap.AlarmProcessor()