@Override protected Counter newRequestCounterFor(final MethodDescriptor<?, ?> method) { return this.counterCustomizer.apply( prepareCounterFor(method, METRIC_NAME_CLIENT_REQUESTS_SENT, "The total number of requests sent")) .register(this.registry); }
.tags(commonTags) .baseUnit("subscribers") .description("Counts how many Reactor sequences have been subscribed to") .register(registry);
@Bean public MetricCollectingServerInterceptor metricCollectingServerInterceptor(final MeterRegistry registry, final Collection<BindableService> services) { final MetricCollectingServerInterceptor metricCollector = new MetricCollectingServerInterceptor(registry, counter -> counter.tag("type", "counter"), timer -> timer.tag("type", "timer").publishPercentiles(0.5, 0.9, 0.99), OK, UNKNOWN); log.debug("Pre-Registering custom service metrics"); for (final BindableService service : services) { log.debug("- {}", service); metricCollector.preregisterService(service); } return metricCollector; }
.tags(commonTags) .baseUnit("subscribers") .description("Counts how many Reactor sequences have been subscribed to") .register(registry);
MeterRegistry registry, String name, Iterable<Tag> tags) { Counter next = Counter.builder(name + ".request").tags("status", "next").tags(tags).register(registry); Counter complete = Counter.builder(name + ".request").tags("status", "complete").tags(tags).register(registry); Counter error = Counter.builder(name + ".request").tags("status", "error").tags(tags).register(registry); Counter cancelled = Counter.builder(name + ".request") .tags("status", "cancelled") .tags(tags) .register(registry); Timer timer = Timer.builder(name + ".latency")
.description("cumulative amount of messages received") .tag("transport", transport) .register(registryInstance); this.messagesDropped = Counter.builder("zipkin_collector.messages_dropped") .description("cumulative amount of messages received that were later dropped") .tag("transport", transport) .register(registryInstance); .description("cumulative amount of bytes received") .tag("transport", transport) .baseUnit("bytes") .register(registryInstance); this.spans = Counter.builder("zipkin_collector.spans") .description("cumulative amount of spans received") .tag("transport", transport) .register(registryInstance); this.spansDropped = Counter.builder("zipkin_collector.spans_dropped") .description("cumulative amount of spans received that were later dropped") .tag("transport", transport) .register(registryInstance);
.tags(commonTags) .baseUnit("subscribers") .description("Counts how many Reactor sequences have been subscribed to") .register(registry);
informationalResponseCounter = Counter.builder("che.server.api.response") .description("Che Server Tomcat informational responses (1xx responses)") .tag("code", "1xx") .tag("area", "http") .register(registry); successResponseCounter = Counter.builder("che.server.api.response") .description("Che Server Tomcat success responses (2xx responses)") .tag("code", "2xx") .tag("area", "http") .register(registry); redirectResponseCounter = Counter.builder("che.server.api.response") .description("Che Server Tomcat redirect responses (3xx responses)") .tag("code", "3xx") .tag("area", "http") .register(registry); clientErrorResponseCounter = Counter.builder("che.server.api.response") .description("Che Server Tomcat client errors (4xx responses)") .tag("code", "4xx") .tag("area", "http") .register(registry); serverErrorResponseCounter = Counter.builder("che.server.api.response") .description("Che Server Tomcat server errors (5xx responses)") .tag("code", "5xx") .tag("area", "http")
/** * 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)); }
@Override protected Counter newResponseCounterFor(final MethodDescriptor<?, ?> method) { return this.counterCustomizer.apply( prepareCounterFor(method, METRIC_NAME_CLIENT_RESPONSES_RECEIVED, "The total number of responses received")) .register(this.registry); }
@Override public void action(StateMachine<S, E> stateMachine, Action<S, E> action, long duration) { String actionName = actionToName(action); getActionCounterBuilder(action).register(meterRegistry).increment(); getActionTimerBuilder(action).register(meterRegistry).record(duration, TimeUnit.MILLISECONDS); Map<String, Object> traceInfo = new HashMap<>(); traceInfo.put("action", actionName); traceInfo.put("duration", duration); traceInfo.put("machine", stateMachine.getId()); traceRepository.add(traceInfo); }
@Override public CounterFacade build() { return new MicroCounter(this.builder.register(this.meterRegistry), this.meterRegistry); }
private Counter.Builder getActionCounterBuilder(Action<S, E> action) { String actionName = actionToName(action); Counter.Builder builder = Counter.builder("ssm.action.execute") .tags("actionName", actionName) .description("Counter of Action"); return builder; }
@Override public void transition(StateMachine<S, E> stateMachine, Transition<S, E> transition, long duration) { getTransitionCounterBuilder(transition).register(meterRegistry).increment(); getTransitionTimerBuilder(transition).register(meterRegistry).record(duration, TimeUnit.MILLISECONDS); Map<String, Object> traceInfo = new HashMap<>(); traceInfo.put("transition", transitionToName(transition)); traceInfo.put("duration", duration); traceInfo.put("machine", stateMachine.getId()); traceRepository.add(traceInfo); }
@Override protected Counter newResponseCounterFor(final MethodDescriptor<?, ?> method) { return this.counterCustomizer.apply( prepareCounterFor(method, METRIC_NAME_SERVER_RESPONSES_SENT, "The total number of responses sent")) .register(this.registry); }
private Counter.Builder getTransitionCounterBuilder(Transition<S, E> transition) { String transitionName = transitionToName(transition); Counter.Builder builder = Counter.builder("ssm.transition.transit") .tags("transitionName", transitionName) .description("Counter of Transition"); return builder; }
@Override protected Counter newRequestCounterFor(final MethodDescriptor<?, ?> method) { return this.counterCustomizer.apply( prepareCounterFor(method, METRIC_NAME_SERVER_REQUESTS_RECEIVED, "The total number of requests received")) .register(this.registry); }
public MicrometerCounter(MeterRegistry meterRegistry, MetricId id) { super(id); counter = io.micrometer.core.instrument.Counter.builder(id.getName()) .description(id.getDescription()) .tags(id.getTags().stream().map(tag -> Tag.of(tag.getKey(), tag.getValue())) .collect(Collectors.toList())).register(meterRegistry); }
public Counter get(String... values) { // Get or create the Counter return Counter.builder(name) .description(description) .tags(Labels.toTags(keys, values)) .register(registry); } }
@Override public CounterBuilder description(String desc) { this.builder.description(desc); return this; }