Skip to content

Move registry creation to @BeforeEach in SampleTestRunner #57

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

Merged

Conversation

ttddyy
Copy link
Contributor

@ttddyy ttddyy commented Sep 3, 2022

Simplifies the meter and observation registries management in SampleTestRunner

  • Add "create[Meter|Observation]Registry" protected methods
  • Initialize registries in @beforeeach
  • Remove the constructor that takes registries
  • Each parameterized test creates a new registries
  • Remove code to track used registries and @afterall to close them
  • Remove TestConfigAccessor
  • Preserve and restore observation handlers for each run (for the usage of global registries instead of creating every time)

@ttddyy ttddyy force-pushed the sample-runner-registries branch from 6927a48 to d4aea2d Compare September 3, 2022 00:32
@marcingrzejszczak
Copy link
Contributor

LGTM however I'd like @violetagg to take a look at this branch (if possible 🙏 ) with what she has there in Reactor Netty.

@violetagg
Copy link

LGTM however I'd like @violetagg to take a look at this branch (if possible 🙏 ) with what she has there in Reactor Netty.

I'll check it

@violetagg
Copy link

violetagg commented Sep 7, 2022

@ttddyy @marcingrzejszczak Do we need to recreate the registry for every test?

In Reactor Netty we have

	@BeforeAll
	static void setUp() throws CertificateException {
		...

		registry = new SimpleMeterRegistry();
		Metrics.addRegistry(registry);

		...
	}

	@AfterAll
	static void tearDown() {
		Metrics.removeRegistry(registry);
		registry.clear();
		registry.close();
	}

Also the change is breaking change :)

/.../reactor-netty/reactor-netty-http/src/test/java/reactor/netty/http/observability/ObservabilitySmokeTest.java:64: error: no suitable constructor found for SampleTestRunner(SampleRunnerConfig,ObservationRegistry,MeterRegistry)
                super(SampleTestRunner.SampleRunnerConfig.builder().build(), OBSERVATION_REGISTRY, registry);

@marcingrzejszczak
Copy link
Contributor

In Reactor Netty we have

So in your cae you would override the createMeterRegistry method where you will essentially do what you do in your setUp method

Also the change is breaking change :)

That is not possible because we typically do those just after the release ;) yeah... that's a breaking change

@violetagg
Copy link

LGTM ;)

- Add "create[Meter|Observation]Registry" protected methods
- Initialize registries in @beforeeach
- Remove the constructor that takes registries
- Each parameterized test creates a new registries
- Remove code to track used registries and @afterall to close them
@ttddyy ttddyy force-pushed the sample-runner-registries branch from d4aea2d to 4a436ce Compare September 8, 2022 17:38
ttddyy added a commit to ttddyy/spring-batch that referenced this pull request Sep 8, 2022
Accommodate the breaking change in `SampleTestRunner` introduced by
micrometer-metrics/tracing#57
ttddyy added a commit to ttddyy/reactor-netty that referenced this pull request Sep 8, 2022
Accommodate the breaking change in `SampleTestRunner` introduced by
micrometer-metrics/tracing#57
shakuzen added a commit to shakuzen/spring-data-mongodb that referenced this pull request Sep 9, 2022
shakuzen added a commit to shakuzen/spring-data-cassandra that referenced this pull request Sep 9, 2022
@marcingrzejszczak marcingrzejszczak added this to the 1.0.0-M8 milestone Sep 9, 2022
@marcingrzejszczak marcingrzejszczak merged commit 6b73506 into micrometer-metrics:main Sep 9, 2022
violetagg pushed a commit to reactor/reactor-netty that referenced this pull request Sep 9, 2022
Accommodate the breaking change in `SampleTestRunner` introduced by
micrometer-metrics/tracing#57
marcingrzejszczak added a commit that referenced this pull request Sep 9, 2022
fmbenhassine pushed a commit to spring-projects/spring-batch that referenced this pull request Sep 9, 2022
Accommodate the breaking change in `SampleTestRunner` introduced by
micrometer-metrics/tracing#57
marcingrzejszczak added a commit that referenced this pull request Sep 9, 2022
marcingrzejszczak added a commit that referenced this pull request Sep 9, 2022
marcingrzejszczak added a commit that referenced this pull request Sep 9, 2022
christophstrobl pushed a commit to spring-projects/spring-data-mongodb that referenced this pull request Sep 9, 2022
christophstrobl pushed a commit to spring-projects/spring-data-cassandra that referenced this pull request Sep 9, 2022
@ttddyy ttddyy deleted the sample-runner-registries branch September 9, 2022 18:00
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.

3 participants