Java Code Examples for io.micrometer.core.instrument.Counter#Builder

The following examples show how to use io.micrometer.core.instrument.Counter#Builder . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CountedAspect.java    From micrometer with Apache License 2.0 5 votes vote down vote up
private Counter.Builder counter(ProceedingJoinPoint pjp, Counted counted) {
    Counter.Builder builder = Counter.builder(counted.value()).tags(tagsBasedOnJoinPoint.apply(pjp));
    String description = counted.description();
    if (!description.isEmpty()) {
        builder.description(description);
    }
    return builder;
}
 
Example 2
Source File: MetricUtils.java    From grpc-spring-boot-starter with MIT License 5 votes vote down vote up
/**
 * Creates a new counter builder for the given method. By default the base unit will be messages.
 *
 * @param method The method the counter will be created for.
 * @param name The name of the counter to use.
 * @param description The description of the counter to use.
 * @return The newly created counter builder.
 */
public static Counter.Builder prepareCounterFor(final MethodDescriptor<?, ?> method,
        final String name, final String description) {
    return Counter.builder(name)
            .description(description)
            .baseUnit("messages")
            .tag(TAG_SERVICE_NAME, extractServiceName(method))
            .tag(TAG_METHOD_NAME, extractMethodName(method))
            .tag(TAG_METHOD_TYPE, method.getType().name());
}
 
Example 3
Source File: MetricUtils.java    From grpc-spring-boot-starter with MIT License 5 votes vote down vote up
/**
 * Creates a new counter builder for the given method. By default the base unit will be messages.
 *
 * @param method The method the counter will be created for.
 * @param name The name of the counter to use.
 * @param description The description of the counter to use.
 * @return The newly created counter builder.
 */
public static Counter.Builder prepareCounterFor(final MethodDescriptor<?, ?> method,
        final String name, final String description) {
    return Counter.builder(name)
            .description(description)
            .baseUnit("messages")
            .tag(TAG_SERVICE_NAME, extractServiceName(method))
            .tag(TAG_METHOD_NAME, extractMethodName(method))
            .tag(TAG_METHOD_TYPE, method.getType().name());
}
 
Example 4
Source File: AbstractMetricCollectingInterceptor.java    From grpc-spring-boot-starter with MIT License 3 votes vote down vote up
/**
 * Creates a new gRPC interceptor that will collect metrics into the given {@link MeterRegistry} and uses the given
 * customizer to configure the {@link Counter}s and {@link Timer}s.
 *
 * @param registry The registry to use.
 * @param counterCustomizer The unary function that can be used to customize the created counters.
 * @param timerCustomizer The unary function that can be used to customize the created timers.
 * @param eagerInitializedCodes The status codes that should be eager initialized.
 */
public AbstractMetricCollectingInterceptor(final MeterRegistry registry,
        final UnaryOperator<Counter.Builder> counterCustomizer,
        final UnaryOperator<Timer.Builder> timerCustomizer, final Code... eagerInitializedCodes) {
    this.registry = registry;
    this.counterCustomizer = counterCustomizer;
    this.timerCustomizer = timerCustomizer;
    this.eagerInitializedCodes = eagerInitializedCodes;
}
 
Example 5
Source File: AbstractMetricCollectingInterceptor.java    From grpc-spring-boot-starter with MIT License 3 votes vote down vote up
/**
 * Creates a new gRPC interceptor that will collect metrics into the given {@link MeterRegistry} and uses the given
 * customizer to configure the {@link Counter}s and {@link Timer}s.
 *
 * @param registry The registry to use.
 * @param counterCustomizer The unary function that can be used to customize the created counters.
 * @param timerCustomizer The unary function that can be used to customize the created timers.
 * @param eagerInitializedCodes The status codes that should be eager initialized.
 */
public AbstractMetricCollectingInterceptor(final MeterRegistry registry,
        final UnaryOperator<Counter.Builder> counterCustomizer,
        final UnaryOperator<Timer.Builder> timerCustomizer, final Code... eagerInitializedCodes) {
    this.registry = registry;
    this.counterCustomizer = counterCustomizer;
    this.timerCustomizer = timerCustomizer;
    this.eagerInitializedCodes = eagerInitializedCodes;
}
 
Example 6
Source File: MetricCollectingServerInterceptor.java    From grpc-spring-boot-starter with MIT License 2 votes vote down vote up
/**
 * Creates a new gRPC server interceptor that will collect metrics into the given {@link MeterRegistry} and uses the
 * given customizer to configure the {@link Counter}s and {@link Timer}s.
 *
 * @param registry The registry to use.
 * @param counterCustomizer The unary function that can be used to customize the created counters.
 * @param timerCustomizer The unary function that can be used to customize the created timers.
 * @param eagerInitializedCodes The status codes that should be eager initialized.
 */
public MetricCollectingServerInterceptor(final MeterRegistry registry,
        final UnaryOperator<Counter.Builder> counterCustomizer,
        final UnaryOperator<Timer.Builder> timerCustomizer, final Code... eagerInitializedCodes) {
    super(registry, counterCustomizer, timerCustomizer, eagerInitializedCodes);
}
 
Example 7
Source File: MetricCollectingClientInterceptor.java    From grpc-spring-boot-starter with MIT License 2 votes vote down vote up
/**
 * Creates a new gRPC client interceptor that will collect metrics into the given {@link MeterRegistry} and uses the
 * given customizer to configure the {@link Counter}s and {@link Timer}s.
 *
 * @param registry The registry to use.
 * @param counterCustomizer The unary function that can be used to customize the created counters.
 * @param timerCustomizer The unary function that can be used to customize the created timers.
 * @param eagerInitializedCodes The status codes that should be eager initialized.
 */
public MetricCollectingClientInterceptor(final MeterRegistry registry,
        final UnaryOperator<Counter.Builder> counterCustomizer,
        final UnaryOperator<Timer.Builder> timerCustomizer, final Code... eagerInitializedCodes) {
    super(registry, counterCustomizer, timerCustomizer, eagerInitializedCodes);
}
 
Example 8
Source File: MetricCollectingServerInterceptor.java    From grpc-spring-boot-starter with MIT License 2 votes vote down vote up
/**
 * Creates a new gRPC server interceptor that will collect metrics into the given {@link MeterRegistry} and uses the
 * given customizer to configure the {@link Counter}s and {@link Timer}s.
 *
 * @param registry The registry to use.
 * @param counterCustomizer The unary function that can be used to customize the created counters.
 * @param timerCustomizer The unary function that can be used to customize the created timers.
 * @param eagerInitializedCodes The status codes that should be eager initialized.
 */
public MetricCollectingServerInterceptor(final MeterRegistry registry,
        final UnaryOperator<Counter.Builder> counterCustomizer,
        final UnaryOperator<Timer.Builder> timerCustomizer, final Code... eagerInitializedCodes) {
    super(registry, counterCustomizer, timerCustomizer, eagerInitializedCodes);
}
 
Example 9
Source File: MetricCollectingClientInterceptor.java    From grpc-spring-boot-starter with MIT License 2 votes vote down vote up
/**
 * Creates a new gRPC client interceptor that will collect metrics into the given {@link MeterRegistry} and uses the
 * given customizer to configure the {@link Counter}s and {@link Timer}s.
 *
 * @param registry The registry to use.
 * @param counterCustomizer The unary function that can be used to customize the created counters.
 * @param timerCustomizer The unary function that can be used to customize the created timers.
 * @param eagerInitializedCodes The status codes that should be eager initialized.
 */
public MetricCollectingClientInterceptor(final MeterRegistry registry,
        final UnaryOperator<Counter.Builder> counterCustomizer,
        final UnaryOperator<Timer.Builder> timerCustomizer, final Code... eagerInitializedCodes) {
    super(registry, counterCustomizer, timerCustomizer, eagerInitializedCodes);
}