本文整理了Java中com.netflix.spectator.api.Counter.increment()
方法的一些代码示例,展示了Counter.increment()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Counter.increment()
方法的具体详情如下:
包路径:com.netflix.spectator.api.Counter
类名称:Counter
方法名:increment
[英]Update the counter by one.
[中]将计数器更新一次。
代码示例来源:origin: Netflix/zuul
protected static void incrementExceptionCounter(Throwable throwable, String handler) {
registry.counter("server.connection.exception",
"handler", handler,
"id", throwable.getClass().getSimpleName())
.increment();
}
代码示例来源:origin: Netflix/zuul
protected static void incrementExceptionCounter(Throwable throwable) {
registry.counter("server.connection.exception",
"handler", "Http2ConnectionCloseHandler",
"id", throwable.getClass().getSimpleName())
.increment();
}
代码示例来源:origin: Netflix/zuul
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
//super.exceptionCaught(ctx, cause);
errorCounter.increment();
final String mesg = "Exception on Origin channel for origin - " + originName + ". "
+ ChannelUtils.channelInfoForLogging(ctx.channel()) + " - " +
cause.getClass().getCanonicalName() + ": " + cause.getMessage();
closeConnection(ctx, mesg);
if (LOG.isDebugEnabled()) {
LOG.debug(mesg, cause);
}
}
代码示例来源:origin: Netflix/zuul
public ChannelFuture close() {
final ServerStats stats = getServerStats();
stats.decrementOpenConnectionsCount();
closeConnCounter.increment();
return channel.close();
}
代码示例来源:origin: Netflix/zuul
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
//super.channelInactive(ctx);
inactiveCounter.increment();
final String msg = "Client channel for origin - " + originName + " - inactive event has fired. "
+ ChannelUtils.channelInfoForLogging(ctx.channel());
closeConnection(ctx, msg);
}
代码示例来源:origin: Netflix/zuul
@Override
public void incrementConcurrency() throws ZuulFilterConcurrencyExceededException {
final int limit = filterConcurrencyLimit.get();
if ((concurrencyProtectEnabled.get()) && (concurrentCount.get() >= limit)) {
concurrencyRejections.increment();
throw new ZuulFilterConcurrencyExceededException(this, limit);
}
concurrentCount.incrementAndGet();
}
代码示例来源:origin: Netflix/zuul
protected static void incrementErrorCounter(Registry registry, String counterName, String metricId, Http2Exception h2e)
{
String h2Error = h2e.error() != null ? h2e.error().name() : "NA";
String exceptionName = h2e.getClass().getSimpleName();
registry.counter(counterName,
"id", metricId,
"error", h2Error,
"exception", exceptionName)
.increment();
}
代码示例来源:origin: Netflix/zuul
@Override
public void preRequestChecks(HttpRequestMessage zuulRequest) {
if (concurrencyProtectionEnabled.get() && concurrentRequests.get() > concurrencyMax.get()) {
rejectedRequests.increment();
throw new OriginConcurrencyExceededException(getName());
}
concurrentRequests.incrementAndGet();
}
代码示例来源:origin: Netflix/zuul
private void repopulateRetryBody() {
// if SSL origin request body is cached and has been cleared by Netty SslHandler, set it from cache
// note: it's not null but is empty because the content chunks exist but the actual readable bytes are 0
if (sslRetryBodyCache != null && attemptNum > 1 && zuulRequest.getBody() != null && zuulRequest.getBody().length == 0) {
zuulRequest.setBody(sslRetryBodyCache);
populatedSslRetryBody.increment();
}
}
代码示例来源:origin: Netflix/zuul
protected static void incrementExceptionCounter(Throwable throwable, String handler) {
registry.counter("server.connection.exception",
"handler", handler,
"id", throwable.getClass().getSimpleName())
.increment();
}
代码示例来源:origin: Netflix/zuul
protected static void incrementExceptionCounter(Throwable throwable) {
registry.counter("server.connection.exception",
"handler", "Http2ConnectionCloseHandler",
"id", throwable.getClass().getSimpleName())
.increment();
}
代码示例来源:origin: Netflix/zuul
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception
{
if (evt instanceof HttpServerLifecycleChannelHandler.StartEvent) {
incrementCurrentRequestsInFlight(ctx);
}
else if (evt instanceof HttpServerLifecycleChannelHandler.CompleteEvent) {
decrementCurrentRequestsIfOneInflight(ctx);
}
else if (evt instanceof HttpLifecycleChannelHandler.RejectedPipeliningEvent) {
unSupportedPipeliningCounter.increment();
}
super.userEventTriggered(ctx, evt);
}
代码示例来源:origin: Netflix/zuul
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
//super.exceptionCaught(ctx, cause);
errorCounter.increment();
final String mesg = "Exception on Origin channel for origin - " + originName + ". "
+ ChannelUtils.channelInfoForLogging(ctx.channel()) + " - " +
cause.getClass().getCanonicalName() + ": " + cause.getMessage();
closeConnection(ctx, mesg);
if (LOG.isDebugEnabled()) {
LOG.debug(mesg, cause);
}
}
代码示例来源:origin: Netflix/zuul
public ChannelFuture close() {
final ServerStats stats = getServerStats();
stats.decrementOpenConnectionsCount();
closeConnCounter.increment();
return channel.close();
}
代码示例来源:origin: Netflix/zuul
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
//super.channelInactive(ctx);
inactiveCounter.increment();
final String msg = "Client channel for origin - " + originName + " - inactive event has fired. "
+ ChannelUtils.channelInfoForLogging(ctx.channel());
closeConnection(ctx, msg);
}
代码示例来源:origin: Netflix/zuul
@Override
public void incrementConcurrency() throws ZuulFilterConcurrencyExceededException {
final int limit = filterConcurrencyLimit.get();
if ((concurrencyProtectEnabled.get()) && (concurrentCount.get() >= limit)) {
concurrencyRejections.increment();
throw new ZuulFilterConcurrencyExceededException(this, limit);
}
concurrentCount.incrementAndGet();
}
代码示例来源:origin: Netflix/zuul
protected static void incrementErrorCounter(Registry registry, String counterName, String metricId, Http2Exception h2e)
{
String h2Error = h2e.error() != null ? h2e.error().name() : "NA";
String exceptionName = h2e.getClass().getSimpleName();
registry.counter(counterName,
"id", metricId,
"error", h2Error,
"exception", exceptionName)
.increment();
}
代码示例来源:origin: Netflix/zuul
@Override
public void preRequestChecks(HttpRequestMessage zuulRequest) {
if (concurrencyProtectionEnabled.get() && concurrentRequests.get() > concurrencyMax.get()) {
rejectedRequests.increment();
throw new OriginConcurrencyExceededException(getName());
}
concurrentRequests.incrementAndGet();
}
代码示例来源:origin: Netflix/zuul
private void repopulateRetryBody() {
// if SSL origin request body is cached and has been cleared by Netty SslHandler, set it from cache
// note: it's not null but is empty because the content chunks exist but the actual readable bytes are 0
if (sslRetryBodyCache != null && attemptNum > 1 && zuulRequest.getBody() != null && zuulRequest.getBody().length == 0) {
zuulRequest.setBody(sslRetryBodyCache);
populatedSslRetryBody.increment();
}
}
代码示例来源:origin: Netflix/zuul
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception
{
if (evt instanceof HttpServerLifecycleChannelHandler.StartEvent) {
incrementCurrentRequestsInFlight(ctx);
}
else if (evt instanceof HttpServerLifecycleChannelHandler.CompleteEvent) {
decrementCurrentRequestsIfOneInflight(ctx);
}
else if (evt instanceof HttpLifecycleChannelHandler.RejectedPipeliningEvent) {
unSupportedPipeliningCounter.increment();
}
super.userEventTriggered(ctx, evt);
}
内容来源于网络,如有侵权,请联系作者删除!