-
Notifications
You must be signed in to change notification settings - Fork 885
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
fix micrometer bridge auto configuration annotation #13083
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
import io.micrometer.core.instrument.MeterRegistry; | ||
import io.opentelemetry.javaagent.instrumentation.micrometer.v1_5.MicrometerSingletons; | ||
import org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration; | ||
import org.springframework.boot.actuate.autoconfigure.metrics.export.prometheus.PrometheusMetricsExportAutoConfiguration; | ||
import org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleMetricsExportAutoConfiguration; | ||
import org.springframework.boot.autoconfigure.AutoConfigureAfter; | ||
import org.springframework.boot.autoconfigure.AutoConfigureBefore; | ||
|
@@ -23,7 +24,10 @@ | |
// configure after the SimpleMeterRegistry has initialized; it is normally the last MeterRegistry | ||
// implementation to be configured, as it's used as a fallback | ||
// the OTel registry should be added in addition to that fallback and not replace it | ||
@AutoConfigureAfter(SimpleMetricsExportAutoConfiguration.class) | ||
@AutoConfigureAfter({ | ||
SimpleMetricsExportAutoConfiguration.class, | ||
PrometheusMetricsExportAutoConfiguration.class | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there a way to do this generically for all other MeterRegistries? (not only simple and prometheus?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you want to add more different configs that load different metric registries? sounds too much - @jeanbisutti what's your take? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, asking if there's a way to do it generically, so that it loads after all other MeterRegistries, without having to hard-code specific meter registries There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the problem is that each metric registry is typically in it's own library - see https://mvnrepository.com/artifact/io.micrometer If you don't add any of those, you only have the simple meter registry. |
||
}) | ||
@ConditionalOnBean(Clock.class) | ||
@ConditionalOnClass(MeterRegistry.class) | ||
public class OpenTelemetryMeterRegistryAutoConfiguration { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the failure for this test without your change to
OpenTelemetryMeterRegistry
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just tried... there is no failure - which confirms that the error does not always appear
but I've improved the test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the failure now (without your change to
OpenTelemetryMeterRegistry
)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trask the test is still passing with the unchanged code
I don't know how to force spring to use a different resolution order from the provided constraints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the test is still passing the old code - but I don't have an idea how to make a better test - you'd have to force spring to randomize the bean order within the provided constraints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, makes sense