Skip to content

Conversation

marcingrzejszczak
Copy link
Contributor

@marcingrzejszczak marcingrzejszczak commented Oct 23, 2019

Since I'm no metrics expert I need feedback from such as experts as @shakuzen @adriancole @msmsimondean and the rest of the experts interested in this topic ;)

I've added an initial implementation that uses counters and gauges from micrometer for metrics. I've passed some default values for metric names but I'm not sure if those are the best.

This would actually start defaulting to the Micrometer version of a metric reporter since it's pretty much always on the classpath. If someone doesn't have a meterRegistry bean, then the in memory option will be taken into account.

I don't think we can have an option that there is no micrometer on the classpath since it comes with boot.

UPDATE: As @spencergibb mentioned, micrometer comes as an dependency with an actuator, however actuator doesn't always have to be there. As @adriancole mentioned there already is a zipkin micrometer reporter that we can reuse.

@msmsimondean
Copy link

@marcingrzejszczak would it be worth using the Noop metrics reporter if meterRegistry bean is not registered. What do you think @adriancole?

@spencergibb
Copy link
Member

Micrometer is optional in boot, it is pulled in with the actuator starter.


@Configuration
@ConditionalOnBean(MeterRegistry.class)
static class TraceMicrometerMetricsConfiguration {
Copy link
Member

Choose a reason for hiding this comment

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

This should be a toplevel auto configuration conditional on a micrometer class

@marcingrzejszczak
Copy link
Contributor Author

@marcingrzejszczak would it be worth using the Noop metrics reporter if meterRegistry bean is not registered. What do you think @adriancole?

that's already the case

Micrometer is optional in boot, it is pulled in with the actuator starter.

@spencergibb I wasn't sure of that, initially I did exactly what you suggested (with class check) and then I removed it. I'll bring it back.

@codefromthecrypt
Copy link
Contributor

is there a reason we aren't using this? if so, maybe we mention https://github.com/openzipkin/zipkin-reporter-java/tree/master/metrics-micrometer

@marcingrzejszczak
Copy link
Contributor Author

Most likely cause I didn't know that it's a thing

@marcingrzejszczak marcingrzejszczak changed the title WIP: Micrometer metrics instead of in memory one Use Micrometer metrics instead of in memory one Oct 24, 2019
@codecov
Copy link

codecov bot commented Oct 24, 2019

Codecov Report

Merging #1477 into master will increase coverage by 0.13%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1477      +/-   ##
============================================
+ Coverage     58.87%   59.01%   +0.13%     
+ Complexity      817      816       -1     
============================================
  Files           154      154              
  Lines          4401     4406       +5     
  Branches        480      480              
============================================
+ Hits           2591     2600       +9     
+ Misses         1593     1591       -2     
+ Partials        217      215       -2
Impacted Files Coverage Δ Complexity Δ
...loud/sleuth/autoconfig/TraceAutoConfiguration.java 83.14% <100%> (+1%) 25 <0> (-1) ⬇️
.../sender/ZipkinRestTemplateSenderConfiguration.java 82.53% <0%> (+6.34%) 4% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 81c2b88...db47ffc. Read the comment docs.

<artifactId>zipkin-reporter-metrics-micrometer</artifactId>
<exclusions>
<exclusion>
<groupId>io.micrometer</groupId>
Copy link
Contributor

Choose a reason for hiding this comment

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

@shakuzen reminds me.. we probably should have had this set to "provided" scope in upstream anyway


@Configuration
@ConditionalOnMissingClass("io.micrometer.core.instrument.MeterRegistry")
static class TraceMetricsNoOpConfiguration {
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be

Suggested change
static class TraceMetricsNoOpConfiguration {
static class TraceMetricsInMemoryConfiguration {

if no-op is desired, that would be different and cheaper.

Copy link
Contributor

@codefromthecrypt codefromthecrypt left a comment

Choose a reason for hiding this comment

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

looks right

@marcingrzejszczak marcingrzejszczak merged commit d515370 into master Oct 24, 2019
@marcingrzejszczak marcingrzejszczak deleted the issues_#1468_micrometer_metrics branch October 24, 2019 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants