本文整理汇总了Java中com.codahale.metrics.graphite.PickledGraphite类的典型用法代码示例。如果您正苦于以下问题:Java PickledGraphite类的具体用法?Java PickledGraphite怎么用?Java PickledGraphite使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PickledGraphite类属于com.codahale.metrics.graphite包,在下文中一共展示了PickledGraphite类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: get
import com.codahale.metrics.graphite.PickledGraphite; //导入依赖的package包/类
@Override
public GraphiteSender get() {
switch (configuration.getProtocol()) {
case PICKLE:
return new PickledGraphite(
configuration.getAddress(),
SocketFactory.getDefault(),
configuration.getCharset(),
configuration.getPickleBatchSize());
case TCP:
return new Graphite(configuration.getAddress(), SocketFactory.getDefault(), configuration.getCharset());
case UDP:
return new GraphiteUDP(configuration.getAddress());
default:
throw new IllegalArgumentException("Unknown Graphite protocol \"" + configuration.getProtocol() + "\"");
}
}
开发者ID:graylog-labs,项目名称:graylog-plugin-metrics-reporter,代码行数:18,代码来源:GraphiteSenderProvider.java
示例2: initGraphiteReporter
import com.codahale.metrics.graphite.PickledGraphite; //导入依赖的package包/类
private static void initGraphiteReporter(final GraphiteReporterConfig graphiteReporterConfig) {
HostAndPort hostAndPort = graphiteReporterConfig.getAddress();
InetSocketAddress inetSocketAddress = new InetSocketAddress(hostAndPort.getHost(), hostAndPort.getPort());
GraphiteSender graphiteSender = graphiteReporterConfig.isEnableBatching()
? new PickledGraphite(inetSocketAddress)
: new Graphite(inetSocketAddress);
graphiteReporter = GraphiteReporter.forRegistry(metricRegistry)
.prefixedWith(prefix)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MICROSECONDS)
.withClock(new Clock() {
private long lastReportingTime = 0;
@Override
public long getTick() {
return System.nanoTime();
}
@Override
public synchronized long getTime() {
if (lastReportingTime == 0) {
lastReportingTime = System.currentTimeMillis();
return lastReportingTime;
}
lastReportingTime += graphiteReporterConfig.getReportingIntervalInSeconds() * 1000;
return lastReportingTime;
}
})
.filter(buildMetricFilter(graphiteReporterConfig.getStartsWithFilters(), graphiteReporterConfig.getBlockedStartsWithFilters()))
.build(graphiteSender);
graphiteReporter.start(graphiteReporterConfig.getReportingIntervalInSeconds(), TimeUnit.SECONDS);
}
开发者ID:centro,项目名称:monitoring-center,代码行数:36,代码来源:MonitoringCenter.java
示例3: getReturnsGraphitePickledGraphite
import com.codahale.metrics.graphite.PickledGraphite; //导入依赖的package包/类
@Test
public void getReturnsGraphitePickledGraphite() throws Exception {
final MetricsGraphiteReporterConfiguration configuration = new MetricsGraphiteReporterConfiguration() {
@Override
public GraphiteProtocol getProtocol() {
return GraphiteProtocol.PICKLE;
}
};
final GraphiteSenderProvider provider = new GraphiteSenderProvider(configuration);
final GraphiteSender graphiteSender = provider.get();
assertTrue(graphiteSender instanceof PickledGraphite);
assertFalse(graphiteSender.isConnected());
}
开发者ID:graylog-labs,项目名称:graylog-plugin-metrics-reporter,代码行数:15,代码来源:GraphiteSenderProviderTest.java
示例4: start
import com.codahale.metrics.graphite.PickledGraphite; //导入依赖的package包/类
@Override
public void start() {
LOG.info("Starting Graphite reporter to [host={}; port={}]", host, port);
graphite = new PickledGraphite(new InetSocketAddress(host, port));
reporter = GraphiteReporter.forRegistry(registry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.filter(MetricFilter.ALL)
.build(graphite);
reporter.start(reportEveryMillis, TimeUnit.MILLISECONDS);
}
开发者ID:dmart28,项目名称:gcplot,代码行数:12,代码来源:GraphiteSender.java
示例5: main
import com.codahale.metrics.graphite.PickledGraphite; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
CreeperConfiguration creeperConfiguration = new CreeperConfiguration(buildConfiguration(args));
final JmxReporter jmxReporter = JmxReporter.forRegistry(metrics).build();
jmxReporter.start();
if (creeperConfiguration.isProduction) {
final PickledGraphite pickledGraphite = new PickledGraphite(new InetSocketAddress(creeperConfiguration.graphiteHostname, creeperConfiguration.graphitePort));
final GraphiteReporter reporter = GraphiteReporter.forRegistry(metrics)
.prefixedWith(creeperConfiguration.mudName)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.filter(MetricFilter.ALL)
.build(pickledGraphite);
reporter.start(1, TimeUnit.MINUTES);
}
Files.isDirectory().apply(new File("world/"));
DB db = DBMaker.fileDB(new File("world/" + creeperConfiguration.databaseFileName))
.transactionEnable()
.closeOnJvmShutdown()
.make();
MapDBCreeperStorage mapDBCreeperStorage = new MapDBCreeperStorage(db);
mapDBCreeperStorage.startAsync();
mapDBCreeperStorage.awaitRunning();
PlayerManager playerManager = new PlayerManager(mapDBCreeperStorage, new SessionManager());
playerManager.createAllGauges();
RoomManager roomManager = new RoomManager(playerManager);
startUpMessage("Configuring core systems.");
MapsManager mapsManager = new MapsManager(creeperConfiguration, roomManager);
ChannelUtils channelUtils = new ChannelUtils(playerManager, roomManager);
EntityManager entityManager = new EntityManager(mapDBCreeperStorage, roomManager, playerManager);
GameManager gameManager = new GameManager(mapDBCreeperStorage, creeperConfiguration, roomManager, playerManager, entityManager, mapsManager, channelUtils, HttpClients.createDefault());
startUpMessage("Reading world from disk.");
WorldStorage worldExporter = new WorldStorage(roomManager, mapsManager, gameManager.getFloorManager(), entityManager, gameManager);
worldExporter.readWorldFromDisk();
startUpMessage("Creating and registering Player Management MBeans.");
PlayerManagementManager playerManagementManager = new PlayerManagementManager(gameManager);
playerManagementManager.processPlayersMarkedForDeletion();
playerManagementManager.createAndRegisterAllPlayerManagementMBeans();
startUpMessage("Configuring commands");
ConfigureCommands.configure(gameManager);
startUpMessage("Configure Bank commands");
ConfigureCommands.configureBankCommands(gameManager);
startUpMessage("Configure Locker commands");
ConfigureCommands.configureLockerCommands(gameManager);
startUpMessage("Configure Player Class Selection commands");
ConfigureCommands.configurePlayerClassSelector(gameManager);
startUpMessage("Configuring npcs and merchants");
ConfigureNpc.configure(entityManager, gameManager);
CreeperServer creeperServer = new CreeperServer(creeperConfiguration.telnetPort);
startUpMessage("Generating map data.");
mapsManager.generateAllMaps();
startUpMessage("Creeper MUD engine started");
creeperServer.run(gameManager);
startUpMessage("Creeper MUD engine online");
if (creeperConfiguration.isIrcEnabled) {
startUpMessage("Starting irc server.");
configureIrc(gameManager);
}
}
开发者ID:chriskearney,项目名称:creeper,代码行数:79,代码来源:Main.java
注:本文中的com.codahale.metrics.graphite.PickledGraphite类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论