io.micrometer.core.lang.Nullable类的使用及代码示例

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

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

Nullable介绍

暂无

代码示例

代码示例来源:origin: io.micrometer/micrometer-spring-legacy

/**
 * Provides the tags to be associated with metrics that are recorded for the given
 * {@code request} and {@code response} exchange.
 *
 * @param urlTemplate the source URl template, if available
 * @param request     the request
 * @param response    the response (may be {@code null} if the exchange failed)
 * @return the tags
 */
Iterable<Tag> getTags(@Nullable String urlTemplate, HttpRequest request,
           @Nullable ClientHttpResponse response);

代码示例来源:origin: io.micrometer/micrometer-registry-ganglia

/**
 * Get the value associated with a key.
 *
 * @param key Key to lookup in the config.
 * @return Value for the key or null if no key is present.
 */
@Nullable
String get(String key);

代码示例来源:origin: io.annot8/annot8-components-monitor

/**
 * Register a gauge that reports the value of the {@link Number}.
 *
 * @param name Name of the gauge being registered.
 * @param number Thread-safe implementation of {@link Number} used to access the value.
 * @param <T> The type of the state object from which the gauge value is extracted.
 * @return The number that was passed in so the registration can be done as part of an assignment
 *     statement.
 */
@Nullable
<T extends Number> T gauge(String name, T number);

代码示例来源:origin: io.annot8/annot8-components-monitor

/**
 * Register a gauge that reports the value of the {@link Number}.
 *
 * @param name Name of the gauge being registered.
 * @param tags Sequence of dimensions for breaking down the name.
 * @param number Thread-safe implementation of {@link Number} used to access the value.
 * @param <T> The type of the number from which the gauge value is extracted.
 * @return The number that was passed in so the registration can be done as part of an assignment
 *     statement.
 */
@Nullable
<T extends Number> T gauge(String name, Iterable<Tag> tags, T number);

代码示例来源:origin: io.annot8/annot8-components-monitor

/**
 * Register a gauge that reports the value of the object.
 *
 * @param name Name of the gauge being registered.
 * @param obj State object used to compute a value.
 * @param valueFunction Function that produces an instantaneous gauge value from the state object.
 * @param <T> The type of the state object from which the gauge value is extracted.
 * @return The number that was passed in so the registration can be done as part of an assignment
 *     statement.
 */
@Nullable
<T> T gauge(String name, T obj, ToDoubleFunction<T> valueFunction);

代码示例来源:origin: io.micrometer/micrometer-registry-statsd

StatsdGauge(Id id, StatsdLineBuilder lineBuilder, Subscriber<String> subscriber, @Nullable T obj, ToDoubleFunction<T> value, boolean alwaysPublish) {
  super(id);
  this.lineBuilder = lineBuilder;
  this.subscriber = subscriber;
  this.ref = new WeakReference<>(obj);
  this.value = value;
  this.alwaysPublish = alwaysPublish;
}

代码示例来源:origin: io.micrometer/micrometer-spring-legacy

private static String ensureLeadingSlash(@Nullable String uri) {
  if (uri == null)
    return "/";
  return uri.startsWith("/") ? uri : "/" + uri;
}

代码示例来源:origin: io.micrometer/micrometer-spring-legacy

/**
 * Provides tags to be used by {@link LongTaskTimer long task timers}.
 *
 * @param request the HTTP request
 * @param handler the handler for the request
 * @return tags to associate with metrics recorded for the request
 */
@NonNull
Iterable<Tag> httpLongRequestTags(@Nullable HttpServletRequest request, @Nullable Object handler);

代码示例来源:origin: io.micrometer/micrometer-registry-stackdriver

private String metricType(Meter.Id id, @Nullable String statistic) {
  StringBuilder metricType = new StringBuilder("custom.googleapis.com/").append(getConventionName(id));
  if (statistic != null) {
    metricType.append("/").append(statistic);
  }
  return metricType.toString();
}

代码示例来源:origin: io.micrometer/micrometer-registry-statsd

protected String tags(@Nullable Statistic stat, @Nullable String otherTags, String keyValueSeparator, String preamble) {
    String tags = of(stat == null ? null : "statistic" + keyValueSeparator + stat.getTagValueRepresentation(), otherTags)
        .filter(Objects::nonNull)
        .collect(Collectors.joining(","));

    if (!tags.isEmpty())
      tags = preamble + tags;
    return tags;
  }
}

代码示例来源:origin: io.micrometer/micrometer-spring-legacy

@Nullable
private ValueWrapper countGet(Object key) {
  ValueWrapper valueWrapper = delegate.get(key);
  if (valueWrapper != null)
    hitCount.incrementAndGet();
  else
    missCount.incrementAndGet();
  return valueWrapper;
}

代码示例来源:origin: io.micrometer/micrometer-spring-legacy

/**
 * Creates a {@code method} tag based on the {@link HttpServletRequest#getMethod()
 * method} of the given {@code request}.
 *
 * @param request the request
 * @return the method tag whose value is a capitalized method (e.g. GET).
 */
public static Tag method(@Nullable HttpServletRequest request) {
  return request == null ? METHOD_UNKNOWN : Tag.of("method", request.getMethod());
}

代码示例来源:origin: io.micrometer/micrometer-spring-legacy

/**
 * Creates a {@code method} tag based on the status of the given {@code response}.
 *
 * @param response the HTTP response
 * @return the status tag derived from the status of the response
 */
public static Tag status(@Nullable HttpServletResponse response) {
  return response == null ? STATUS_UNKNOWN : Tag.of("status", Integer.toString(response.getStatus()));
}

代码示例来源:origin: io.micrometer/micrometer-registry-atlas

@SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
@Override
public boolean equals(@Nullable Object o) {
  return MeterEquivalence.equals(this, o);
}

代码示例来源:origin: io.micrometer/micrometer-spring-legacy

private static String getStatusMessage(@Nullable ClientHttpResponse response) {
  try {
    if (response == null) {
      return "CLIENT_ERROR";
    }
    return String.valueOf(response.getRawStatusCode());
  } catch (IOException ex) {
    return "IO_ERROR";
  }
}

代码示例来源:origin: io.micrometer/micrometer-spring-legacy

@Nullable
private static HttpStatus extractStatus(HttpServletResponse response) {
  try {
    return HttpStatus.valueOf(response.getStatus());
  } catch (IllegalArgumentException ex) {
    return null;
  }
}

代码示例来源:origin: io.rsocket.rpc/rsocket-rpc-core

@Override
public boolean equals(@Nullable Object o) {
 if (this == o) return true;
 if (o == null || getClass() != o.getClass()) return false;
 Tag that = (Tag) o;
 return Objects.equals(key, that.getKey()) && Objects.equals(value, that.getValue());
}

代码示例来源:origin: io.micrometer/micrometer-registry-wavefront

/**
 * Required when publishing directly to the Wavefront API host, otherwise does nothing.
 *
 * @return The Wavefront API token.
 */
@Nullable
default String apiToken() {
  String v = get(prefix() + ".apiToken");
  return v == null ? null : v.trim().length() > 0 ? v : null;
}

代码示例来源:origin: io.micrometer/micrometer-registry-datadog

/**
 * @return The Datadog application key. This is only required if you care for metadata like base units, description,
 * and meter type to be published to Datadog.
 */
@Nullable
default String applicationKey() {
  return get(prefix() + ".applicationKey");
}

代码示例来源:origin: io.micrometer/micrometer-registry-datadog

/**
 * @return The tag that will be mapped to "host" when shipping metrics to datadog, or {@code null} if
 * host should be omitted on publishing.
 */
@Nullable
default String hostTag() {
  String v = get(prefix() + ".hostTag");
  return v == null ? "instance" : v;
}

相关文章

Nullable类方法