-
Notifications
You must be signed in to change notification settings - Fork 38.2k
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
Introduce TestExecutionListener
for Micrometer's ObservationRegistry
in the TestContext framework
#30658
Closed
marcingrzejszczak
wants to merge
10
commits into
spring-projects:main
from
marcingrzejszczak:otla_test_listener_2
Closed
Introduce TestExecutionListener
for Micrometer's ObservationRegistry
in the TestContext framework
#30658
marcingrzejszczak
wants to merge
10
commits into
spring-projects:main
from
marcingrzejszczak:otla_test_listener_2
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
without this change we have no option to pass the ObservationRegistry that is registered in the given TestContext's ApplicationContext as the one that should be used by the ObservationThreadLocalAccessor. with this change we create a TestExecutionListener that will set an ObservationRegistry registered in the TestContext's ApplicationContext for each test class and after each test class will restore the previously stored ObservationRegistry instance
…ervation/ObservationThreadLocalTestListener.java Co-authored-by: Sam Brannen <sam@sambrannen.com>
…ervation/ObservationThreadLocalTestListener.java Co-authored-by: Sam Brannen <sam@sambrannen.com>
…ervation/ObservationThreadLocalTestListener.java Co-authored-by: Sam Brannen <sam@sambrannen.com>
…ervation/package-info.java Co-authored-by: Sam Brannen <sam@sambrannen.com>
…ervation/ObservationThreadLocalTestListenerTests.java Co-authored-by: Sam Brannen <sam@sambrannen.com>
- dependencies ordered alphabetically - renamed the test execution listener to contain "execution" and "micrometer" in the name - production code lines are smaller (up to 100 chars) - test execution attribute is a private static final field - added javadocs in the test execution listener
spring-projects-issues
added
the
status: waiting-for-triage
An issue we've not yet triaged or decided on
label
Jun 13, 2023
sbrannen
changed the title
Introduce ObservationThreadLocalTestExecutionListener in the TestContext framework
Introduce Jun 13, 2023
MicrometerObservationThreadLocalTestExecutionListener
in the TestContext framework
sbrannen
changed the title
Introduce
Introduce Jun 13, 2023
MicrometerObservationThreadLocalTestExecutionListener
in the TestContext frameworkTestExecutionListener
for MicrometerObservationThreadLocalTestExecutionListener` in the TestContext framework
sbrannen
changed the title
Introduce
Introduce Jun 13, 2023
TestExecutionListener
for MicrometerObservationThreadLocalTestExecutionListener` in the TestContext frameworkTestExecutionListener
for Micrometer's ObservationThreadLocalAccessor
in the TestContext framework
sbrannen
added
in: test
Issues in the test module
type: enhancement
A general enhancement
and removed
status: waiting-for-triage
An issue we've not yet triaged or decided on
labels
Jun 13, 2023
snicoll
added
the
status: waiting-for-triage
An issue we've not yet triaged or decided on
label
Jun 14, 2023
sbrannen
removed
the
status: waiting-for-triage
An issue we've not yet triaged or decided on
label
Jun 14, 2023
sbrannen
pushed a commit
that referenced
this pull request
Jun 14, 2023
Prior to this commit, there was no way to specify the ObservationRegistry that is registered in the given test's ApplicationContext as the one that should be used by Micrometer's ObservationThreadLocalAccessor for context propagation. This commit introduces a TestExecutionListener for Micrometer's ObservationRegistry in the Spring TestContext Framework. Specifically, this listener obtains the ObservationRegistry registered in the test's ApplicationContext, stores it in ObservationThreadLocalAccessor for the duration of each test method execution, and restores the original ObservationRegistry in ObservationThreadLocalAccessor after each test. Co-authored-by: Sam Brannen <sam@sambrannen.com> See gh-30658
sbrannen
changed the title
Introduce
Introduce Jun 14, 2023
TestExecutionListener
for Micrometer's ObservationThreadLocalAccessor
in the TestContext frameworkTestExecutionListener
for Micrometer's ObservationRegistry
in the TestContext framework
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
supersedes #30651