/** * 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);
/** * 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);
@Override @NonNull protected TimeUnit getBaseTimeUnit() { return TimeUnit.MILLISECONDS; }
/** * 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);
/** * Provides tags to be associated with metrics for the given {@code request} and * {@code response} exchange. * * @param request the request * @param response the response * @param handler the handler for the request * @param ex the current exception, if any * @return tags to associate with metrics for the request and response exchange */ @NonNull Iterable<Tag> httpRequestTags(@Nullable HttpServletRequest request, @Nullable HttpServletResponse response, @Nullable Object handler, @Nullable Throwable ex); }
/** * 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);
/** * 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);
/** * 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);
SpectatorToDoubleGauge(Clock clock, Id id, @Nullable T obj, ToDoubleFunction<T> f) { super(clock, id, obj); this.f = f; }
public WavefrontNamingConvention(@Nullable String namePrefix) { this(namePrefix, NamingConvention.dot); }
/** * Register a gauge that reports the size of the {@link Collection}. The registration will keep a * weak reference to the collection so it will not prevent garbage collection. The collection * implementation used should be thread safe. Note that calling {@link Collection#size()} can be * expensive for some collection implementations and should be considered before registering. * * @param name Name of the gauge being registered. * @param tags Sequence of dimensions for breaking down the name. * @param collection Thread-safe implementation of {@link Collection} 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 Collection<?>> T gaugeCollectionSize(String name, Iterable<Tag> tags, T collection);
DatadogMetricMetadata(Meter.Id id, Statistic statistic, boolean descriptionsEnabled, @Nullable String overrideBaseUnit) { this.id = id; this.descriptionsEnabled = descriptionsEnabled; this.overrideBaseUnit = overrideBaseUnit; switch (statistic) { case COUNT: case TOTAL: case TOTAL_TIME: this.type = "count"; break; default: this.type = "gauge"; } }
/** * Register a gauge that reports the size of the {@link Map}. The registration will keep a weak * reference to the collection so it will not prevent garbage collection. The collection * implementation used should be thread safe. Note that calling {@link Map#size()} can be * expensive for some collection implementations and should be considered before registering. * * @param name Name of the gauge being registered. * @param tags Sequence of dimensions for breaking down the name. * @param map Thread-safe implementation of {@link Map} 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 Map<?, ?>> T gaugeMapSize(String name, Iterable<Tag> tags, T map); }
@Nullable public abstract String get(String key);
abstract String line(String amount, @Nullable Statistic stat, String type);
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; }
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(); }
/** * @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"); }
/** * @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; }
/** * @return The tag that will be mapped to {@literal @host} when shipping metrics to AppOptics. */ @Nullable default String hostTag() { String v = get(prefix() + ".hostTag"); return v == null ? "instance" : v; }