• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java TSDB类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.opentsdb.core.TSDB的典型用法代码示例。如果您正苦于以下问题:Java TSDB类的具体用法?Java TSDB怎么用?Java TSDB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TSDB类属于net.opentsdb.core包,在下文中一共展示了TSDB类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: initialize

import net.opentsdb.core.TSDB; //导入依赖的package包/类
@Override
public void initialize(final TSDB tsdb) {
  this.tsdb = tsdb;
  config = new KafkaRpcPluginConfig(tsdb.getConfig());
  consumer_groups = createConsumerGroups();
  LOG.info("Launching " + consumer_groups.size() + " Kafka consumer groups...");
  for (final KafkaRpcPluginGroup group : consumer_groups) {
    group.start();
  }
  LOG.info("Launched " + consumer_groups.size() + " Kafka consumer groups");
  tsdb.getTimer().newTimeout(this, 100, TimeUnit.MILLISECONDS);
  // Sync just in case the HTTP plugin loads or tries to fetch stats before 
  // we finish initializing.
  synchronized (tsdb) {
    KAFKA_RPC_REFERENCE = this;
  }
  LOG.info("Initialized KafkaRpcPlugin.");
}
 
开发者ID:OpenTSDB,项目名称:opentsdb-rpc-kafka,代码行数:19,代码来源:KafkaRpcPlugin.java


示例2: start

import net.opentsdb.core.TSDB; //导入依赖的package包/类
@Override
public synchronized void start() {
  logger.info(String.format("Starting: %s:%s series:%s uids:%s batchSize:%d",
          zkquorum, zkpath, seriesTable, uidsTable, batchSize));
  hbaseClient = new HBaseClient(zkquorum, zkpath);
  try {
      Config config = new Config(false);
      config.overrideConfig("tsd.storage.hbase.data_table", "tsdb");
      config.overrideConfig("tsd.storage.hbase.uid_table", "tsdb-uid");
      config.overrideConfig("tsd.core.auto_create_metrics", "true");
      config.overrideConfig("tsd.storage.enable_compaction", "false");

      tsdb = new TSDB(hbaseClient, config);
  } catch (IOException e) {
      logger.error("tsdb initialization fail: ", e);
  }
  channelCounter.start();
  sinkCounter.start();
  super.start();
}
 
开发者ID:yandex,项目名称:opentsdb-flume,代码行数:21,代码来源:OpenTSDBSink.java


示例3: initialize

import net.opentsdb.core.TSDB; //导入依赖的package包/类
/**
	 * {@inheritDoc}
	 * @see net.opentsdb.tsd.RTPublisher#initialize(net.opentsdb.core.TSDB)
	 */
	@Override
	public void initialize(final TSDB tsdb) {
		log.info(">>>>> Initializing KafkaRTPublisher...");
		final Map<String, String> config = tsdb.getConfig().getMap();
		final Properties p = new Properties();		
		p.putAll(config);
		final Properties rtpConfig = Props.extract(CONFIG_PREFIX, p, true, true);
		for(final String key: rtpConfig.stringPropertyNames()) {
			rtpConfig.setProperty("kafka.producer." + key , rtpConfig.getProperty(key));
//			rtpConfig.remove(key);
		}
		log.info("EXTRACTED Config:" + rtpConfig);
		kafkaSender = KafkaProducerService.getInstance(rtpConfig);
		messageQueue = MessageQueue.getInstance(getClass().getSimpleName(), this, rtpConfig);
		topicName = rtpConfig.getProperty("kafka.producer.topic.name");
				
		log.info("<<<<< KafkaRTPublisher initialized.");
	}
 
开发者ID:nickman,项目名称:HeliosStreams,代码行数:23,代码来源:KafkaRTPublisher.java


示例4: newTSDB

import net.opentsdb.core.TSDB; //导入依赖的package包/类
/**
	 * Creates a new test TSDB
	 * @param configName The config name to configure with
	 * @return the created test TSDB
	 */
	public static TSDB newTSDB(String configName)  {		
		try {
			tsdb = new TSDB(getConfig(configName));
			tsdb.getConfig().overrideConfig("helios.config.name", configName);
			Config config = tsdb.getConfig();
			StringBuilder b = new StringBuilder("\n\t=============================================\n\tTSDB Config\n\t=============================================");
			for(Map.Entry<String, String> entry: config.getMap().entrySet()) {
				b.append("\n\t").append(entry.getKey()).append("\t:[").append(entry.getValue()).append("]");
			}
			b.append("\n\t=============================================\n");
//			log(b.toString());
			tsdb.initializePlugins(true);
			final UniqueIdRegistry reg = UniqueIdRegistry.getInstance(tsdb);
			tagKunik = reg.getTagKUniqueId();
			tagVunik = reg.getTagVUniqueId();
			tagMunik = reg.getMetricsUniqueId();
			return tsdb;
		} catch (Exception e) {
			throw new RuntimeException("Failed to get test TSDB [" + configName + "]", e);
		}		
	}
 
开发者ID:nickman,项目名称:HeliosStreams,代码行数:27,代码来源:BaseTest.java


示例5: before

import net.opentsdb.core.TSDB; //导入依赖的package包/类
@Before
public void before() throws Exception {
  tsdb = PowerMockito.mock(TSDB.class);
  config = new Config(false);
  connection_manager = mock(PoolingNHttpClientConnectionManager.class);
  client_builder = mock(HttpAsyncClientBuilder.class);
  client = mock(CloseableHttpAsyncClient.class);
  ts_meta_schema = mock(TSMetaSchema.class);
  uid_meta_schema = mock(UIDMetaSchema.class);
  annotation_schema = mock(AnnotationSchema.class);
  
  config.overrideConfig("tsd.search.elasticsearch.host", "localhost:9200");
  
  when(tsdb.getConfig()).thenReturn(config);
  
  PowerMockito.mockStatic(HttpAsyncClients.class);
  when(HttpAsyncClients.custom()).thenReturn(client_builder);
  
  PowerMockito.whenNew(PoolingNHttpClientConnectionManager.class)
    .withAnyArguments().thenReturn(connection_manager);
  when(client_builder.build()).thenReturn(client);
}
 
开发者ID:OpenTSDB,项目名称:opentsdb-elasticsearch,代码行数:23,代码来源:TestElasticSearch.java


示例6: initialize

import net.opentsdb.core.TSDB; //导入依赖的package包/类
@Override
public void initialize(TSDB tsdb) {
  this.tsdb = tsdb;
  config = new KafkaRpcPluginConfig(tsdb.getConfig());

  setKafkaConfig();
  producer = new Producer<String, byte[]>(producer_config);
  LOG.info("Initialized kafka requeue publisher.");
}
 
开发者ID:OpenTSDB,项目名称:opentsdb-rpc-kafka,代码行数:10,代码来源:KafkaStorageExceptionHandler.java


示例7: execute

import net.opentsdb.core.TSDB; //导入依赖的package包/类
@Override
public void execute(final TSDB tsdb, final HttpRpcPluginQuery query) throws IOException {
  // only accept GET/POST for now
  if (query.request().getMethod() != HttpMethod.GET && 
      query.request().getMethod() != HttpMethod.POST) {
    throw new BadRequestException(HttpResponseStatus.METHOD_NOT_ALLOWED, 
        "Method not allowed", "The HTTP method [" + query.method().getName() +
        "] is not permitted for this endpoint");
  }
  
  final String[] uri = query.explodePath();
  final String endpoint = uri.length > 1 ? uri[2].toLowerCase() : "";
  
  if ("version".equals(endpoint)) {
    handleVersion(query);
  } else if ("rate".equals(endpoint)) {
    handleRate(query);
  } else if ("namespace".equals(endpoint)) {
    handlePerNamespaceStats(query);
  } else if ("perthread".equals(endpoint)) {
    handlePerThreadStats(query);
  } else {
    throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, 
        "Hello. You have reached an API that has been disconnected. "
        + "Please call again.");
  }
}
 
开发者ID:OpenTSDB,项目名称:opentsdb-rpc-kafka,代码行数:28,代码来源:KafkaHttpRpcPlugin.java


示例8: before

import net.opentsdb.core.TSDB; //导入依赖的package包/类
@Before
public void before() throws Exception {
  tsdb = PowerMockito.mock(TSDB.class);
  consumer = mock(KafkaRpcPluginThread.class);
  seh = mock(StorageExceptionHandler.class);
  
  when(consumer.getTSDB()).thenReturn(tsdb);
  when(tsdb.getStorageExceptionHandler()).thenReturn(seh);
}
 
开发者ID:OpenTSDB,项目名称:opentsdb-rpc-kafka,代码行数:10,代码来源:TestMetric.java


示例9: setReady

import net.opentsdb.core.TSDB; //导入依赖的package包/类
@Override
public void setReady(TSDB tsdb) {
    LOGGER.debug("OpenTSDB is Ready");
    try {
        register();
    } catch (Exception e) {
        LOGGER.error("Could not register this instance with Consul", e);
    }
}
 
开发者ID:inst-tech,项目名称:opentsdb-plugins,代码行数:10,代码来源:ConsulPlugin.java


示例10: setReady

import net.opentsdb.core.TSDB; //导入依赖的package包/类
@Override
  public void setReady(TSDB tsdb) {
    log.info("OpenTSDB is Ready");
//    Config config = tsdb.getConfig();
//    Integer port = config.getInt("tsd.network.port");
//    log.info("OpenTSDB is listening on " + Integer.toString(port));
    //return;
  }
 
开发者ID:inst-tech,项目名称:opentsdb-plugins,代码行数:9,代码来源:IdentityPlugin.java


示例11: initialize

import net.opentsdb.core.TSDB; //导入依赖的package包/类
@Override
public void initialize(TSDB tsdb) {
    LOG.debug("Initialized Authentication Plugin");
    this.adminAccessKey = tsdb.getConfig().getString("tsd.core.authentication.admin_access_key");
    this.adminSecretKey = tsdb.getConfig().getString("tsd.core.authentication.admin_access_secret");
    storeCredentials(this.adminAccessKey, this.adminSecretKey);
}
 
开发者ID:inst-tech,项目名称:opentsdb-plugins,代码行数:8,代码来源:SimpleAuthenticationPlugin.java


示例12: initialize

import net.opentsdb.core.TSDB; //导入依赖的package包/类
public void initialize(final TSDB tsdb) {
  LOG.info("init RollupPublisher");
  this.tsdb = tsdb;
  this.dataPointsMap = new HashMap<String, DataPoints>();
  Config config = tsdb.getConfig();
  if (config.hasProperty(rollupKey)) {
    this.minutes = tsdb.getConfig().getInt(rollupKey);
  }
  LOG.info("Using window of:" + this.minutes + " minutes");
}
 
开发者ID:inst-tech,项目名称:opentsdb-plugins,代码行数:11,代码来源:RollupPublisher.java


示例13: writePoint

import net.opentsdb.core.TSDB; //导入依赖的package包/类
public Deferred<Object> writePoint(TSDB tsdb) {
  Deferred<Object> d;
  if (Tags.looksLikeInteger(value)) {
    d = tsdb.addPoint(metric, timestamp, Tags.parseLong(value), tags);
  } else {  // floating point value
    d = tsdb.addPoint(metric, timestamp, Float.parseFloat(value), tags);
  }
  return d;
}
 
开发者ID:yandex,项目名称:opentsdb-flume,代码行数:10,代码来源:OpenTSDBSink2.java


示例14: startAnnotationStream

import net.opentsdb.core.TSDB; //导入依赖的package包/类
/**
 * Starts the periodic generation of annotation indexing events using randomly generated values for UIDs.
 * @param tsdb The TSDB to push the annotations to
 * @param quantity The total number of annotations to push
 * @param customs The number of custom map entries per annotation
 * @param period The frequency of publication in ms. Frequencies of less than 1 ms. will push out the entire quantity at once.
 * @return a map of the generated annotations.
 */
public Map<String, Annotation> startAnnotationStream(final TSDB tsdb, int quantity, int customs, final long period) {
	final Map<String, Annotation> annotations = new LinkedHashMap<String, Annotation>(quantity);
	for(int i = 0; i < quantity; i++) {
		Annotation a = new Annotation();
		if(customs>0) {
			HashMap<String, String> custs = new LinkedHashMap<String, String>(customs);
			for(int c = 0; c < customs; c++) {
				String[] frags = getRandomFragments();
				custs.put(frags[0], frags[1]);
			}
			a.setCustom(custs);
		}
		a.setDescription(getRandomFragment());
		long start = nextPosLong();
		a.setStartTime(start);
		a.setEndTime(start + nextPosInt(10000));
		a.setTSUID(getRandomFragment());
		annotations.put(a.getTSUID() + "/" + a.getStartTime(), a);
	}
	Runnable r = new Runnable() {
		@Override
		public void run() {
			try {
				for(Annotation an: annotations.values()) {
					tsdb.indexAnnotation(an);
					if(period>0) {
						Thread.currentThread().join(period);
					}
				}
			} catch (Exception ex) {
				ex.printStackTrace(System.err);
				return;
			}
		}
	};
	startStream(r, "AnnotationStream");
	return annotations;
}
 
开发者ID:nickman,项目名称:HeliosStreams,代码行数:47,代码来源:BaseTest.java


示例15: initialize

import net.opentsdb.core.TSDB; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * @see net.opentsdb.tsd.HttpRpcPlugin#initialize(net.opentsdb.core.TSDB)
 */
@Override
public void initialize(final TSDB tsdb) {
	log.info(">>>>> Initializing MetricsAPIHttpPlugin....");
	this.tsdb = tsdb;
	findContentDir();
	metricsMetaAPI = HubManager.getInstance().getMetricMetaService();
	jsonMetricsService = new JSONMetricsAPIService(metricsMetaAPI);
	log.info("<<<<< MetricsAPIHttpPlugin Initialized.");
}
 
开发者ID:nickman,项目名称:HeliosStreams,代码行数:14,代码来源:MetricsAPIHttpPlugin.java


示例16: execute

import net.opentsdb.core.TSDB; //导入依赖的package包/类
/**
	 * {@inheritDoc}
	 * @see net.opentsdb.tsd.HttpRpcPlugin#execute(net.opentsdb.core.TSDB, net.opentsdb.tsd.HttpRpcPluginQuery)
	 */
	@Override
	public void execute(final TSDB tsdb, final HttpRpcPluginQuery query) throws IOException {
		log.info("HTTP Query: [{}]", query.getQueryBaseRoute());
		final String baseURI = query.request().getUri();
		// ==================================================================
		// If baseURI is MAPI_CONTENT, then serve static content
		// Otherwise delegate to metric api service
		// ==================================================================
		
		query.notFound();
//		if(CONTENT_BASE.equals(baseURI)) {
//			sendFile(CONTENT_BASE + "/index.html", 0);
//			return;
//		}
//	    final String uri = baseURI.replace("metricapi-ui/", "");
//	    if ("/favicon.ico".equals(uri)) {
//	      sendFile(staticDir 
//	          + "/favicon.ico", 31536000 /*=1yr*/);
//	      return;
//	    }
//	    if (uri.length() < 3) {  // Must be at least 3 because of the "/s/".
//	      throw new RuntimeException("URI too short <code>" + uri + "</code>");
//	    }
//	    // Cheap security check to avoid directory traversal attacks.
//	    // TODO(tsuna): This is certainly not sufficient.
//	    if (uri.indexOf("..", 3) > 0) {
//	      throw new RuntimeException("Malformed URI <code>" + uri + "</code>");
//	    }
//	    final int questionmark = uri.indexOf('?', 3);
//	    final int pathend = questionmark > 0 ? questionmark : uri.length();
//	    sendFile(contentDir + "/" 
//	                 + uri.substring(1, pathend),  // Drop the "/s"
//	                   uri.contains("nocache") ? 0 : 31536000 /*=1yr*/);
		

	}
 
开发者ID:nickman,项目名称:HeliosStreams,代码行数:41,代码来源:MetricsAPIHttpPlugin.java


示例17: initialize

import net.opentsdb.core.TSDB; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * @see net.opentsdb.tsd.RpcPlugin#initialize(net.opentsdb.core.TSDB)
 */
@Override
public void initialize(final TSDB tsdb) {
	log.info(">>>>> Initializing TSDBKafkaEndpointPublisher...");
	final Properties properties = new Properties();
	properties.putAll(tsdb.getConfig().getMap());
	final String zkConnect = properties.getProperty("tsd.storage.hbase.zk_quorum", "localhost:2181");
	log.info("ZK Connect: [{}]", zkConnect);
	System.setProperty("streamhub.discovery.zookeeper.connect", zkConnect);
	final String[] rpcPlugins = ConfigurationHelper.getArraySystemThenEnvProperty("tsd.rpc.plugins", new String[]{}, properties);
	Arrays.sort(rpcPlugins);
	if(Arrays.binarySearch(rpcPlugins, "com.heliosapm.opentsdb.jmx.JMXRPC") >= 0) {
		final String host = AgentName.getInstance().getHostName();
		String jmxmpUri = String.format(DEFAULT_JMX_URLS, host);
		Set<String> endpoints = new HashSet<String>();
		endpoints.add("jvm");
		endpoints.add("tsd");
		if(Arrays.binarySearch(rpcPlugins, "com.heliosapm.streams.opentsdb.KafkaRPC") >= 0) {
			endpoints.add("kafka-consumer");
		}
		if(Arrays.binarySearch(rpcPlugins, "com.heliosapm.streams.opentsdb.KafkaRTPublisher") >= 0) {
			endpoints.add("kafka-producer");
		}			
		EndpointPublisher.getInstance().register(jmxmpUri, endpoints.toArray(new String[endpoints.size()]));
	}
	log.info(">>>>> TSDBEndpointPublisher initialized.");
}
 
开发者ID:nickman,项目名称:HeliosStreams,代码行数:31,代码来源:TSDBKafkaEndpointPublisher.java


示例18: InternalStatsCollector

import net.opentsdb.core.TSDB; //导入依赖的package包/类
/**
 * Creates a new InternalStatsCollector
 * @param tsdb The tsdb to write the metrics to
 * @param prefix
 */
public InternalStatsCollector(final TSDB tsdb, final String prefix) {
	super(prefix);		
	this.tsdb = tsdb;
	final Map<String, String> tmp = new LinkedHashMap<String, String>();
	final AgentName am = AgentName.getInstance();
	tmp.put("host", am.getHostName());
	tmp.put("app", am.getAppName());
	atags = Collections.unmodifiableMap(tmp);
	
}
 
开发者ID:nickman,项目名称:HeliosStreams,代码行数:16,代码来源:InternalStatsCollector.java


示例19: initialize

import net.opentsdb.core.TSDB; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * @see net.opentsdb.tsd.HttpRpcPlugin#initialize(net.opentsdb.core.TSDB)
 */
@Override
public void initialize(final TSDB tsdb) {
	log.info(">>>>> Initializing WebSocketRPC service....");
	this.tsdb = tsdb;
	webSockHandler = new WebSocketServiceHandler(tsdb);
	final Properties properties = new Properties();
	final Config cfg = tsdb.getConfig();
	properties.putAll(cfg.getMap());		
	path = metricManager.getAndSetConfig(CONFIG_RPC_PATH, DEFAULT_RPC_PATH, properties, cfg);
	JSONRequestRouter.getInstance().registerJSONService(new SystemJSONServices());
	//JSONRequestRouter.getInstance().registerJSONService(new TSDBJSONService(tsdb));

	log.info("<<<<< WebSocketRPC service Initialized.");
}
 
开发者ID:nickman,项目名称:HeliosStreams,代码行数:19,代码来源:WebSocketRPC.java


示例20: init

import net.opentsdb.core.TSDB; //导入依赖的package包/类
/**
 * Creates the TSDB instance and plugin jar
 */
@BeforeClass
public static void init() {		
	System.setProperty("tsdb.id.host", "helioleopard");
	createPluginJar(KafkaRPC.class);
	Retransformer.getInstance().transform(TSDB.class, TSDBTestTemplate.class);		
	Retransformer.getInstance().transform(RpcManager.class, FakeRpcManager.class);		
	tsdb = newTSDB("coretest");
	RpcManager.instance(tsdb);
	startProducer();
}
 
开发者ID:nickman,项目名称:HeliosStreams,代码行数:14,代码来源:KafkaRPCTest.java



注:本文中的net.opentsdb.core.TSDB类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CertID类代码示例发布时间:2022-05-23
下一篇:
Java Scanner类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap