com.codahale.metrics.MetricFilter#ALL源码实例Demo

下面列出了com.codahale.metrics.MetricFilter#ALL 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: spectator   文件: SpectatorReporter.java
/** Create a new instance. */
SpectatorReporter(
    MetricRegistry metricRegistry,
    Registry spectatorRegistry,
    NameFunction nameFunction,
    ValueFunction valueFunction,
    Pattern gaugeCounters) {
  super(metricRegistry,
      "spectator",       // name
      MetricFilter.ALL,  // filter
      TimeUnit.SECONDS,  // rateUnit
      TimeUnit.SECONDS); // durationUnit
  this.spectatorRegistry = spectatorRegistry;
  this.nameFunction = nameFunction;
  this.valueFunction = valueFunction;
  this.gaugeCounters = gaugeCounters;
}
 
源代码2 项目: hudi   文件: DatadogMetricsReporter.java
public DatadogMetricsReporter(HoodieWriteConfig config, MetricRegistry registry) {
  reportPeriodSeconds = config.getDatadogReportPeriodSeconds();
  ApiSite apiSite = config.getDatadogApiSite();
  String apiKey = config.getDatadogApiKey();
  ValidationUtils.checkState(!StringUtils.isNullOrEmpty(apiKey),
      "Datadog cannot be initialized: API key is null or empty.");
  boolean skipValidation = config.getDatadogApiKeySkipValidation();
  int timeoutSeconds = config.getDatadogApiTimeoutSeconds();
  String prefix = config.getDatadogMetricPrefix();
  ValidationUtils.checkState(!StringUtils.isNullOrEmpty(prefix),
      "Datadog cannot be initialized: Metric prefix is null or empty.");
  Option<String> host = Option.ofNullable(config.getDatadogMetricHost());
  List<String> tagList = config.getDatadogMetricTags();
  Option<List<String>> tags = tagList.isEmpty() ? Option.empty() : Option.of(tagList);

  reporter = new DatadogReporter(
      registry,
      new DatadogHttpClient(apiSite, apiKey, skipValidation, timeoutSeconds),
      prefix,
      host,
      tags,
      MetricFilter.ALL,
      TimeUnit.SECONDS,
      TimeUnit.SECONDS
  );
}
 
源代码3 项目: dremio-oss   文件: MetricsConfigurator.java
@JsonCreator
public MetricsConfigurator(
    @JsonProperty("name") String name,
    @JsonProperty("comment") String comment,
    @JsonProperty("reporter") ReporterConfigurator reporter,
    @JsonProperty("includes") List<String> includes,
    @JsonProperty("excludes") List<String> excludes
    ) {
  super();
  this.name = Objects.requireNonNull(name, "All reporters must have a name");
  this.comment = comment;
  this.configurator = Objects.requireNonNull(reporter, () -> String.format("Invalid definition for reporter with name %s. Must define a reporter block.", name));
  this.includes = Optional.ofNullable(includes).orElse(Collections.emptyList());
  this.excludes = Optional.ofNullable(excludes).orElse(Collections.emptyList());

  if (this.includes.isEmpty() && this.excludes.isEmpty()) {
    filter = MetricFilter.ALL;
  } else {
    filter = new IncludesExcludesFilter(includes, excludes);
  }

}
 
源代码4 项目: sofa-jraft   文件: MetricReporter.java
private Builder(MetricRegistry registry) {
    this.registry = registry;
    this.prefix = "";
    this.output = System.out;
    this.locale = Locale.getDefault();
    this.clock = Clock.defaultClock();
    this.timeZone = TimeZone.getDefault();
    this.rateUnit = TimeUnit.SECONDS;
    this.durationUnit = TimeUnit.MILLISECONDS;
    this.filter = MetricFilter.ALL;
    this.disabledMetricAttributes = Collections.emptySet();
}
 
源代码5 项目: incubator-gobblin   文件: ScheduledReporter.java
private MetricFilter createMetricFilter(Config config) {
  if (config.hasPath(METRIC_FILTER_NAME_REGEX) && config.hasPath(METRIC_FILTER_TYPE_LIST)) {
    return MetricFilters.and(new MetricNameRegexFilter(config.getString(METRIC_FILTER_NAME_REGEX)),
        new MetricTypeFilter(config.getString(METRIC_FILTER_TYPE_LIST)));
  }
  if (config.hasPath(METRIC_FILTER_NAME_REGEX)) {
    return new MetricNameRegexFilter(config.getString(METRIC_FILTER_NAME_REGEX));
  }
  if (config.hasPath(METRIC_FILTER_TYPE_LIST)) {
    return new MetricTypeFilter(config.getString(METRIC_FILTER_TYPE_LIST));
  }
  return MetricFilter.ALL;
}
 
源代码6 项目: pmq   文件: MqMetricReporter.java
private Builder(MetricRegistry registry) {
    this.registry = registry;
    this.rateUnit = TimeUnit.MILLISECONDS;
    this.durationUnit = TimeUnit.MILLISECONDS;
    this.filter = MetricFilter.ALL;
    this.tags = new HashMap<>();
}
 
源代码7 项目: pmq   文件: MqMetricReporter.java
private Builder(MetricRegistry registry) {
    this.registry = registry;
    this.rateUnit = TimeUnit.MILLISECONDS;
    this.durationUnit = TimeUnit.MILLISECONDS;
    this.filter = MetricFilter.ALL;
    this.tags = new HashMap<>();
}
 
源代码8 项目: oneops   文件: ElasticsearchReporter.java
private Builder(MetricRegistry registry) {
    this.registry = registry;
    this.clock = Clock.defaultClock();
    this.prefix = null;
    this.rateUnit = TimeUnit.SECONDS;
    this.durationUnit = TimeUnit.MILLISECONDS;
    this.filter = MetricFilter.ALL;
}
 
private static MetricFilter getFilter(final List<String> whitelistMetrics) {
    if (whitelistMetrics == null || whitelistMetrics.isEmpty()) {
        return MetricFilter.ALL;
    }
    return new MetricFilter() {
        @Override
        public boolean matches(String name, com.codahale.metrics.Metric metric) {
            return whitelistMetrics.contains(name);
        }
    };
}
 
private Builder(final MetricRegistry metricRegistry, final CloudWatchAsyncClient cloudWatchAsyncClient, final String namespace) {
    this.metricRegistry = metricRegistry;
    this.cloudWatchAsyncClient = cloudWatchAsyncClient;
    this.namespace = namespace;
    this.percentiles = new Percentile[]{Percentile.P75, Percentile.P95, Percentile.P999};
    this.metricFilter = MetricFilter.ALL;
    this.rateUnit = TimeUnit.SECONDS;
    this.durationUnit = TimeUnit.MILLISECONDS;
    this.globalDimensions = new LinkedHashSet<>();
    this.cwMeterUnit = Optional.empty();
    this.cwRateUnit = toStandardUnit(rateUnit);
    this.cwDurationUnit = toStandardUnit(durationUnit);
    this.clock = Clock.defaultClock();
}
 
源代码11 项目: newts   文件: NewtsReporter.java
private Builder(MetricRegistry registry) {
    this.registry = registry;
    this.rateUnit = TimeUnit.SECONDS;
    this.durationUnit = TimeUnit.MILLISECONDS;
    this.clock = Clock.defaultClock();
    this.filter = MetricFilter.ALL;
}
 
源代码12 项目: lucene-solr   文件: SolrMetricManager.java
/**
 * Retrieve matching metrics and their names.
 *
 * @param registry     registry name.
 * @param metricFilter filter (null is equivalent to {@link MetricFilter#ALL}).
 * @return map of matching names and metrics
 */
public Map<String, Metric> getMetrics(String registry, MetricFilter metricFilter) {
  if (metricFilter == null || metricFilter == MetricFilter.ALL) {
    return registry(registry).getMetrics();
  }
  return registry(registry).getMetrics().entrySet().stream()
      .filter(entry -> metricFilter.matches(entry.getKey(), entry.getValue()))
      .collect(Collectors.toMap(entry -> entry.getKey(), entry -> entry.getValue()));
}
 
源代码13 项目: incubator-gobblin   文件: MetricReportReporter.java
protected Builder() {
  super();
  this.name = "MetricReportReporter";
  this.filter = MetricFilter.ALL;
}
 
源代码14 项目: pmq   文件: MqMeticReporterService.java
private MqMeticReporterService(IMqClientBase mqClientBase) {
	reporter = new MqMetricReporter(MetricSingleton.getMetricRegistry(), "mq-client", MetricFilter.ALL,
			TimeUnit.MILLISECONDS, TimeUnit.MILLISECONDS, null, mqClientBase.getContext());
}
 
private Builder(MetricRegistry registry) {
    this.registry = registry;
    this.filter = MetricFilter.ALL;
    this.rateUnit = TimeUnit.SECONDS;
    this.durationUnit = TimeUnit.MILLISECONDS;
}
 
源代码16 项目: hugegraph   文件: MetricsModule.java
public MetricsModule(TimeUnit rateUnit, TimeUnit durationUnit,
                     boolean showSamples) {
    this(rateUnit, durationUnit, showSamples, MetricFilter.ALL);
}
 
源代码17 项目: hugegraph   文件: ServerReporter.java
private ServerReporter(MetricRegistry registry) {
    this(registry, SECONDS, MILLISECONDS, MetricFilter.ALL);
}
 
private Builder(MetricRegistry registry) {
  this.registry     = registry;
  this.rateUnit     = TimeUnit.SECONDS;
  this.durationUnit = TimeUnit.MILLISECONDS;
  this.filter       = MetricFilter.ALL;
}
 
源代码19 项目: nakadi   文件: NakadiMetricsServlet.java
/**
 * Returns the {@link MetricFilter} that shall be used to filter metrics, or {@link MetricFilter#ALL} if
 * the default should be used.
 */
protected MetricFilter getMetricFilter() {
    // use the default
    return MetricFilter.ALL;
}
 
源代码20 项目: lucene-solr   文件: SolrReporter.java
/**
 * Create a SolrReporter instance.
 * @param solrClientCache client cache to use for constructing SolrClient instances.
 * @param urlProvider what URL to send to.
 * @param metricManager metric manager
 * @param metrics metric specifications to report
 * @param handler handler name to report to
 * @param reporterId my reporter id
 * @param rateUnit rate unit
 * @param durationUnit duration unit
 * @param params request parameters
 * @param skipHistograms if true then don't send histogram metrics
 * @param skipAggregateValues if true then don't send aggregate metrics' individual values
 * @param cloudClient if true then use CloudSolrClient, plain HttpSolrClient otherwise.
 * @param compact if true then use compact representation.
 */
public SolrReporter(SolrClientCache solrClientCache, boolean closeClientCache,
                    Supplier<String> urlProvider, SolrMetricManager metricManager,
                    List<Report> metrics, String handler,
                    String reporterId, TimeUnit rateUnit, TimeUnit durationUnit,
                    SolrParams params, boolean skipHistograms, boolean skipAggregateValues,
                    boolean cloudClient, boolean compact) {
  super(dummyRegistry, "solr-reporter", MetricFilter.ALL, rateUnit, durationUnit, null, true);

  this.metricManager = metricManager;
  this.urlProvider = urlProvider;
  this.reporterId = reporterId;
  if (handler == null) {
    handler = MetricsCollectorHandler.HANDLER_PATH;
  }
  this.handler = handler;
  this.clientCache = solrClientCache;
  this.closeClientCache = closeClientCache;
  this.compiledReports = new ArrayList<>();
  metrics.forEach(report -> {
    MetricFilter filter = new SolrMetricManager.RegexFilter(report.metricFilters);
    try {
      CompiledReport cs = new CompiledReport(report);
      compiledReports.add(cs);
    } catch (PatternSyntaxException e) {
      log.warn("Skipping report with invalid registryPattern: {}", report.registryPattern, e);
    }
  });
  this.skipHistograms = skipHistograms;
  this.skipAggregateValues = skipAggregateValues;
  this.cloudClient = cloudClient;
  this.compact = compact;
  this.params = new ModifiableSolrParams();
  this.params.set(REPORTER_ID, reporterId);
  // allow overrides to take precedence
  if (params != null) {
    this.params.add(params);
  }
  metadata = new HashMap<>();
  metadata.put(REPORTER_ID, reporterId);
}
 
 同类方法