-
Notifications
You must be signed in to change notification settings - Fork 41.1k
Add support for easily disabling metrics export #21658
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
Conversation
* | ||
* @author Chris Bono | ||
*/ | ||
class ExcludeMetricExportersContextCustomizerFactoryTests { |
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.
This test and the sibling ones AutoConfigureMetricsMissing/PresentIntegrationTest
overlap on coverage. If I choose between them I think that the integration test ones are more valuable as they verify against @SpringBootTest
as the annotated class.
@@ -52,7 +52,14 @@ void autoConfiguresItsConfigAndMeterRegistry() { | |||
} | |||
|
|||
@Test | |||
void autoConfigurationCanBeDisabled() { | |||
void autoConfigurationCanBeDisabledWithGlobalEnabledProperty() { |
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.
I will do this same mod to the other export config tests once I know we are good w/ the direction of this proposal.
@snicoll here is what I captured along the way while trying different approaches. BackgroundMetircs auto-configuration topology (wrt AutoConfigureBefore/After of each other)
GoalTo disable everything between ApproachesI tried several approaches leveraging TLDR; Jump to approach #5 to see the content of this code proposal. The following are of the "Don't modify any of the existing exporter auto-configurations" variety: Approach #1:
Approach #2:
Approach #3:
Status: works
Approach #4:
Status: works
The following is of the "Do what you need to do to make this work properly" variety: Approach #5:
Status: works
OutcomeNew integration test defaults is that only NextI have submitted a handful of tests to sanity check the functionality and illustrate the usage of the new annotation. If this is a direction that we agree on then I will add the missing tests and update the docs accordingly in a subsequent commit. |
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.
Thank you very much for the PR and sorry for the delay. This looks good to me so if you want to complete this PR as you've offered that would be great.
If not, no worries and I can take care of that when merging. Thanks again.
* exporters. By default, all metrics exporters other than the in-memory | ||
* {@code SimpleMetricsExportAutoConfiguration} are disabled. |
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.
I think that could confuse users as it can be read what the default behaviour of adding the annotation does. I'd rather keep it simple and we can handle the rationale in the reference guide rather.
@snicoll |
…bility to override via @AutoConfigureMetrics. Closes gh-21616
@snicoll - I added the auto-config tests for each exporter and simplified the java doc. |
Is the failure around |
Same. Don't worry about it, I'll investigate as part of polishing this change. |
Actually, it does indirectly as the actuator (and it's auto-configuration) is now added to the project. I don't know why that happens but on the other hand Actuator does not seem required. I'll investigate a bit more. |
Ahh interesting. Sounds like security is kicking in now with the added deps.
…On Fri, Jul 17, 2020, 10:05 AM Stéphane Nicoll ***@***.***> wrote:
I don't think anything in this merge request could affect that.
Actually, it does indirectly as the actuator (and it's auto-configuration)
is now added to the project. I don't know why that happens but on the other
hand Actuator does not seem required. I'll investigate a bit more.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#21658 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AG4RTQ4344MCF6MXQAS3KSTR4BSDHANCNFSM4NRI6SMQ>
.
|
@snicoll did you get a chance to follow up on the issue? If not, I can take a look in the next 24hrs. |
I've removed actuator as it's not required although I might change my mind and write a test with an actual registry implementation to validate its auto-configuration isn't enabled. I am on PTO the next 2 days and I've already started to polish things quite a bit in a branch. If you want to investigate how to prevent security to kick in the way it does, I am definitely interested. Thanks! |
Enjoy your PTO! I will look into how to prevent security from kicking in as
it will be good to know, regardless of final direction.
…On Mon, Jul 20, 2020 at 2:16 AM Stéphane Nicoll ***@***.***> wrote:
I've removed actuator as it's not required although I might change my mind
and write a test with an actual registry implementation to validate its
auto-configuration isn't enabled. I am on PTO the next 2 days and I've
already started to polish things quite a bit in a branch. If you want to
investigate how to prevent security to kick in the way it does, I am
definitely interested. Thanks!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#21658 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AG4RTQYYBSRG5VVO6SWXGKLR4PVNNANCNFSM4NRI6SMQ>
.
|
I just got around to look into this now.
|
This commit introduces a new property to globally disable metrics export. In integration tests, this property is automatically set to disable everything but in-memory metrics. This commit also introduces a `@AutoConfigureMetrics` annotation that can be used for integration tests that require metrics export to operate as they would in an application. See spring-projectsgh-21658
This commit introduces a new property to globally disable metrics export. In integration tests, this property is automatically set to disable everything but in-memory metrics. This commit also introduces a `@AutoConfigureMetrics` annotation that can be used for integration tests that require metrics export to operate as they would in an application. See gh-21658
Ha! Its not my first contribution to Spring Boot. But thank you for the warm welcome ;) |
This is your third first contribution no less 😬. Sorry about that. IIRC, GitHub kept listing you as a first-time contributor for a while. That's no longer the case so hopefully this will be your last first contribution. |
I know something was off when I saw the badge but I decided to go with the warm welcome anyway. Thank you for making your third first contribution, indeed 😂 |
3rd times a charm - so they say. ;) |
Add global metrics exporter disable property; set during tests with ability to override via
@AutoConfigureMetrics
.Closes gh-21616