Java Code Examples for io.micrometer.core.instrument.Tags#concat()
The following examples show how to use
io.micrometer.core.instrument.Tags#concat() .
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: KafkaProducerMetricsBinder.java From summerframework with Apache License 2.0 | 6 votes |
private Iterable<Tag> nameTag(ObjectName name) { Tags tags = Tags.empty(); String clientId = name.getKeyProperty("client-id"); if (clientId != null) { tags = Tags.concat(tags, "client.id", clientId); } String topic = name.getKeyProperty("topic"); if (topic != null) { tags = Tags.concat(tags, "topic", topic); } String nodeId = name.getKeyProperty("node-id"); if (nodeId != null) { tags = Tags.concat(tags, "node-id", nodeId); } return tags; }
Example 2
Source File: DiskSpaceMetrics.java From micrometer with Apache License 2.0 | 6 votes |
@Override public void bindTo(MeterRegistry registry) { Iterable<Tag> tagsWithPath = Tags.concat(tags, "path", absolutePath); Gauge.builder("disk.free", path, File::getUsableSpace) .tags(tagsWithPath) .description("Usable space for path") .baseUnit(BaseUnits.BYTES) .strongReference(true) .register(registry); Gauge.builder("disk.total", path, File::getTotalSpace) .tags(tagsWithPath) .description("Total space for path") .baseUnit(BaseUnits.BYTES) .strongReference(true) .register(registry); }
Example 3
Source File: DiskSpaceMetrics.java From summerframework with Apache License 2.0 | 5 votes |
@Override public void bindTo(MeterRegistry registry) { Iterable<Tag> tagsWithPath = Tags.concat(tags, "path", absolutePath); Gauge.builder("disk.free", path, File::getUsableSpace).tags(tagsWithPath).description("Usable space for path") .baseUnit("bytes").register(registry); Gauge.builder("disk.total", path, File::getTotalSpace).tags(tagsWithPath).description("Total space for path") .baseUnit("bytes").register(registry); }
Example 4
Source File: KafkaConsumerMetrics.java From summerframework with Apache License 2.0 | 5 votes |
private Iterable<Tag> nameTag(ObjectName name) { Tags tags = Tags.empty(); String clientId = name.getKeyProperty("client-id"); if (clientId != null) { tags = Tags.concat(tags, "client.id", clientId); } String topic = name.getKeyProperty("topic"); if (topic != null) { tags = Tags.concat(tags, "topic", topic); } return tags; }
Example 5
Source File: TimedExecutorService.java From micrometer with Apache License 2.0 | 5 votes |
public TimedExecutorService(MeterRegistry registry, ExecutorService delegate, String executorServiceName, String metricPrefix, Iterable<Tag> tags) { this.registry = registry; this.delegate = delegate; Tags finalTags = Tags.concat(tags, "name", executorServiceName); this.executionTimer = registry.timer(metricPrefix + "executor", finalTags); this.idleTimer = registry.timer(metricPrefix + "executor.idle", finalTags); }
Example 6
Source File: TimedExecutor.java From micrometer with Apache License 2.0 | 5 votes |
public TimedExecutor(MeterRegistry registry, Executor delegate, String executorName, String metricPrefix, Iterable<Tag> tags) { this.registry = registry; this.delegate = delegate; Tags finalTags = Tags.concat(tags, "name", executorName); this.executionTimer = registry.timer(metricPrefix + "executor.execution", finalTags); this.idleTimer = registry.timer(metricPrefix + "executor.idle", finalTags); }
Example 7
Source File: MicrometerMetricsPublisherCommandTest.java From micrometer with Apache License 2.0 | 5 votes |
private void assertExecutionMetric(Iterable<Tag> tags, HystrixEventType eventType, double count) { Iterable<Tag> myTags = Tags.concat(tags, "event", eventType.name().toLowerCase(), "terminal", Boolean.toString(eventType.isTerminal())); assertThat(registry.get("hystrix.execution").tags(myTags) .counter() .count()).isEqualTo(count); }
Example 8
Source File: HttpMetricsTagConfiguration.java From micrometer with Apache License 2.0 | 5 votes |
@Bean WebMvcTagsProvider webMvcTagsProvider() { return new DefaultWebMvcTagsProvider() { @Override public Iterable<Tag> getTags(HttpServletRequest request, HttpServletResponse response, Object handler, Throwable exception) { return Tags.concat( super.getTags(request, response, handler, exception), Optional.ofNullable(responseTags.remove(response)).orElse(Tags.empty()) ); } }; }
Example 9
Source File: DataSourcePoolMetrics.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 5 votes |
public DataSourcePoolMetrics( DataSource dataSource, DataSourcePoolMetadataProvider metadataProvider, String name, Iterable<Tag> tags ) { Assert.notNull( dataSource, "DataSource must not be null" ); Assert.notNull( metadataProvider, "MetadataProvider must not be null" ); this.dataSource = dataSource; this.metadataProvider = new CachingDataSourcePoolMetadataProvider( metadataProvider ); this.tags = Tags.concat( tags, "name", name ); }
Example 10
Source File: FileStoresMeterBinder.java From che with Eclipse Public License 2.0 | 5 votes |
@Override public void bindTo(MeterRegistry registry) { for (FileStore fileStore : FileSystems.getDefault().getFileStores()) { LOG.debug( "Add gauge metric for {}, isReadOnly {}, type {}", fileStore.name(), fileStore.isReadOnly(), fileStore.type()); Iterable<Tag> tagsWithPath = Tags.concat(Tags.empty(), "path", fileStore.toString()); Gauge.builder("disk.free", fileStore, exceptionToNonWrapper(FileStore::getUnallocatedSpace)) .tags(tagsWithPath) .description("Unallocated space for file storage") .baseUnit("bytes") .strongReference(true) .register(registry); Gauge.builder("disk.total", fileStore, exceptionToNonWrapper(FileStore::getTotalSpace)) .tags(tagsWithPath) .description("Total space for file storage") .baseUnit("bytes") .strongReference(true) .register(registry); Gauge.builder("disk.usable", fileStore, exceptionToNonWrapper(FileStore::getUsableSpace)) .tags(tagsWithPath) .description("Usable space for file storage") .baseUnit("bytes") .strongReference(true) .register(registry); } }
Example 11
Source File: MicrometerReporterMetrics.java From zipkin-reporter-java with Apache License 2.0 | 4 votes |
@Override public void incrementMessagesDropped(Throwable cause) { Iterable<Tag> tags = Tags.concat(extraTags, "cause", cause.getClass().getSimpleName()); meterRegistry.counter(PREFIX + "messages.dropped", tags).increment(); }
Example 12
Source File: PoolingHttpClientConnectionManagerMetricsBinder.java From micrometer with Apache License 2.0 | 2 votes |
/** * Creates a metrics binder for the given connection pool control. * * @param connPoolControl The connection pool control to monitor. * @param name Name of the connection pool control. Will be added as tag with the key "httpclient". * @param tags Tags to apply to all recorded metrics. */ @SuppressWarnings("WeakerAccess") public PoolingHttpClientConnectionManagerMetricsBinder(ConnPoolControl<HttpRoute> connPoolControl, String name, Iterable<Tag> tags) { this.connPoolControl = connPoolControl; this.tags = Tags.concat(tags, "httpclient", name); }