@Bean MeterRegistryCustomizer<MeterRegistry> metricsCommonTags() { return registry -> { try { registry.config().commonTags("hostname", InetAddress.getLocalHost().getHostName()); } catch (UnknownHostException e) { registry.config().commonTags("hostname", APP_NAME); } }; } }
@Bean public MeterRegistryCustomizer<MeterRegistry> commonTags() { return (registry) -> registry.config() .commonTags("application", "cities"); }
@Bean public MeterRegistryCustomizer<MeterRegistry> commonTags() { return (registry) -> registry.config() .commonTags("application", "boot1-load-sample"); }
@Override public Vertx getObject() throws Exception { LOGGER.debug("Creating a new instance of Vert.x"); VertxOptions options = new VertxOptions(); boolean metricsEnabled = environment.getProperty("services.metrics.enabled", Boolean.class, false); if (metricsEnabled) { configureMetrics(options); } Vertx instance = Vertx.vertx(options); instance.registerVerticleFactory(springVerticleFactory); if (metricsEnabled) { MeterRegistry registry = BackendRegistries.getDefaultNow(); registry.config() .meterFilter(new RenameVertxFilter()) .commonTags("application", node.application()) .commonTags("instance", node.hostname()); new FileDescriptorMetrics().bindTo(registry); new ClassLoaderMetrics().bindTo(registry); new JvmMemoryMetrics().bindTo(registry); new JvmGcMetrics().bindTo(registry); new ProcessorMetrics().bindTo(registry); new JvmThreadMetrics().bindTo(registry); } return instance; }
/** * Customizer for meter registry. * * @return The new meter registry customizer. */ @Bean public MeterRegistryCustomizer<MeterRegistry> commonTags() { return r -> r.config().commonTags( MetricsTags.forProtocolAdapter(MetricsTags.VALUE_PROTOCOL_HTTP)); }
/** * Customizer for meter registry. * * @return The new meter registry customizer. */ @Bean public MeterRegistryCustomizer<MeterRegistry> commonTags() { return r -> r.config().commonTags( MetricsTags.forProtocolAdapter("kura")); }
@Test @DisplayName("common tags are added to every measurement") void addCommonTags(MeterRegistry registry) { registry.config().commonTags("k", "v"); Counter c = registry.counter("foo"); assertThat(registry.get("foo").tags("k", "v").counter()).isSameAs(c); assertThat(c.getId().getTagsAsIterable()).hasSize(1); }
/** * Customizer for meter registry. * * @return The new meter registry customizer. */ @Bean public MeterRegistryCustomizer<MeterRegistry> commonTags() { return r -> r.config().commonTags( MetricsTags.forProtocolAdapter(Constants.PROTOCOL_ADAPTER_TYPE_HTTP)); }
/** * Customizer for meter registry. * * @return The new meter registry customizer. */ @Bean public MeterRegistryCustomizer<MeterRegistry> commonTags() { return r -> r.config().commonTags( MetricsTags.forProtocolAdapter(Constants.PROTOCOL_ADAPTER_TYPE_COAP)); }
/** * Customizer for meter registry. * * @return The new meter registry customizer. */ @Bean public MeterRegistryCustomizer<MeterRegistry> commonTags() { return r -> r.config().commonTags( MetricsTags.forProtocolAdapter(Constants.PROTOCOL_ADAPTER_TYPE_MQTT)); }
/** * Customizer for meter registry. * * @return The new meter registry customizer. */ @Bean public MeterRegistryCustomizer<MeterRegistry> commonTags() { return r -> r.config().commonTags( MetricsTags.forService(MetricsTags.VALUE_SERVICE_REGISTRY)); }
/** * Customizer for meter registry. * * @return The new meter registry customizer. */ @Bean public MeterRegistryCustomizer<MeterRegistry> commonTags() { return r -> r.config().commonTags( MetricsTags.forProtocolAdapter(Constants.PROTOCOL_ADAPTER_TYPE_KURA)); }
@Bean public MeterRegistryCustomizer<MeterRegistry> cloudFoundryMetricsCommonTags() { return registry -> registry.config() .commonTags("cf.org.name", organizationName) .commonTags("cf.space.id", spaceId) .commonTags("cf.space.name", spaceName) .commonTags("cf.app.id", applicationId) .commonTags("cf.app.name", applicationName) .commonTags("cf.app.version", applicationVersion) .commonTags("cf.instance.index", instanceIndex); } }
@Bean public MeterRegistryCustomizer<MeterRegistry> metricsCommonTags() { return registry -> registry.config() .commonTags("stream.name", streamName) .commonTags("application.name", applicationName) .commonTags("application.type", applicationType) .commonTags("instance.index", instanceIndex) .commonTags("application.guid", applicationGuid); }
/** * Customizer for meter registry. * * @return The new meter registry customizer. */ @Bean public MeterRegistryCustomizer<MeterRegistry> commonTags() { return r -> r.config().commonTags( MetricsTags.forProtocolAdapter(MetricsTags.VALUE_PROTOCOL_MQTT)); }
/** * Customizer for meter registry. * * @return The new meter registry customizer. */ @Bean public MeterRegistryCustomizer<MeterRegistry> commonTags() { return r -> r.config().commonTags(MetricsTags.forService(Constants.SERVICE_NAME_AUTH)); } }
@Bean public MeterRegistryCustomizer<MeterRegistry> metricsCommonTags() { return registry -> { registry.config().commonTags(APP_TAG_KEY, appName); registry.config().commonTags(HOST_TAG_KEY, HostUtil.getHost(HostUtil.getMXBeanName())); registry.config() .commonTags(IP_TAG_KEY, registry.config().namingConvention().tagKey(HostUtil.HOST_IP)); registry.config().commonTags(PROFILE_KEY, profile); }; }
/** * Customizer for meter registry. * * @return The new meter registry customizer. */ @Bean public MeterRegistryCustomizer<MeterRegistry> commonTags() { return r -> r.config().commonTags(MetricsTags.forService(Constants.SERVICE_NAME_DEVICE_REGISTRY)); }