com.netflix.servo.annotations.Monitor类的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(181)

本文整理了Java中com.netflix.servo.annotations.Monitor类的一些代码示例,展示了Monitor类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Monitor类的具体详情如下:
包路径:com.netflix.servo.annotations.Monitor
类名称:Monitor

Monitor介绍

暂无

代码示例

代码示例来源:origin: Netflix/eureka

@com.netflix.servo.annotations.Monitor(name = METRIC_REGISTRY_PREFIX + "localRegistrySize",
    description = "Count of instances in the local registry", type = DataSourceType.GAUGE)
public int localRegistrySize() {
  return registrySize;
}

代码示例来源:origin: Netflix/servo

/**
 * Verify that the type for the annotated field is numeric.
 */
private static void checkType(
  com.netflix.servo.annotations.Monitor anno, Class<?> type, Class<?> container) {
 if (!isNumericType(type)) {
  final String msg = "annotation of type " + anno.type().name() + " can only be used"
    + " with numeric values, " + anno.name() + " in class " + container.getName()
    + " is applied to a field or method of type " + type.getName();
  throw new IllegalArgumentException(msg);
 }
}

代码示例来源:origin: Netflix/servo

/**
  * Creates a monitor config based on an annotation.
  */
 private static MonitorConfig newConfig(
   Class<?> c,
   String defaultName,
   String id,
   com.netflix.servo.annotations.Monitor anno,
   TagList tags) {
  String name = anno.name();
  if (name.isEmpty()) {
   name = defaultName;
  }
  MonitorConfig.Builder builder = MonitorConfig.builder(name);
  builder.withTag("class", className(c));
  builder.withTag(anno.type());
  builder.withTag(anno.level());
  if (tags != null) {
   builder.withTags(tags);
  }
  if (id != null) {
   builder.withTag("id", id);
  }
  return builder.build();
 }
}

代码示例来源:origin: Netflix/servo

final MonitorConfig config =
  newConfig(obj.getClass(), field.getName(), id, anno, tags);
if (anno.type() == DataSourceType.INFORMATIONAL) {
 monitors.add(new AnnotatedStringMonitor(config, obj, field));
} else {
final MonitorConfig config =
  newConfig(obj.getClass(), method.getName(), id, anno, tags);
if (anno.type() == DataSourceType.INFORMATIONAL) {
 monitors.add(new AnnotatedStringMonitor(config, obj, method));
} else {

代码示例来源:origin: com.netflix.servo/servo-core

/**
  * Creates a monitor config based on an annotation.
  */
 private static MonitorConfig newConfig(
   Class<?> c,
   String defaultName,
   String id,
   com.netflix.servo.annotations.Monitor anno,
   TagList tags) {
  String name = anno.name();
  if (name.isEmpty()) {
   name = defaultName;
  }
  MonitorConfig.Builder builder = MonitorConfig.builder(name);
  builder.withTag("class", className(c));
  builder.withTag(anno.type());
  builder.withTag(anno.level());
  if (tags != null) {
   builder.withTags(tags);
  }
  if (id != null) {
   builder.withTag("id", id);
  }
  return builder.build();
 }
}

代码示例来源:origin: com.netflix.servo/servo-core

final MonitorConfig config =
  newConfig(obj.getClass(), field.getName(), id, anno, tags);
if (anno.type() == DataSourceType.INFORMATIONAL) {
 monitors.add(new AnnotatedStringMonitor(config, obj, field));
} else {
final MonitorConfig config =
  newConfig(obj.getClass(), method.getName(), id, anno, tags);
if (anno.type() == DataSourceType.INFORMATIONAL) {
 monitors.add(new AnnotatedStringMonitor(config, obj, method));
} else {

代码示例来源:origin: Netflix/eureka

/**
 * Gets the threshold for the renewals per minute.
 *
 * @return the integer representing the threshold for the renewals per
 *         minute.
 */
@com.netflix.servo.annotations.Monitor(name = "numOfRenewsPerMinThreshold", type = DataSourceType.GAUGE)
@Override
public int getNumOfRenewsPerMinThreshold() {
  return numberOfRenewsPerMinThreshold;
}

代码示例来源:origin: com.netflix.servo/servo-core

/**
 * Verify that the type for the annotated field is numeric.
 */
private static void checkType(
  com.netflix.servo.annotations.Monitor anno, Class<?> type, Class<?> container) {
 if (!isNumericType(type)) {
  final String msg = "annotation of type " + anno.type().name() + " can only be used"
    + " with numeric values, " + anno.name() + " in class " + container.getName()
    + " is applied to a field or method of type " + type.getName();
  throw new IllegalArgumentException(msg);
 }
}

代码示例来源:origin: Netflix/eureka

@Monitor(name = METRIC_TRANSPORT_PREFIX + "quarantineSize",
      description = "number of servers quarantined", type = DataSourceType.GAUGE)
  public long getQuarantineSetSize() {
    return quarantineSet.size();
  }
}

代码示例来源:origin: Netflix/eureka

@Monitor(name = METRIC_TRANSPORT_PREFIX + "currentSessionDuration",
      description = "Duration of the current session", type = DataSourceType.GAUGE)
  public long getCurrentSessionDuration() {
    return lastReconnectTimeStamp < 0 ? 0 : System.currentTimeMillis() - lastReconnectTimeStamp;
  }
}

代码示例来源:origin: Netflix/eureka

@Monitor(name = METRIC_RESOLVER_PREFIX + "lastLoadTimestamp",
    description = "How much time has passed from last successful async load", type = DataSourceType.GAUGE)
public long getLastLoadTimestamp() {
  return lastLoadTimestamp < 0 ? 0 : System.currentTimeMillis() - lastLoadTimestamp;
}

代码示例来源:origin: Netflix/eureka

@Monitor(name = METRIC_RESOLVER_PREFIX + "lastReloadTimestamp",
      description = "How much time has passed from last successful cluster configuration resolve", type = DataSourceType.GAUGE)
  public long getLastReloadTimestamp() {
    return lastReloadTimestamp < 0 ? 0 : System.currentTimeMillis() - lastReloadTimestamp;
  }
}

代码示例来源:origin: Netflix/eureka

@Monitor(name = METRIC_REPLICATION_PREFIX + "queueSize", description = "Task queue size", type = DataSourceType.GAUGE)
public long getQueueSize() {
  return pendingTasks.size();
}

代码示例来源:origin: Netflix/eureka

@com.netflix.servo.annotations.Monitor(name = "numOfElementsinInstanceCache", description = "Number of overrides in the instance Cache", type = DataSourceType.GAUGE)
public long getNumberofElementsininstanceCache() {
  return overriddenInstanceStatusMap.size();
}

代码示例来源:origin: Netflix/eureka

@Monitor(name = METRIC_REPLICATION_PREFIX + "acceptorQueueSize", description = "Number of tasks waiting in the acceptor queue", type = DataSourceType.GAUGE)
public long getAcceptorQueueSize() {
  return acceptorQueue.size();
}

代码示例来源:origin: Netflix/eureka

@Monitor(name = METRIC_RESOLVER_PREFIX + "endpointsSize",
    description = "How many records are the in the endpoints ref", type = DataSourceType.GAUGE)
public long getEndpointsSize() {
  return resultsRef.get().size();  // return directly from the ref and not the method so as to not trigger warming
}

代码示例来源:origin: Netflix/eureka

/**
 * Get the number of items in the response cache.
 *
 * @return int value representing the number of items in response cache.
 */
@Monitor(name = "responseCacheSize", type = DataSourceType.GAUGE)
public int getCurrentSize() {
  return readWriteCacheMap.asMap().size();
}

代码示例来源:origin: Netflix/eureka

@Monitor(name = METRIC_REPLICATION_PREFIX + "pendingJobRequests", description = "Number of worker threads awaiting job assignment", type = DataSourceType.GAUGE)
public long getPendingJobRequests() {
  return singleItemWorkRequests.availablePermits() + batchWorkRequests.availablePermits();
}

代码示例来源:origin: Netflix/eureka

@Monitor(name = METRIC_REPLICATION_PREFIX + "availableJobs", description = "Number of jobs ready to be taken by the workers", type = DataSourceType.GAUGE)
public long workerTaskQueueSize() {
  return singleItemWorkQueue.size() + batchWorkQueue.size();
}

代码示例来源:origin: Netflix/eureka

static class TaskExecutorMetrics {
  @Monitor(name = METRIC_REPLICATION_PREFIX + "numberOfSuccessfulExecutions", description = "Number of successful task executions", type = DataSourceType.COUNTER)
  volatile long numberOfSuccessfulExecutions;
  @Monitor(name = METRIC_REPLICATION_PREFIX + "numberOfTransientErrors", description = "Number of transient task execution errors", type = DataSourceType.COUNTER)
  volatile long numberOfTransientError;
  @Monitor(name = METRIC_REPLICATION_PREFIX + "numberOfPermanentErrors", description = "Number of permanent task execution errors", type = DataSourceType.COUNTER)
  volatile long numberOfPermanentError;
  @Monitor(name = METRIC_REPLICATION_PREFIX + "numberOfCongestionIssues", description = "Number of congestion issues during task execution", type = DataSourceType.COUNTER)
  volatile long numberOfCongestionIssues;

相关文章