Search in sources :

Example 1 with TimeSeriesQuerier

use of com.hortonworks.streamline.streams.metrics.TimeSeriesQuerier in project streamline by hortonworks.

the class TopologyMetricsContainer method initTimeSeriesQuerier.

private TimeSeriesQuerier initTimeSeriesQuerier(Map<String, String> conf, String className) {
    try {
        Class<?> timeSeriesQuerierImplClass = Class.forName(className);
        TimeSeriesQuerier timeSeriesQuerier = (TimeSeriesQuerier) timeSeriesQuerierImplClass.newInstance();
        timeSeriesQuerier.init(conf);
        return timeSeriesQuerier;
    } catch (IllegalAccessException | InstantiationException | ClassNotFoundException | ConfigException e) {
        throw new RuntimeException("Can't initialize Time-series Querier instance - Class Name: " + className, e);
    }
}
Also used : TimeSeriesQuerier(com.hortonworks.streamline.streams.metrics.TimeSeriesQuerier) ConfigException(com.hortonworks.streamline.common.exception.ConfigException)

Example 2 with TimeSeriesQuerier

use of com.hortonworks.streamline.streams.metrics.TimeSeriesQuerier in project streamline by hortonworks.

the class TopologyMetricsContainer method initializeInstance.

@Override
protected TopologyMetrics initializeInstance(Namespace namespace) {
    String streamingEngine = namespace.getStreamingEngine();
    MappedTopologyMetricsImpl metricsImpl;
    // Only Storm is supported as streaming engine
    try {
        metricsImpl = MappedTopologyMetricsImpl.valueOf(streamingEngine);
    } catch (IllegalArgumentException e) {
        throw new RuntimeException("Unsupported streaming engine: " + streamingEngine, e);
    }
    // FIXME: "how to initialize" is up to implementation detail - now we just only consider about Storm implementation
    Map<String, Object> conf = buildStormTopologyMetricsConfigMap(namespace, streamingEngine, subject);
    String className = metricsImpl.getClassName();
    TopologyMetrics topologyMetrics = initTopologyMetrics(conf, className);
    String timeSeriesDB = namespace.getTimeSeriesDB();
    if (timeSeriesDB != null && !timeSeriesDB.isEmpty()) {
        String querierKey = MappedTimeSeriesQuerierImpl.getName(streamingEngine, timeSeriesDB);
        MappedTimeSeriesQuerierImpl timeSeriesQuerierImpl;
        try {
            timeSeriesQuerierImpl = MappedTimeSeriesQuerierImpl.valueOf(querierKey);
        } catch (IllegalArgumentException e) {
            throw new RuntimeException("Unsupported streaming engine and time-series DB combination: " + streamingEngine + " & " + timeSeriesDB, e);
        }
        // FIXME: "how to initialize" is up to implementation detail - now we just only consider about Storm & AMS implementation
        Map<String, String> confTimeSeriesQuerier = buildAMSTimeSeriesQuerierConfigMap(namespace, timeSeriesDB);
        className = timeSeriesQuerierImpl.getClassName();
        TimeSeriesQuerier timeSeriesQuerier = initTimeSeriesQuerier(confTimeSeriesQuerier, className);
        topologyMetrics.setTimeSeriesQuerier(timeSeriesQuerier);
    }
    return topologyMetrics;
}
Also used : TimeSeriesQuerier(com.hortonworks.streamline.streams.metrics.TimeSeriesQuerier) MappedTopologyMetricsImpl(com.hortonworks.streamline.streams.metrics.container.mapping.MappedTopologyMetricsImpl) TopologyMetrics(com.hortonworks.streamline.streams.metrics.topology.TopologyMetrics) MappedTimeSeriesQuerierImpl(com.hortonworks.streamline.streams.metrics.container.mapping.MappedTimeSeriesQuerierImpl)

Aggregations

TimeSeriesQuerier (com.hortonworks.streamline.streams.metrics.TimeSeriesQuerier)2 ConfigException (com.hortonworks.streamline.common.exception.ConfigException)1 MappedTimeSeriesQuerierImpl (com.hortonworks.streamline.streams.metrics.container.mapping.MappedTimeSeriesQuerierImpl)1 MappedTopologyMetricsImpl (com.hortonworks.streamline.streams.metrics.container.mapping.MappedTopologyMetricsImpl)1 TopologyMetrics (com.hortonworks.streamline.streams.metrics.topology.TopologyMetrics)1