本文整理汇总了Java中com.yammer.metrics.core.MetricsRegistry类的典型用法代码示例。如果您正苦于以下问题:Java MetricsRegistry类的具体用法?Java MetricsRegistry怎么用?Java MetricsRegistry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MetricsRegistry类属于com.yammer.metrics.core包,在下文中一共展示了MetricsRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startAll
import com.yammer.metrics.core.MetricsRegistry; //导入依赖的package包/类
public void startAll() throws Exception {
final PropertiesConfiguration broker = brokerProperties();
final PropertiesConfiguration server = serverProperties();
log(broker, "broker");
log(server, "server");
System.out.println("************************ 1");
serverInstance = new ServerInstance();
System.out.println("************************ 2");
serverInstance.init(new ServerConf(server), new MetricsRegistry());
System.out.println("************************ 3");
bld = new BrokerServerBuilder(broker, null, null, null);
System.out.println("************************ 4");
bld.buildNetwork();
System.out.println("************************ 5");
bld.buildHTTP();
System.out.println("************************ 6");
startServer();
startBroker();
}
示例2: KeyedPoolImpl
import com.yammer.metrics.core.MetricsRegistry; //导入依赖的package包/类
public KeyedPoolImpl(int minResourcesPerKey, int maxResourcesPerKey, long idleTimeoutMs,
int maxPendingCheckoutRequests, PooledResourceManager<K, T> resourceManager,
ScheduledExecutorService timeoutExecutorService, ExecutorService executorService, MetricsRegistry registry) {
_keyedPool = new ConcurrentHashMap<K, AsyncPool<T>>();
_pooledResourceManagerMap = new ConcurrentHashMap<K, AsyncPoolResourceManagerAdapter<K, T>>();
_minResourcesPerKey = minResourcesPerKey;
_maxResourcesPerKey = maxResourcesPerKey;
_idleTimeoutMs = idleTimeoutMs;
_maxPendingCheckoutRequests = maxPendingCheckoutRequests;
_timeoutExecutor = timeoutExecutorService;
_executorService = executorService;
_resourceManager = resourceManager;
_state = State.INIT;
_metricRegistry = registry;
_poolStats = new AggregatedPoolStats<Histogram>();
}
示例3: setup
import com.yammer.metrics.core.MetricsRegistry; //导入依赖的package包/类
private void setup() {
MetricsRegistry registry = new MetricsRegistry();
_timedExecutor = new ScheduledThreadPoolExecutor(1);
_service = new ThreadPoolExecutor(10, 10, 10, TimeUnit.DAYS, new LinkedBlockingDeque<Runnable>());
_eventLoopGroup = new NioEventLoopGroup(10);
_timer = new HashedWheelTimer();
NettyClientMetrics clientMetrics = new NettyClientMetrics(registry, "client_");
PooledNettyClientResourceManager rm = new PooledNettyClientResourceManager(_eventLoopGroup, _timer, clientMetrics);
_pool =
new KeyedPoolImpl<ServerInstance, NettyClientConnection>(1, _maxActiveConnections, 300000, 10, rm,
_timedExecutor, MoreExecutors.sameThreadExecutor(), registry);
rm.setPool(_pool);
_scatterGather = new ScatterGatherImpl(_pool, _service);
for (AsyncReader r : _readerThreads) {
r.start();
}
}
示例4: testMetricsHelperRegistration
import com.yammer.metrics.core.MetricsRegistry; //导入依赖的package包/类
@Test
public void testMetricsHelperRegistration() {
listenerOneOkay = false;
listenerTwoOkay = false;
Map<String, String> configKeys = new HashMap<String, String>();
configKeys.put("pinot.broker.metrics.metricsRegistryRegistrationListeners",
ListenerOne.class.getName() + "," + ListenerTwo.class.getName());
Configuration configuration = new MapConfiguration(configKeys);
MetricsRegistry registry = new MetricsRegistry();
// Initialize the MetricsHelper and create a new timer
MetricsHelper.initializeMetrics(configuration.subset("pinot.broker.metrics"));
MetricsHelper.registerMetricsRegistry(registry);
MetricsHelper.newTimer(registry, new MetricName(MetricsHelperTest.class, "dummy"), TimeUnit.MILLISECONDS, TimeUnit.MILLISECONDS);
// Check that the two listeners fired
assertTrue(listenerOneOkay);
assertTrue(listenerTwoOkay);
}
示例5: setup
import com.yammer.metrics.core.MetricsRegistry; //导入依赖的package包/类
@BeforeClass
public void setup() throws Exception {
File confDir = new File(QueryExecutorTest.class.getClassLoader().getResource("conf").toURI());
setupSegmentList(2);
// ServerBuilder serverBuilder = new ServerBuilder(confDir.getAbsolutePath());
String configFilePath = confDir.getAbsolutePath();
// build _serverConf
PropertiesConfiguration serverConf = new PropertiesConfiguration();
serverConf.setDelimiterParsingDisabled(false);
serverConf.load(new File(configFilePath, PINOT_PROPERTIES));
FileBasedInstanceDataManager instanceDataManager = FileBasedInstanceDataManager.getInstanceDataManager();
instanceDataManager.init(new FileBasedInstanceDataManagerConfig(serverConf.subset("pinot.server.instance")));
instanceDataManager.start();
for (int i = 0; i < 2; ++i) {
instanceDataManager.getTableDataManager("midas");
instanceDataManager.getTableDataManager("midas").addSegment(_indexSegmentList.get(i));
}
_queryExecutor = new ServerQueryExecutorV1Impl();
_queryExecutor.init(serverConf.subset("pinot.server.query.executor"), instanceDataManager, new ServerMetrics(
new MetricsRegistry()));
}
示例6: setup
import com.yammer.metrics.core.MetricsRegistry; //导入依赖的package包/类
@BeforeClass
public void setup() throws Exception {
File confDir = new File(QueryExecutorTest.class.getClassLoader().getResource("conf").toURI());
setupSegmentList(2);
FileUtils.deleteDirectory(new File("/tmp/pinot/test1"));
// ServerBuilder serverBuilder = new ServerBuilder(confDir.getAbsolutePath());
String configFilePath = confDir.getAbsolutePath();
// build _serverConf
PropertiesConfiguration serverConf = new PropertiesConfiguration();
serverConf.setDelimiterParsingDisabled(false);
serverConf.load(new File(configFilePath, PINOT_PROPERTIES));
FileBasedInstanceDataManager instanceDataManager1 = FileBasedInstanceDataManager.getInstanceDataManager();
instanceDataManager1.init(new FileBasedInstanceDataManagerConfig(serverConf.subset("pinot.server.instance")));
instanceDataManager1.start();
for (int i = 0; i < 2; ++i) {
instanceDataManager1.getTableDataManager("midas");
instanceDataManager1.getTableDataManager("midas").addSegment(_indexSegmentList.get(i));
}
_queryExecutor = new ServerQueryExecutorV1Impl();
_queryExecutor.init(serverConf.subset("pinot.server.query.executor"), instanceDataManager1, new ServerMetrics(new MetricsRegistry()));
}
示例7: setup
import com.yammer.metrics.core.MetricsRegistry; //导入依赖的package包/类
@BeforeClass
public void setup() throws Exception {
CONFIG_BUILDER = new TestingServerPropertiesBuilder("testTable");
setupSegmentFor("testTable");
setUpTestQueries("testTable");
final PropertiesConfiguration serverConf = CONFIG_BUILDER.build();
serverConf.setDelimiterParsingDisabled(false);
final FileBasedInstanceDataManager instanceDataManager = FileBasedInstanceDataManager.getInstanceDataManager();
instanceDataManager.init(new FileBasedInstanceDataManagerConfig(serverConf.subset("pinot.server.instance")));
instanceDataManager.start();
System.out.println("************************** : " + new File(INDEX_DIR, "segment").getAbsolutePath());
File segmentFile = new File(INDEX_DIR, "segment").listFiles()[0];
segmentName = segmentFile.getName();
final IndexSegment indexSegment = ColumnarSegmentLoader.load(segmentFile, ReadMode.heap);
instanceDataManager.getTableDataManager("testTable");
instanceDataManager.getTableDataManager("testTable").addSegment(indexSegment);
QUERY_EXECUTOR = new ServerQueryExecutorV1Impl(false);
QUERY_EXECUTOR.init(serverConf.subset("pinot.server.query.executor"), instanceDataManager, new ServerMetrics(
new MetricsRegistry()));
}
示例8: setup
import com.yammer.metrics.core.MetricsRegistry; //导入依赖的package包/类
@BeforeClass
public void setup() throws Exception {
CONFIG_BUILDER = new TestingServerPropertiesBuilder("testTable");
setupSegmentFor("testTable");
final PropertiesConfiguration serverConf = CONFIG_BUILDER.build();
serverConf.setDelimiterParsingDisabled(false);
final FileBasedInstanceDataManager instanceDataManager = FileBasedInstanceDataManager.getInstanceDataManager();
instanceDataManager.init(new FileBasedInstanceDataManagerConfig(serverConf.subset("pinot.server.instance")));
instanceDataManager.start();
System.out.println("************************** : " + new File(INDEX_DIR, "segment").getAbsolutePath());
File segmentFile = new File(INDEX_DIR, "segment").listFiles()[0];
segmentName = segmentFile.getName();
final IndexSegment indexSegment = ColumnarSegmentLoader.load(segmentFile, ReadMode.heap);
instanceDataManager.getTableDataManager("testTable");
instanceDataManager.getTableDataManager("testTable").addSegment(indexSegment);
QUERY_EXECUTOR = new ServerQueryExecutorV1Impl(false);
QUERY_EXECUTOR.init(serverConf.subset("pinot.server.query.executor"), instanceDataManager, new ServerMetrics(
new MetricsRegistry()));
}
示例9: setup
import com.yammer.metrics.core.MetricsRegistry; //导入依赖的package包/类
@BeforeClass
public void setup() throws Exception {
PINOT_SCHEMA = getTestSchema();
PINOT_SCHEMA.setSchemaName("realtimeSchema");
AVRO_RECORD_TRANSFORMER = new AvroRecordToPinotRowGenerator(PINOT_SCHEMA);
final IndexSegment indexSegment = getRealtimeSegment();
setUpTestQueries("testTable");
CONFIG_BUILDER = new TestingServerPropertiesBuilder("testTable");
final PropertiesConfiguration serverConf = CONFIG_BUILDER.build();
serverConf.setDelimiterParsingDisabled(false);
final FileBasedInstanceDataManager instanceDataManager = FileBasedInstanceDataManager.getInstanceDataManager();
instanceDataManager.init(new FileBasedInstanceDataManagerConfig(serverConf.subset("pinot.server.instance")));
instanceDataManager.start();
instanceDataManager.getTableDataManager("testTable");
instanceDataManager.getTableDataManager("testTable").addSegment(indexSegment);
QUERY_EXECUTOR = new ServerQueryExecutorV1Impl(false);
QUERY_EXECUTOR.init(serverConf.subset("pinot.server.query.executor"), instanceDataManager, new ServerMetrics(
new MetricsRegistry()));
}
示例10: ServerBuilder
import com.yammer.metrics.core.MetricsRegistry; //导入依赖的package包/类
/**
* Construct from config file path
* @param configFilePath Path to the config file
* @param metricsRegistry
* @throws Exception
*/
public ServerBuilder(File configFilePath, MetricsRegistry metricsRegistry) throws Exception {
this.metricsRegistry = metricsRegistry;
if (!configFilePath.exists()) {
LOGGER.error("configuration file: " + configFilePath.getAbsolutePath() + " does not exist.");
throw new ConfigurationException("configuration file: " + configFilePath.getAbsolutePath() + " does not exist.");
}
// build _serverConf
PropertiesConfiguration serverConf = new PropertiesConfiguration();
serverConf.setDelimiterParsingDisabled(false);
serverConf.load(configFilePath);
_serverConf = new ServerConf(serverConf);
initMetrics();
}
示例11: init
import com.yammer.metrics.core.MetricsRegistry; //导入依赖的package包/类
/**
* Initialize ServerInstance with ServerConf
* @param serverConf
* @throws InstantiationException
* @throws IllegalAccessException
* @throws ClassNotFoundException
* @throws ConfigurationException
*/
public void init(ServerConf serverConf, MetricsRegistry metricsRegistry) throws InstantiationException, IllegalAccessException,
ClassNotFoundException, ConfigurationException {
_serverConf = serverConf;
LOGGER.info("Trying to build server config");
ServerBuilder serverBuilder = new ServerBuilder(_serverConf, metricsRegistry);
LOGGER.info("Trying to build InstanceDataManager");
_instanceDataManager = serverBuilder.buildInstanceDataManager();
LOGGER.info("Trying to build QueryExecutor");
_queryExecutor = serverBuilder.buildQueryExecutor(_instanceDataManager);
LOGGER.info("Trying to build RequestHandlerFactory");
setRequestHandlerFactory(serverBuilder.buildRequestHandlerFactory(_queryExecutor));
LOGGER.info("Trying to build NettyServer");
_nettyServer = serverBuilder.buildNettyServer(_serverConf.getNettyConfig(), _requestHandlerFactory);
setServerThread(new Thread(_nettyServer));
LOGGER.info("ServerInstance Initialization is Done!");
_serverMetrics = serverBuilder.getServerMetrics();
}
示例12: setUp
import com.yammer.metrics.core.MetricsRegistry; //导入依赖的package包/类
@BeforeTest
public void setUp() throws Exception {
//Process Command Line to get config and port
FileUtils.deleteDirectory(new File("/tmp/pinot/test1"));
setupSegmentList();
File confFile = new File(TestUtils.getFileFromResourceUrl(InstanceServerStarter.class.getClassLoader().getResource("conf/" + PINOT_PROPERTIES)));
// build _serverConf
PropertiesConfiguration serverConf = new PropertiesConfiguration();
serverConf.setDelimiterParsingDisabled(false);
serverConf.load(confFile);
_serverConf = new ServerConf(serverConf);
LOGGER.info("Trying to create a new ServerInstance!");
_serverInstance = new ServerInstance();
LOGGER.info("Trying to initial ServerInstance!");
_serverInstance.init(_serverConf, new MetricsRegistry());
LOGGER.info("Trying to start ServerInstance!");
_serverInstance.start();
_queryExecutor = _serverInstance.getQueryExecutor();
FileBasedInstanceDataManager instanceDataManager = (FileBasedInstanceDataManager) _serverInstance.getInstanceDataManager();
for (int i = 0; i < 2; ++i) {
instanceDataManager.getTableDataManager("testTable");
instanceDataManager.getTableDataManager("testTable").addSegment(_indexSegmentList.get(i));
}
}
示例13: getStats
import com.yammer.metrics.core.MetricsRegistry; //导入依赖的package包/类
@ManagedAttribute
public Map<String, Object> getStats() {
Map<String, Object> stats = new HashMap<String, Object>();
MetricsRegistry registry = Metrics.defaultRegistry();
for (Entry<MetricName, Metric> e : registry.allMetrics().entrySet()) {
MetricName name = e.getKey();
Metric metric = e.getValue();
if (metric instanceof Meter) {
Meter m = (Meter) metric;
stats.put(name.toString(), new MeterPOJO(m));
} else if (metric instanceof Gauge) {
Gauge<?> g = (Gauge<?>) metric;
stats.put(name.toString(), g.value());
}
}
return stats;
}
示例14: StatsdReporter
import com.yammer.metrics.core.MetricsRegistry; //导入依赖的package包/类
public StatsdReporter(MetricsRegistry metricsRegistry, String prefix, MetricPredicate predicate,
UDPSocketProvider socketProvider, Clock clock, VirtualMachineMetrics vm, String name) throws IOException {
super(metricsRegistry, name);
this.socketProvider = socketProvider;
this.vm = vm;
this.clock = clock;
if (prefix != null) {
// Pre-append the "." so that we don't need to make anything
// conditional later.
this.prefix = prefix + ".";
} else {
this.prefix = "";
}
this.predicate = predicate;
this.outputData = new ByteArrayOutputStream();
}
示例15: getCumulativeCounter
import com.yammer.metrics.core.MetricsRegistry; //导入依赖的package包/类
private static Metric getCumulativeCounter(MetricsRegistry metricsRegistry,
MetricMetadata metricMetadata) {
MetricName counterCallbackName = new MetricName(YammerExample.class, "yammer.test.cumulativeCounter");
Metric cumulativeCounter = SfUtil.cumulativeCounter(
metricsRegistry,
counterCallbackName,
metricMetadata,
new Gauge<Long>() {
private long i = 0;
@Override
public Long value() {
return i++;
}
});
metricMetadata.forMetric(cumulativeCounter)
.withSourceName(SIGNAL_FX)
.withDimension(LIBRARY_VERSION, YAMMER);
return cumulativeCounter;
}