Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to micrometer 1.0.0-rc.5 #11071

Closed
wants to merge 1 commit into from
Closed

Upgrade to micrometer 1.0.0-rc.5 #11071

wants to merge 1 commit into from

Conversation

jkschneider
Copy link
Contributor

Intended for Boot 2 M7.

cc / @wilkinsona
cc / @philwebb

@@ -75,6 +78,11 @@
SimpleExportConfiguration.class, StatsdExportConfiguration.class })
@AutoConfigureAfter(DataSourceAutoConfiguration.class)
public class MetricsAutoConfiguration {
@Bean
@Order(0)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sanity check please?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you can use @Order on @Bean methods.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scrub that, yes you can.

*/
public class EnvironmentMeterFilter extends PropertyMeterFilter {
private final Environment environment;
private final DefaultConversionService conversionService = new DefaultConversionService();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better way of accessing conversions in Boot 2?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a bean and you can inject one. See here and the auto-configuration

Copy link
Contributor Author

@jkschneider jkschneider Nov 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spencergibb In a vanilla Spring Boot 1.5.x app, it is not injectable. Must be configured somewhere. I think they've been fiddling with conversion service in 2.x though?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like a brittle way to support nicer Duration parsing. I'm worried that we're going directly to the Environment and possibly bypassing the relaxed binding rules. I'm tempted to pull that out and create a nice general way to bind Durations with a simple format.

return null;
}

private static Duration simpleParse(String rawTime) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback from users indicated they wanted to be able to define props like 1s rather than PT1S (sometimes). Not sure if you want this to be a capability of the default Duration conversion.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 17, 2017
@philwebb philwebb added priority: normal type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 17, 2017
@philwebb philwebb added this to the 2.0.0.M7 milestone Nov 17, 2017
@@ -42,6 +43,8 @@
*/
private Duration step = Duration.ofSeconds(10);

private CountingMode mode = CountingMode.Cumulative;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an unusual enum format. Any reason for Cumulative, Step and not CUMULATIVE, STEP? Binding should work regardless I think.

* wrapped. Timings are provided separately by wrapping the executor service with
* {@link TimedThreadPoolTaskExecutor}.
*
* @author David Held
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has the author signed the CLA? We can't accept this if not.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dheld-expedia are you the original author for this? Any chance you could consider submitting it as a PR for Boot so the CLA bot confirms that you've signed the CLA.

*/
public class EnvironmentMeterFilter extends PropertyMeterFilter {
private final Environment environment;
private final DefaultConversionService conversionService = new DefaultConversionService();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like a brittle way to support nicer Duration parsing. I'm worried that we're going directly to the Environment and possibly bypassing the relaxed binding rules. I'm tempted to pull that out and create a nice general way to bind Durations with a simple format.

@philwebb
Copy link
Member

@jkschneider I've got a simplified branch ready to merge here. This drops the ThreadPoolTaskExecutorMetrics since we need the original author to submit that one. It also removes the Duration parsing in EnvironmentMeterFilter since I think we should add a general solution for that.

Unfortunately, I still can't merge this due to the following:

Caused by: java.lang.NoClassDefFoundError: com/google/common/util/concurrent/AtomicDouble
	at io.micrometer.core.instrument.simple.CumulativeCounter.<init>(CumulativeCounter.java:28)
	at io.micrometer.core.instrument.simple.SimpleMeterRegistry.newCounter(SimpleMeterRegistry.java:128)
	at io.micrometer.core.instrument.MeterRegistry.lambda$registerMeterIfNecessary$5(MeterRegistry.java:629)
	at io.micrometer.core.instrument.MeterRegistry.registerMeterIfNecessary(MeterRegistry.java:664)
	at io.micrometer.core.instrument.MeterRegistry.registerMeterIfNecessary(MeterRegistry.java:629)
	at io.micrometer.core.instrument.MeterRegistry.counter(MeterRegistry.java:130)
	at io.micrometer.core.instrument.Counter$Builder.register(Counter.java:92)
	at io.micrometer.core.instrument.composite.CompositeCounter.registerNewMeter(CompositeCounter.java:50)
	at io.micrometer.core.instrument.composite.CompositeCounter.registerNewMeter(CompositeCounter.java:23)
	at io.micrometer.core.instrument.composite.AbstractCompositeMeter.add(AbstractCompositeMeter.java:93)
	at java.util.concurrent.ConcurrentHashMap$KeySetView.forEach(ConcurrentHashMap.java:4649)
	at io.micrometer.core.instrument.composite.CompositeMeterRegistry.newCounter(CompositeMeterRegistry.java:66)
	at io.micrometer.core.instrument.MeterRegistry.lambda$registerMeterIfNecessary$5(MeterRegistry.java:629)
	at io.micrometer.core.instrument.MeterRegistry.registerMeterIfNecessary(MeterRegistry.java:664)
	at io.micrometer.core.instrument.MeterRegistry.registerMeterIfNecessary(MeterRegistry.java:629)
	at io.micrometer.core.instrument.MeterRegistry.counter(MeterRegistry.java:130)
	at io.micrometer.core.instrument.Counter$Builder.register(Counter.java:92)
	at io.micrometer.core.instrument.binder.logging.MetricsTurboFilter.<init>(LogbackMetrics.java:64)
	at io.micrometer.core.instrument.binder.logging.LogbackMetrics.bindTo(LogbackMetrics.java:49)
	at org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration$MeterRegistryConfigurationSupport.lambda$new$1(MetricsAutoConfiguration.java:128)
	at java.util.LinkedHashMap$LinkedValues.forEach(LinkedHashMap.java:608)
	at org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration$MeterRegistryConfigurationSupport.<init>(MetricsAutoConfiguration.java:128)
	at org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration$MeterRegistryConfigurationSupport$$EnhancerBySpringCGLIB$$befa960d.<init>(<generated>)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163)
	... 23 more
Caused by: java.lang.ClassNotFoundException: com.google.common.util.concurrent.AtomicDouble
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)

I'm guessing that this import is wrong.

@philwebb philwebb added the status: blocked An issue that's blocked on an external project change label Nov 18, 2017
@jkschneider jkschneider changed the title Upgrade to micrometer 1.0.0-rc.4 Upgrade to micrometer 1.0.0-rc.5 Nov 28, 2017
@jkschneider
Copy link
Contributor Author

Guava has been removed in rc5 with micrometer-metrics/micrometer#234

@snicoll snicoll removed the status: blocked An issue that's blocked on an external project change label Nov 28, 2017
philwebb pushed a commit that referenced this pull request Nov 29, 2017
@philwebb philwebb closed this in e1306c6 Nov 29, 2017
philwebb added a commit that referenced this pull request Nov 29, 2017
* pr/11071:
  Polish micrometer rc.5 upgrade
  Upgrade to micrometer 1.0.0-rc.5
snicoll added a commit that referenced this pull request Nov 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants