コード例 #1
0
ファイル: MetricsSystem.java プロジェクト: JoeChien23/tachyon
 /** Registers all the sources configured in the metrics config. */
 private void registerSources() {
   Properties instConfig = mMetricsConfig.getInstanceProperties(mInstance);
   Map<String, Properties> sourceConfigs = mMetricsConfig.subProperties(instConfig, SOURCE_REGEX);
   for (Map.Entry<String, Properties> entry : sourceConfigs.entrySet()) {
     String classPath = entry.getValue().getProperty("class");
     if (classPath != null) {
       try {
         Source source = (Source) Class.forName(classPath).newInstance();
         registerSource(source);
       } catch (Exception e) {
         LOG.error("Source class {} cannot be instantiated", classPath, e);
       }
     }
   }
 }
コード例 #2
0
ファイル: MetricsSystem.java プロジェクト: JoeChien23/tachyon
 /** Registers all the sinks configured in the metrics config. */
 private void registerSinks() {
   Properties instConfig = mMetricsConfig.getInstanceProperties(mInstance);
   Map<String, Properties> sinkConfigs = mMetricsConfig.subProperties(instConfig, SINK_REGEX);
   for (Map.Entry<String, Properties> entry : sinkConfigs.entrySet()) {
     String classPath = entry.getValue().getProperty("class");
     if (classPath != null) {
       try {
         Sink sink =
             (Sink)
                 Class.forName(classPath)
                     .getConstructor(Properties.class, MetricRegistry.class)
                     .newInstance(entry.getValue(), mMetricRegistry);
         if (entry.getKey().equals("servlet")) {
           mMetricsServlet = (MetricsServlet) sink;
         } else {
           mSinks.add(sink);
         }
       } catch (Exception e) {
         LOG.error("Sink class {} cannot be instantiated", classPath, e);
       }
     }
   }
 }